fMRIPrep finishes with no obvious error AND no obvious outout

Summary of what happened:

Hello fMRIPrep experts,

I’m running fMRIPrep on Ubuntu 22.04 using data from a single test subject. The data were converted to BIDS format using dcm2bids, and it passes BIDS validation (with only warnings).

However, there seems to be no actual output in my subject directory. Like, nothing beyond what dcm2bids put there. I do see a work directory with a couple of sub-folders (e.g., fmriprep_24_1_wf), but no log or anything useful. Probably I’m missing something obvious, but I’ve also searched previous messages and found nothing relevant. I’d appreciate any help/insight.

Best,
Will

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

singularity run --cleanenv -B /home \
/home/zo22/data/language_aging/scripts/fmriprep_24.1.1.sif \
/home/zo22/data/language_aging/source_data/sub-${subj} \
/home/zo22/data/language_aging/bids/work participant \
--participant-label sub-${subj} \
--fs-license-file /home/wgraves/software/freesurfer/license.txt

Version:

24.1.1

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

Singularity

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

PASTE VALIDATOR OUTPUT HERE

Relevant log outputs (up to 20 lines):

N/A (fmriprep finished without errors)

Screenshots / relevant information:

Hi @wwgraves,

In the future please use the software support post category which gives you a template to better organize your post. You can see I edited your post for you this time.

Your first positional argument should be your BIDS root directory that contains the subject folders with raw data (not the subject folder itself). Your second positional argument should contain where you want the outputs. Commonly this is derivatives/fmriprep relative to your BIDS root directory. The working directory is a named argument (-w) and should be a folder outside your BIDS directory.

Best,
Steven

Ah, thanks for all that, Steven. Now fMRIPrep has run to completion and is producing (almost) all the output I expected. I say almost because I didn’t realize until seeing the output and doing a little searching that fMRIPrep has “excised” its susceptibility distortion correction functionality to no longer include in its pipeline. It’s too bad, because that was the main reason I was motivated to use fMRIPrep. Guess I’ll look into using SDCFlows for EPI distortion correction now that I’ve come this far.

Thanks again,
Will

Hi @wwgraves,

fMRIPrep still does SDC via SDCFlows. How are you associating your fmaps to the BOLD? IntendedFor or B0FieldSoruce/B0FieldIdentifier method?

Best,
Steven

Good to know that fMRIPrep still does SDC. I guess I misunderstood what the fMRIPrep folks wrote here:
https://fmriprep.org/en/stable/workflows.html#susceptibility-distortion-correction-sdc

I’m using the IntendedFor method to associate the field map with the BOLD time series. At first I tried placing “IntendedFor” right after the “modalityLabel” field, which did not work (although it seemingly ran without error). Then most recently I tried specifying it in the config file this way:

    {
      "id": "id_task-rest",
      "datatype": "func",
      "suffix": "bold",
      "custom_entities": "task-rest",
      "criteria": {
        "SeriesDescription": "MB_fMRI_resting_state"
      },
      "sidecar_changes": {
        "TaskName": "rest"
      }
    },
    {
      "datatype": "fmap",
      "suffix": "magnitude1",
      "EchoTime": 0.00519,
      "B0FieldIdentifier": "GF_Map",
      "criteria": {
        "EchoNumber": "1",
        "SeriesNumber": "5"
      },
      "sidecar_changes": {
        "IntendedFor": "id_task-rest"
      }
    },

But that produced the same result – no error, but also no SDC.

Next I’m going to try specifying IntendedFor by series number. Would you suggest using the B0FieldSource/B0FieldIdentifier method instead? I’ve never tried that. I would certainly welcome any advice!

Best,
Will

Hi @wwgraves,

I don’t think that will do anything.

Can you share example of an fmap json? Did you use a dcm2bids version > 3.0? I am going to guess that the IntendedFor in the jsons is the full BIDS URI (that is "IntendedFor": "bids:sub-X/ses-Y/func/sub-X_ses-Y_task-rest_bold.nii.gz") where as fMRIPrep may only work with IntendedFor that is specified relative to the subject folder (that is, "IntendedFor":"ses-Y/func/sub-X_ses-Y_task-rest_bold.nii.gz").

Specifying both that and IntendedFor is fine to do, but know that fmriprep will prioritize the B0 field metadata over IntendedFor. I personally prefer the B0 fields because it obviates any ambiguity between the full BIDS URI vs relative paths for IntendedFor.

Best,
Steven

Yes, I used the most recent dcm2bids I could find. Typing dcm2bids --version gives:
dcm2bids version: 3.2.0
Based on BIDS version: v1.9.0

But you must be right that I’ve got something wrong, because fMRIPrep doesn’t actually output a fmap directory. The directory that dcm2bids creates has 3 files: 2 magnitude images and a phasediff image. Here’s the json for the first magnitude image:

{
    "Modality": "MR",
    "MagneticFieldStrength": 3,
    "ImagingFrequency": 123.251257,
    "Manufacturer": "Siemens",
    "ManufacturersModelName": "Prisma",
    "InstitutionName": "RUBIC",
    "InstitutionalDepartmentName": "Department",
    "InstitutionAddress": "University Ave. 197,Newark,NJ,US,07102",
    "DeviceSerialNumber": "166188",
    "StationName": "AWP166188",
    "BodyPart": "BRAIN",
    "PatientPosition": "HFS",
    "ProcedureStepDescription": "Gluck^Miray",
    "SoftwareVersions": "syngo MR E11",
    "MRAcquisitionType": "2D",
    "StudyDescription": "Gluck^Miray",
    "SeriesDescription": "GF_Map",
    "ProtocolName": "GF_Map",
    "ScanningSequence": "GR",
    "SequenceVariant": "SP",
    "SequenceName": "*fm2d2r",
    "ImageType": [
        "ORIGINAL",
        "PRIMARY",
        "M",
        "ND",
        "MAGNITUDE"
    ],
    "NonlinearGradientCorrection": false,
    "SeriesNumber": 5,
    "AcquisitionTime": "14:03:12.940000",
    "AcquisitionNumber": 1,
    "SliceThickness": 3,
    "SpacingBetweenSlices": 3,
    "SAR": 0.103875,
    "TablePosition": [
        0,
        0,
        0
    ],
    "EchoNumber": 1,
    "EchoTime": 0.00519,
    "RepetitionTime": 0.588,
    "FlipAngle": 60,
    "PartialFourier": 1,
    "BaseResolution": 64,
    "ShimSetting": [
        6205,
        -7027,
        9103,
        182,
        41,
        -250,
        254,
        58
    ],
    "TxRefAmp": 249.802,
    "PhaseResolution": 1,
    "ReceiveCoilName": "HeadNeck_64",
    "ReceiveCoilActiveElements": "HC1-7;NC1",
    "PulseSequenceDetails": "%SiemensSeq%\\gre_field_mapping",
    "CoilCombinationMethod": "Sum of Squares",
    "ConsistencyInfo": "N4_VE11E_LATEST_20181129",
    "MatrixCoilMode": "SENSE",
    "PercentPhaseFOV": 100,
    "PercentSampling": 100,
    "PhaseEncodingSteps": 64,
    "AcquisitionMatrixPE": 64,
    "ReconMatrixPE": 64,
    "PixelBandwidth": 260,
    "DwellTime": 3e-05,
    "PhaseEncodingDirection": "j-",
    "SliceTiming": [
        0,
        0.29688,
        0.01562,
        0.3125,
        0.03125,
        0.32812,
        0.03125,
        0.32812,
        0.04688,
        0.34375,
        0.0625,
        0.35938,
        0.0625,
        0.375,
        0.07812,
        0.375,
        0.09375,
        0.39062,
        0.10938,
        0.40625,
        0.10938,
        0.40625,
        0.125,
        0.42188,
        0.14062,
        0.4375,
        0.14062,
        0.45312,
        0.15625,
        0.45312,
        0.17188,
        0.46875,
        0.1875,
        0.48438,
        0.1875,
        0.48438,
        0.20312,
        0.5,
        0.21875,
        0.51562,
        0.21875,
        0.53125,
        0.23438,
        0.53125,
        0.25,
        0.54688,
        0.25,
        0.5625,
        0.26562,
        0.5625,
        0.28125,
        0.57812,
        0.29688
    ],
    "ImageOrientationPatientDICOM": [
        0.999556,
        -0.0242543,
        -0.017288,
        0.0237304,
        0.999271,
        -0.0298921
    ],
    "ImageOrientationText": "Tra>Cor(-1.7)>Sag(-1.0)",
    "InPlanePhaseEncodingDirectionDICOM": "COL",
    "BidsGuess": [
        "fmap",
        "_acq-fm2_magnitude1"
    ],
    "ConversionSoftware": "dcm2niix",
    "ConversionSoftwareVersion": "v1.0.20241211",
    "Dcm2bidsVersion": "3.2.0"
}

and the phasediff image:

{
    "Modality": "MR",
    "MagneticFieldStrength": 3,
    "ImagingFrequency": 123.251257,
    "Manufacturer": "Siemens",
    "ManufacturersModelName": "Prisma",
    "InstitutionName": "RUBIC",
    "InstitutionalDepartmentName": "Department",
    "InstitutionAddress": "University Ave. 197,Newark,NJ,US,07102",
    "DeviceSerialNumber": "166188",
    "StationName": "AWP166188",
    "BodyPart": "BRAIN",
    "PatientPosition": "HFS",
    "ProcedureStepDescription": "Gluck^Miray",
    "SoftwareVersions": "syngo MR E11",
    "MRAcquisitionType": "2D",
    "StudyDescription": "Gluck^Miray",
    "SeriesDescription": "GF_Map",
    "ProtocolName": "GF_Map",
    "ScanningSequence": "GR",
    "SequenceVariant": "SP",
    "SequenceName": "*fm2d2r",
    "ImageType": [
        "ORIGINAL",
        "PRIMARY",
        "P",
        "ND",
        "PHASE"
    ],
    "NonlinearGradientCorrection": false,
    "SeriesNumber": 6,
    "AcquisitionTime": "14:03:13.530000",
    "AcquisitionNumber": 1,
    "SliceThickness": 3,
    "SpacingBetweenSlices": 3,
    "SAR": 0.103875,
    "TablePosition": [
        0,
        0,
        0
    ],
    "EchoNumber": 2,
    "EchoTime": 0.00765,
    "RepetitionTime": 0.588,
    "FlipAngle": 60,
    "EchoTime1": 0.00519,
    "EchoTime2": 0.00765,
    "PartialFourier": 1,
    "BaseResolution": 64,
    "ShimSetting": [
        6205,
        -7027,
        9103,
        182,
        41,
        -250,
        254,
        58
    ],
    "TxRefAmp": 249.802,
    "PhaseResolution": 1,
    "ReceiveCoilName": "HeadNeck_64",
    "ReceiveCoilActiveElements": "HC1-7;NC1",
    "PulseSequenceDetails": "%SiemensSeq%\\gre_field_mapping",
    "CoilCombinationMethod": "Sum of Squares",
    "ConsistencyInfo": "N4_VE11E_LATEST_20181129",
    "MatrixCoilMode": "SENSE",
    "PercentPhaseFOV": 100,
    "PercentSampling": 100,
    "PhaseEncodingSteps": 64,
    "AcquisitionMatrixPE": 64,
    "ReconMatrixPE": 64,
    "PixelBandwidth": 260,
    "DwellTime": 3e-05,
    "PhaseEncodingDirection": "j-",
    "SliceTiming": [
        0,
        0.29688,
        0.01562,
        0.3125,
        0.01562,
        0.32812,
        0.03125,
        0.32812,
        0.04688,
        0.34375,
        0.04688,
        0.35938,
        0.0625,
        0.35938,
        0.07812,
        0.375,
        0.09375,
        0.39062,
        0.09375,
        0.40625,
        0.10938,
        0.40625,
        0.125,
        0.42188,
        0.125,
        0.4375,
        0.14062,
        0.4375,
        0.15625,
        0.45312,
        0.17188,
        0.46875,
        0.17188,
        0.46875,
        0.1875,
        0.48438,
        0.20312,
        0.5,
        0.21875,
        0.51562,
        0.21875,
        0.51562,
        0.23438,
        0.53125,
        0.25,
        0.54688,
        0.25,
        0.54688,
        0.26562,
        0.5625,
        0.28125,
        0.57812,
        0.28125
    ],
    "ImageOrientationPatientDICOM": [
        0.999556,
        -0.0242543,
        -0.017288,
        0.0237304,
        0.999271,
        -0.0298921
    ],
    "ImageOrientationText": "Tra>Cor(-1.7)>Sag(-1.0)",
    "InPlanePhaseEncodingDirectionDICOM": "COL",
    "BidsGuess": [
        "fmap",
        "_acq-fm2_phasediff"
    ],
    "ConversionSoftware": "dcm2niix",
    "ConversionSoftwareVersion": "v1.0.20241211",
    "Dcm2bidsVersion": "3.2.0"
}

And just to err on the side of TMI, I’m attaching my dcm2bids_config.json file as well:

{
  "descriptions": [
    {
      "datatype": "anat",
      "suffix": "T1w",
      "criteria": {
        "SeriesDescription": "MPRage"
      }
    },
    {
      "datatype": "anat",
      "suffix": "FLAIR",
      "criteria": {
        "SeriesDescription": "Sagittal 3D FLAIR",
        "EchoTime": 0.393
      },
      "sidecar_changes": {
        "ProtocolName": "FLAIR"
      }
    },
    {
      "datatype": "anat",
      "suffix": "T2w",
      "criteria": {
        "SeriesDescription": "Sag_T2w_SPC",
        "EchoTime": 0.564
      },
      "sidecar_changes": {
        "ProtocolName": "T2"
      }
    },
    {
      "datatype": "func",
      "suffix": "bold",
      "custom_entities": "task-rest",
      "criteria": {
        "SeriesDescription": "MB_fMRI_resting_state"
      },
      "sidecar_changes": {
        "TaskName": "rest"
      }
    },
    {
      "datatype": "fmap",
      "suffix": "magnitude1",
      "intendedFor": [
        9
    	],
      "EchoTime": 0.00519,
      "B0FieldIdentifier": "GF_Map",
      "criteria": {
        "EchoNumber": "1",
        "SeriesNumber": "5"
      }
    },
    {
      "datatype": "fmap",
      "suffix": "magnitude2",
      "intendedFor": [
        9
    	],
      "EchoTime": 0.00765,
      "B0FieldIdentifier": "GF_Map",
      "criteria": {
        "EchoNumber": "2",
        "SeriesNumber": "5"
      }
    },
    {
      "datatype": "fmap",
      "suffix": "phasediff",
      "intendedFor": [
        9
    	],
      "EchoTime1": 0.00519,
      "EchoTime2": 0.00765,
      "B0FieldIdentifier": "GF_Map",
      "criteria": {
        "SeriesNumber": "6"
      }
    }
  ]
}

Turns out I do use B0FieldIdnetifier, but not B0FieldSource.

Best,
Will

Hi @wwgraves,

Only the phasediff json needs to have the additional metadata (but doesn’t hurt putting it in the magnitude images too).

Your config file is set up incorrectly. See here for how to set up the config: Create a config file - dcm2bids documentation

Your BOLD does not have an ID to use for IntendedFor. You put your "B0FieldIdentifier" outside of sidecar_changes. You put your IntendedFor outside of sidecar_changes, missed the capital “I” in “Intended”, and used the series number instead of the ID in the IntendedFor. Additionally, I do not recommend using series number as a criteria, as sometimes scans need to be repeated, skipped, or done in a different order.

Best,
Steven

Hi @wwgraves,

Perhaps something like this is what you were going for? You can see I removed the SeriesNumber as criteria so you can add something that is more stable as criteria.

{
    "descriptions": [
        {
            "datatype": "anat",
            "suffix": "T1w",
            "criteria": {
                "SeriesDescription": "MPRage"
            }
        },
        {
            "datatype": "anat",
            "suffix": "FLAIR",
            "criteria": {
                "SeriesDescription": "Sagittal 3D FLAIR",
                "EchoTime": 0.393
            }
        },
        {
            "datatype": "anat",
            "suffix": "T2w",
            "criteria": {
                "SeriesDescription": "Sag_T2w_SPC",
                "EchoTime": 0.564
            }
        },
        {
            "id": "bold_rest",
            "datatype": "func",
            "suffix": "bold",
            "custom_entities": "task-rest",
            "criteria": {
                "SeriesDescription": "MB_fMRI_resting_state"
            },
            "sidecar_changes": {
                "TaskName": "rest",
                "B0FieldSource": "bold_fmap"
            }
        },
        {
            "datatype": "fmap",
            "suffix": "magnitude1",
            "criteria": {
                "EchoNumber": "1"
            },
            "sidecar_changes": {
                "B0FieldIdentifier": "bold_fmap",
                "IntendedFor": "bold_rest"
            }
        },
        {
            "datatype": "fmap",
            "suffix": "magnitude2",
            "criteria": {
                "EchoNumber": "2"
            },
            "sidecar_changes": {
                "B0FieldIdentifier": "bold_fmap",
                "IntendedFor": "bold_rest"
            }
        },
        {
            "datatype": "fmap",
            "suffix": "phasediff",
            "criteria": {},
            "sidecar_changes": {
                "B0FieldIdentifier": "bold_fmap",
                "IntendedFor": "bold_rest"
            }
        }
    ]
}

Keep in mind that this will, as I previously mentioned, output the full BIDS URI IntendedFor, not the relative path version, but the B0 fields will take precedence over them.

Best,
Steven

@Steven, you’re a top-level wizard. SDC is working now! I had been consulting, and thought I was following, the website you referenced on creating a config file. But the edited version of my config file that you kindly provided really helped tremendously. Thanks again!

Best,
Will

1 Like

Hi @wwgraves,

Great, glad to hear it!

Best,
Steven