ASLPrep cannot calculate deltam

Summary of what happened:

Hello! I have been able to run ASLPrep on a longitudinal dataset that I am collecting, but each run exits with the same error: “nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node extract_deltam.”

I do not believe that all the proper outputs are being created due to this error. My ASL files contain the m0 image and 7 label/control pairs, but unfortunately we also have a dummy control scan in between m0 and the first label/control pair and I wonder if this is throwing the deltam calculation.

Thanks for your help!

Command used (and if a helper script was used, a link to the helper script or the command generated):

singularity run -B /zwork/hannah/mbp/data:/bids-root 
-B /zwork/hannah/mbp/data/derivatives/aslprep:/output 
-B /zwork/hannah/mbp/workdir:/workdir 
-B /sw/freesurfer/license.txt:/license  
/zwork/hannah/mbp/data/code/aslprep/aslprep-0.7.2.simg 
/bids-root 
/output 
participant 
--participant_label sub-1001B 
-w /workdir 
--fs-license-file /license 
--longitudinal 

Version:

0.7.2

Environment (Docker, Singularity / Apptainer, custom installation):

Singularity container on a shared computing cluster

Data formatted according to a validatable standard? Please provide the output of the validator:

        1: [WARN] It is recommended to define 'VascularCrushing' for this file. 'VascularCrushing' is a boolean value indicating if an ASL crusher method is used. (code: 137 - VASCULAR_CRUSHING_MUST_DEFINE)
                ./sub-1001B/ses-base1/perf/sub-1001B_ses-base1_asl.nii.gz
                ./sub-1001B/ses-base2/perf/sub-1001B_ses-base2_asl.nii.gz
                ./sub-1001B/ses-gest1/perf/sub-1001B_ses-gest1_asl.nii.gz
                ./sub-1001B/ses-gest2/perf/sub-1001B_ses-gest2_asl.nii.gz
                ./sub-1001B/ses-gest3/perf/sub-1001B_ses-gest3_asl.nii.gz
                ./sub-1001B/ses-gest4/perf/sub-1001B_ses-gest4_asl.nii.gz
                ./sub-1001B/ses-gest5/perf/sub-1001B_ses-gest5_asl.nii.gz
                ./sub-1001B/ses-gest6/perf/sub-1001B_ses-gest6_asl.nii.gz
                ./sub-1001B/ses-gest7/perf/sub-1001B_ses-gest7_asl.nii.gz
                ./sub-1001B/ses-post1/perf/sub-1001B_ses-post1_asl.nii.gz
                ... and 1 more files having this issue (Use --verbose to see them all).

        Please visit https://neurostars.org/search?q=VASCULAR_CRUSHING_MUST_DEFINE for existing conversations about this issue.

        2: [WARN] The recommended file /README is very small. Please consider expanding it with additional information about the dataset. (code: 213 - README_FILE_SMALL)
                ./README

        Please visit https://neurostars.org/search?q=README_FILE_SMALL for existing conversations about this issue.

        Summary:                   Available Tasks:                     Available Modalities:
        1557 Files, 88.46GB        rest                                 MRI
        12 - Subjects              TODO: full task name for rest
        23 - Sessions

Relevant log outputs (up to 20 lines):

File: /output/sub-1001B/log/20240715-142821_2f6583ad-d957-4227-ba1a-657a20410788/crash-20240716-003951-hannah-extract_deltam-682c3d1b-dee7-4e01-8430-cae8f81f7d48.txt
Working Directory: /workdir/aslprep_0_7_wf/sub_1001B_wf/asl_preproc_ses_post2_wf/cbf_wf/extract_deltam
Inputs:

    asl_file: /workdir/aslprep_0_7_wf/sub_1001B_wf/asl_preproc_ses_post2_wf/asl_native_wf/aslref_asl/sub-1001B_ses-post2_asl_reducedresampled.nii.gz
    aslcontext: /workdir/aslprep_0_7_wf/sub_1001B_wf/asl_preproc_ses_post2_wf/asl_native_wf/reduce_asl_file/sub-1001B_ses-post2_aslcontext_reduced.tsv
    dummy_scans: 0
    fwhm: 5.0
    in_mask: /workdir/aslprep_0_7_wf/sub_1001B_wf/asl_preproc_ses_post2_wf/cbf_wf/reduce_mask/sub-1001B_ses-post2_asl_contrast_squeezed_corrected_brain_mask_maths_refinemask.nii.gz
    m0scan:
    m0scan_metadata: None
    metadata: {'AcquisitionMatrixPE': 63, 'AcquisitionNumber': 1, 'AcquisitionTime': '14:16:40.485000', 'AcquisitionVoxelSize': [2.5, 2.5, 2.5], 'ArterialSpinLabelingType': 'PCASL', 'BackgroundSuppression': False, 'BaseResolution': 96, 'BodyPartExamined': 'BRAIN', 'CoilCombinationMethod': 'Sum of Squares', 'ConsistencyInfo': 'N4_VE11C_LATEST_20160120', 'ConversionSoftware': 'dcm2niix', 'ConversionSoftwareVersion': 'v1.0.20220720', 'DeviceSerialNumber': '67022', 'DwellTime': 2e-06, 'EchoTime': 0.03676, 'EchoTrainLength': 63, 'FlipAngle': 120, 'HeudiconvVersion': '1.1.6', 'ImageOrientationPatientDICOM': [0.998922, -0.0389219, -0.0253158, 0.0343595, 0.986394, -0.160766], 'ImageOrientationText': 'Tra>Cor(-9.2)>Sag(-1.8)', 'ImageType': ['ORIGINAL', 'PRIMARY', 'ASL', 'NONE', 'ND', 'MOSAIC'], 'ImagingFrequency': 123.198, 'InPlanePhaseEncodingDirectionDICOM': 'COL', 'InstitutionAddress': 'UCEN Rd 551 Bldg 251,Isla Vista,Los Angeles,US,93117', 'InstitutionName': 'UCSB Brain Imaging Center', 'InstitutionalDepartmentName': 'Psych Department', 'LabelingDuration': 1.5, 'M0Type': 'Included', 'MRAcquisitionType': '3D', 'MagneticFieldStrength': 3, 'Manufacturer': 'Siemens', 'ManufacturersModelName': 'Prisma_fit', 'MatrixCoilMode': 'SENSE', 'MeanGzx10': 6, 'Modality': 'MR', 'NonlinearGradientCorrection': False, 'PartialFourier': 1, 'PatientPosition': 'HFS', 'PercentPhaseFOV': 100, 'PercentSampling': 65.625, 'PhaseEncodingDirection': 'j-', 'PhaseEncodingSteps': 63, 'PhaseResolution': 0.65625, 'PixelBandwidth': 2605, 'PostLabelingDelay': 1.8, 'ProcedureStepDescription': 'Jacobs^Grotzinger', 'ProtocolName': 'tgse_pcasl_PLD1800_ucsd', 'PulseSequenceDetails': '%CustomerSeq%\\tgse_pcasl_ve11c_Multidelay', 'RFGap': 0.00036, 'ReceiveCoilActiveElements': 'HC1-7', 'ReceiveCoilName': 'HeadNeck_64', 'ReconMatrixPE': 96, 'RepetitionTime': 4.1, 'RepetitionTimePreparation': 4100, 'SAR': 0.0559364, 'ScanOptions': 'FS', 'ScanningSequence': 'EP', 'SequenceName': 'tgse3d1_3780', 'SequenceVariant': 'SK', 'SeriesDescription': 'tgse_pcasl_PLD1800_ucsd', 'SeriesNumber': 10, 'ShimSetting': [-4122, 1379, -5954, 367, 148, -292, -167, 51], 'SliceThickness': 2.5, 'SoftwareVersions': 'syngo MR E11', 'SpacingBetweenSlices': 2.5, 'StationName': 'MRC35273', 'TotalAcquiredPairs': 7, 'TxRefAmp': 212.175}
    name_source: /bids-root/sub-1001B/ses-post2/perf/sub-1001B_ses-post2_asl.nii.gz

Traceback (most recent call last):
  File "/opt/conda/envs/aslprep/lib/python3.11/site-packages/nipype/pipeline/plugins/multiproc.py", line 344, in _send_procs_to_workers
    self.procs[jobid].run(updatehash=updatehash)
  File "/opt/conda/envs/aslprep/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/aslprep/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/aslprep/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node extract_deltam.

Traceback:
	Traceback (most recent call last):
	  File "/opt/conda/envs/aslprep/lib/python3.11/site-packages/nipype/interfaces/base/core.py", line 397, in run
	    runtime = self._run_interface(runtime)
	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	  File "/opt/conda/envs/aslprep/lib/python3.11/site-packages/aslprep/interfaces/cbf.py", line 240, in _run_interface
	    assert len(label_volume_idx) == len(control_volume_idx)
	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	AssertionError

Screenshots / relevant information:

Here are the contents of the aslcontext.tsv files for each session (the first control image is the dummy scan):
volume_type
m0scan
control
label
control
label
control
label
control
label
control
label
control
label
control
label
control


Hi @Hannah_Grotzinger and welcome to neurostars!

It looks like you have one more control than you do label, leading to the AssertionError when comparing the lengths of the two vectors.

If your first control image is a dummy scan, perhaps try setting --dummy-scans 1?

Best,
Steven

I don’t know if the --dummy-scans flag is actually functional right now (I hope it is, but I haven’t actually tested it). @Hannah_Grotzinger if it doesn’t work, I’d recommend cropping out the dummy scan from your ASL and aslcontext files.

Also, “dummy” volumes are not supported in ASL BIDS. I would strongly recommend following up in this BIDS spec issue (aslcontext.tsv dummy volumes · Issue #1762 · bids-standard/bids-specification · GitHub) to get some momentum going on adding them to BIDS.

Thank you both for the advice, I did try the --dummy-scans flag and it did not work so I’ll be sure to check out the BIDS spec issue. Thanks again!