Rerunning fmriprep when distortion map fails

Hi,
We ran a ton of scans where fmrirep didn’t find/use distortion maps for some of our functional scans. This was probably due to a labeling error on the intended for field. If I fix the labeling error and rerun fMRIprep in the same way, will fmrirpep…

  1. rerun all needed modules with the distortion map?
  2. how do I quickly check it’s found the fmap image in the output without having to wait 12 hours to see the final product?
  3. is it smart enough to leave the scans alone that did work and haven’t been modified?

Thanks,

Jen

Hi @AustinBipolar,

Yes

Look at the beginning of the process output (e.g., your SLURM logfile or analagous). The SDCflows fmap-BOLD match report is one of the first items of the log. E.g.,

221220-20:19:27,223 nipype.workflow INFO:
	 B0 field inhomogeneity map will be estimated with  the following 2 estimators: [<EstimatorType.PEPOLAR: 2>, <EstimatorType.PEPOLAR: 2>].
221220-20:19:27,515 nipype.workflow INFO:
	 No single-band-reference found for sub-NDARAA306NT2_ses-HBNsiteRU_task-movieDM_bold.nii.gz.
221220-20:19:27,516 nipype.workflow INFO:
	 Found usable B0-map (fieldmap) estimator(s) <auto_00000> to correct </om2/scratch/tmp/smeisler/HBN_DM_SCRATCH/sub-NDARAA306NT2/data/sub-NDARAA306NT2/ses-HBNsiteRU/func/sub-NDARAA306NT2_ses-HBNsiteRU_task-movieDM_bold.nii.gz> for susceptibility-derived distortions.

It should be!

Best,
Steven

So, if it’s getting this far, it hasn’t identified the distortion maps?

Building fMRIPrep's workflow:
           * BIDS dataset path: /scratch/06953/jes6785/project_nectary.
           * Participant list: ['a024'].
           * Run identifier: 20230912-143231_0d1ca83c-0ca6-49b0-b010-e46fc1c42bc7.
           * Output spaces: MNI152NLin2009cAsym:res-native.
           * Pre-run FreeSurfer's SUBJECTS_DIR: /scratch/06953/jes6785/project_nectary/derivatives/fmriprep-v23.1.3/sourcedata/freesurfer.
230912-14:33:06,152 nipype.workflow INFO:
	 No single-band-reference found for sub-a024_ses-01_task-cyb_dir-AP_bold.nii.gz.
230912-14:33:06,543 nipype.workflow INFO:"
	 No single-band-reference found for sub-a024_ses-01_task-rest_dir-AP_bold.nii.gz.
230912-14:33:10,536 nipype.workflow INFO:
	 fMRIPrep workflow graph with 613 nodes built successfully.
230912-14:33:29,798 nipype.workflow IMPORTANT:
	 fMRIPrep started!
230912-14:33:32,621 nipype.workflow WARNING:
	 Some nodes exceed the total amount of memory available (190.00GB).

I also don’t see a fmap folder being created in my derivatives folder for this subject, so assume it’s still failing to find them.

I’ve run dcm2bids on a Phillips scanner. Attached is the fieldmap json file. It is missing the TotalReadOutTime and SliceTiming info, but my understanding is that it will still do the fmap correction without these variables. I have set up a similar json set up on a siemens scanner with similar protocol and am not running into this problem.

Here is my json for the

    "Modality": "MR",
    "MagneticFieldStrength": 3,
    "ImagingFrequency": 127.762,
    "Manufacturer": "Philips",
    "ManufacturersModelName": "Ingenia Elition X",
    "InstitutionName": "Cincinnati Children's Hospital",
    "InstitutionalDepartmentName": "Research",
    "InstitutionAddress": "3333 Burnett Ave",
    "DeviceSerialNumber": "45011",
    "StationName": "IRC-3T2",
    "BodyPartExamined": "BRAIN",
    "PatientPosition": "HFS",
    "ProcedureStepDescription": "IRC769",
    "SoftwareVersions": "5.7.1\\5.7.1.1",
    "MRAcquisitionType": "2D",
    "SeriesDescription": "CYBERBALL fMRI NEW fieldmap PA",
    "ProtocolName": "WIP CYBERBALL fMRI NEW fieldmap PA",
    "ScanningSequence": "GR",
    "SequenceVariant": "SK",
    "ScanOptions": "FS",
    "PulseSequenceName": "FEEPI",
    "ImageType": [
        "ORIGINAL",
        "PRIMARY",
        "M",
        "FFE",
        "M",
        "FFE"
    ],
    "SeriesNumber": 1201,
    "AcquisitionTime": "10:02:50.220000",
    "AcquisitionNumber": 12,
    "PhilipsRWVSlope": 1.04615,
    "PhilipsRWVIntercept": 0,
    "PhilipsRescaleSlope": 1.04615,
    "PhilipsRescaleIntercept": 0,
    "PhilipsScaleSlope": 0.0219916,
    "UsePhilipsFloatNotDisplayScaling": 1,
    "SliceThickness": 2.5,
    "SpacingBetweenSlices": 2.5,
    "SAR": 0.0840799,
    "EchoTime": 0.03,"RepetitionTime": 0.778,
    "MTState": false,
    "FlipAngle": 52,
    "CoilString": "MULTI COIL",
    "PercentPhaseFOV": 100,
    "PercentSampling": 97.7273,
    "EchoTrainLength": 85,
    "PartialFourierDirection": "PHASE",
    "PartialFourierEnabled": "YES",
    "PhaseEncodingStepsNoPartialFourier": 85,
    "AcquisitionMatrixPE": 85,
    "ReconMatrixPE": 96,
    "ParallelAcquisitionTechnique": "MBSENSE",
    "ParallelReductionOutOfPlane": 6,
    "WaterFatShift": 26.89,
    "EstimatedEffectiveEchoSpacing": 0.000644032,
    "EstimatedTotalReadoutTime": 0.061183,
    "AcquisitionDuration": 11.531,
    "PixelBandwidth": 1795,
    "PhaseEncodingAxis": "j",
    "ImageOrientationPatientDICOM": [
        1,
        0,
        0,
        0,
        0.982044,
        -0.18865
    ],
    "InPlanePhaseEncodingDirectionDICOM": "COL",
    "ConversionSoftware": "dcm2niix",
    "ConversionSoftwareVersion": "v1.0.20220720",
    "Dcm2bidsVersion": "2.1.7",
    "IntendedFor": "ses-01/func/sub-a024_ses-01_task-cyb_dir-AP_bold.nii.gz"
    }```

**What I have tried**
adding "PhaseEncodingDirection" field to the fmap
checked that the intended for file exists
I am using version 23.1.3 of fMRIprep

What am I missing?

Hi @AustinBipolar,

Can you print the full bids validation report on your dataset? It includes warnings for incorrect IntendedFor links I believe (and is also generally good to know - fMRIPrep is not fully supported on non-valid datasets). Also, can you try surrounding the IntendedFor item in [ ]? So it would be

"IntendedFor": ["ses-01/func/sub-a024_ses-01_task-cyb_dir-AP_bold.nii.gz"]

Also, please define PhaseEncodingDirection in the fmap json, and make sure it is opposite of that in the BOLD json.

What is the filename of the fmap? Most importantly does it have dir-PA in the filename?

Best,
Steven

fMRIPrep does need to be able to calculate TotalReadoutTime. See sdcflows.utils.epimanip module - sdcflows 2.5.2.dev74+ga6089277 documentation for a thorough exploration of the needed metadata.

The metadata copied above does not contain any of these. You could try changing “EstimatedTotalReadoutTime” to “TotalReadoutTime”, but understand that it is an estimate made by dcm2niix, not a value actually encoded in the Phillips DICOM.

Both BOLD and EPI images need some method of determining TRT.

That’s it. It wanted total readout time. Thanks for all the above suggestions. I’ll have to work that out somehow, but the estimate seems to at least help fMRIprep identify the fmap. Thanks again!