fMRIPrep not running SDC, not recognizing my phase encoding direction

Summary of what happened:

Hello!

I have been trying to run fmriprep on some bids-validated data of mine, but I keep getting the * Phase-encoding (PE) direction: Could not be determined - assuming Anterior-Posterior and also

  • Susceptibility distortion correction: None

my intended for fields seem ok, my PE fields seem o.k., i am not sure why it does not perform SDC nor recovers the PE direction. Data is bids compliant (beside my events for now, but should it should not impact fmriprep right?)

any idea on why PE is not recognized and SDC performed?

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

    # Run fMRIPrep
    fmriprep-docker "${input_dir}" "${output_dir}" participant \
    --skip-bids-validation \
    --participant-label "${subj}" \
    --fs-license-file "${license_dir}/license.txt" \
    --longitudinal \
    --user "${user_id}:${group_id}" \
    --work-dir "${work_dir}" \
    -v -v

Version:

fMRIPrep* 25.0.0

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

Docker

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

bids-validator@1.15.0

(node:236440) Warning: Closing directory handle on garbage collection
(Use `node --trace-warnings ...` to show where the warning was created)
	1: [ERR] A stimulus file was declared but not found in the dataset. (code: 52 - STIMULUS_FILE_MISSING)


1: [WARN] Not all subjects/sessions/runs have the same scanning parameters. (code: 39 - INCONSISTENT_PARAMETERS)
		./sub-RGC901/ses-1/func/sub-RGC901_ses-1_task-BDM_run-1_bold.nii.gz
		./sub-RGC901/ses-1/func/sub-RGC901_ses-1_task-BDM_run-3_bold.nii.gz
		./sub-RGC901/ses-x/func/sub-RGC901_ses-x_task-BDM_run-2_bold.nii.gz
		./sub-RGC901/ses-x/func/sub-RGC901_ses-x_task-BDM_run-3_bold.nii.gz
		./sub-RGC902/ses-1/func/sub-RGC902_ses-1_task-BDM_run-1_bold.nii.gz
		./sub-RGC902/ses-1/func/sub-RGC902_ses-1_task-BDM_run-2_bold.nii.gz
		./sub-RGC902/ses-1/func/sub-RGC902_ses-1_task-BDM_run-3_bold.nii.gz
		./sub-RGC902/ses-x/func/sub-RGC902_ses-x_task-BDM_run-1_bold.nii.gz
		./sub-RGC902/ses-x/func/sub-RGC902_ses-x_task-BDM_run-2_bold.nii.gz
		./sub-RGC902/ses-x/func/sub-RGC902_ses-x_task-BDM_run-3_bold.nii.gz
		... and 96 more files having this issue (Use --verbose to see them all).

2: [WARN] Tabular file contains custom columns not described in a data dictionary (code: 82 - CUSTOM_COLUMN_WITHOUT_DESCRIPTION)
		./sub-RGC901/ses-1/func/sub-RGC901_ses-1_task-BDM_run-1_events.tsv


	3: [WARN] The onset of the last event is after the total duration of the corresponding scan. This design is suspiciously long.  (code: 85 - SUSPICIOUSLY_LONG_EVENT_DESIGN)
		./sub-RGC901/ses-x/func/sub-RGC901_ses-x_task-BDM_run-2_events.tsv
		./sub-RGC906/ses-1/func/sub-RGC906_ses-1_task-BDM_run-1_events.tsv
		./sub-RGC906/ses-1/func/sub-RGC906_ses-1_task-BDM_run-3_events.tsv
		./sub-RGC906/ses-x/func/sub-RGC906_ses-x_task-BDM_run-1_events.tsv
		./sub-RGC906/ses-x/func/sub-RGC906_ses-x_task-BDM_run-3_events.tsv
		./sub-RGC910/ses-1/func/sub-RGC910_ses-1_task-BDM_run-2_events.tsv
		./sub-RGC910/ses-x/func/sub-RGC910_ses-x_task-BDM_run-3_events.tsv
		./sub-RGC914/ses-x/func/sub-RGC914_ses-x_task-BDM_run-2_events.tsv
		./sub-RGC917/ses-1/func/sub-RGC917_ses-1_task-BDM_run-3_events.tsv
		./sub-RGC924/ses-x/func/sub-RGC924_ses-x_task-BDM_run-1_events.tsv

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

	4: [WARN] The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification. (code: 101 - README_FILE_MISSING)

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

	5: [WARN] The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered because there are no authors, which will make DOI registration from dataset metadata impossible. (code: 113 - NO_AUTHORS)

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

        Summary:                 Available Tasks:        Available Modalities: 
        761 Files, 5.44GB        BDM                     MRI                   
        20 - Subjects                                                          
        2 - Sessions    

Relevant log outputs (up to 20 lines) (from the html fmriprep report)



    Summary
    Anatomical
    B0 field mapping
    Functional
    About

Summary

    Subject ID: RGC901
    Structural images: 2 T1-weighted
    Functional series: 6
        Task: BDM (6 runs)
    Standard output spaces: MNI152NLin2009cAsym
    Non-standard output spaces:
    FreeSurfer reconstruction: Pre-existing directory

Anatomical
Anatomical Conformation

    Input T1w images: 2
    Output orientation: RAS
    Output dimensions: 176x240x240
    Output voxel size: 1mm x 1mm x 1mm
    Discarded images: 0

B0 field mapping
Reports for: session 1, run 1, fmapid auto00000.
Preprocessed B0 mapping acquisition

Reports for: session 1, run 2, fmapid auto00001.
Preprocessed B0 mapping acquisition

Reports for: session x, run 1, fmapid auto00002.
Preprocessed B0 mapping acquisition

Reports for: session x, run 2, fmapid auto00003.
Preprocessed B0 mapping acquisition

Functional
Reports for: session 1, task BDM, run 1.
Summary

    Original orientation: LAS
    Repetition time (TR): 2.75s
    Phase-encoding (PE) direction: Could not be determined - assuming Anterior-Posterior
    Single-echo EPI sequence.
    Slice timing correction: Applied
    Susceptibility distortion correction: None
    Registration: FreeSurfer bbregister (boundary-based registration, BBR) - 6 dof
    Non-steady-state volumes: 0

Note on orientation: qform matrix overwritten

The qform has been copied from sform. The difference in angle is -1.2e-05 radians. The difference in translation is 1e-14mm.
Alignment of functional and anatomical MRI data (coregistration)

Note on orientation: qform matrix overwritten

The qform has been copied from sform. The difference in angle is 5.5e-06 radians. The difference in translation is 7.9e-15mm.

Alignment of functional and anatomical MRI data (coregistration)

Preprocessing of B0 inhomogeneity mappings

    A total of 4 fieldmaps were found available within the input BIDS structure for this particular subject. A B0 nonuniformity map (or fieldmap) was directly measured with an MRI scheme designed with that purpose such as SEI (Spiral-Echo Imaging).

Screenshots / relevant information:

example fmap json

{
  "Modality": "MR",
  "MagneticFieldStrength": 3,
  "ImagingFrequency": 127.768,
  "Manufacturer": "Philips",
  "StationName": "PHILIPS-BQ9N6TK",
  "BodyPartExamined": "BRAIN",
  "PatientPosition": "HFS",
  "SoftwareVersions": "5.3.1\\5.3.1.1",
  "MRAcquisitionType": "2D",
  "SeriesDescription": "B0 map (immediate)",
  "ProtocolName": "WIP B0 map (immediate)",
  "ScanningSequence": "RM",
  "SequenceVariant": "SS",
  "ScanOptions": "OTHER",
  "PulseSequenceName": "FFE",
  "ImageType": [
    "ORIGINAL",
    "PRIMARY",
    "T1",
    "MIXED",
    "REAL",
    "FIELDMAPHZ"
  ],
  "SeriesNumber": 301,
  "AcquisitionTime": "09:52:22.070000",
  "AcquisitionNumber": 3,
  "PhilipsRWVSlope": 0.0815629,
  "PhilipsRWVIntercept": -167,
  "PhilipsRescaleSlope": 0.0815629,
  "PhilipsRescaleIntercept": -167,
  "PhilipsScaleSlope": 12.285,
  "UsePhilipsFloatNotDisplayScaling": 1,
  "Units": "Hz",
  "SliceThickness": 3,
  "SpacingBetweenSlices": 3,
  "EchoNumber": 2,
  "RepetitionTime": 0.649998,
  "MTState": false,
  "FlipAngle": 80,
  "CoilString": "MULTI COIL",
  "PercentPhaseFOV": 100,
  "PercentSampling": 100,
  "PhaseEncodingSteps": 80,
  "AcquisitionMatrixPE": 80,
  "ReconMatrixPE": 80,
  "WaterFatShift": 0.998103,
  "EstimatedEffectiveEchoSpacing": 0.0000145418,
  "EstimatedTotalReadoutTime": 0.0011488,
  "AcquisitionDuration": 105.3,
  "PixelBandwidth": 435.237,
  "PhaseEncodingAxis": "j",
  "ImageOrientationPatientDICOM": [
    0.999515,
    -0.0205438,
    0.0234043,
    0.0301223,
    0.828502,
    -0.559176
  ],
  "InPlanePhaseEncodingDirectionDICOM": "COL",
  "ConversionSoftware": "dcm2niix",
  "ConversionSoftwareVersion": "v1.0.20220720",
  "IntendedFor": [
    "ses-1/func/sub-RGC901_ses-1_task-BDM_run-1_bold.nii.gz"
  ],
  "PhaseEncodingDirection": "j"
}

example of a func json file

{
  "Modality": "MR",
  "MagneticFieldStrength": 3,
  "ImagingFrequency": 127.768,
  "Manufacturer": "Philips",
  "ManufacturersModelName": "Ingenia",
  "BodyPartExamined": "BRAIN",
  "PatientPosition": "HFS",
  "SoftwareVersions": "5.3.1\\5.3.1.1",
  "MRAcquisitionType": "2D",
  "SeriesDescription": "fMRI_3mm_FOOD1",
  "ProtocolName": "WIP fMRI_3mm_FOOD1",
  "ScanningSequence": "GR",
  "SequenceVariant": "SK",
  "ScanOptions": "FS",
  "PulseSequenceName": "FEEPI",
  "ImageType": [
    "ORIGINAL",
    "PRIMARY",
    "T2",
    "NONE"
  ],
  "SeriesNumber": 601,
  "AcquisitionTime": "10:06:18.790000",
  "AcquisitionNumber": 6,
  "PhilipsRescaleSlope": 0.806593,
  "PhilipsRescaleIntercept": 0,
  "PhilipsScaleSlope": 0.0267301,
  "UsePhilipsFloatNotDisplayScaling": 1,
  "SliceThickness": 3,
  "SpacingBetweenSlices": 3,
  "EchoTime": 0.03,
  "RepetitionTime": 2.75,
  "MTState": false,
  "FlipAngle": 80,
  "CoilString": "MULTI COIL",
  "PercentPhaseFOV": 100,
  "PercentSampling": 100,
  "EchoTrainLength": 39,
  "PhaseEncodingSteps": 80,
  "AcquisitionMatrixPE": 80,
  "ReconMatrixPE": 80,
  "ParallelReductionFactorInPlane": 2.1,
  "ParallelAcquisitionTechnique": "SENSE",
  "WaterFatShift": 10.5683,
  "EstimatedEffectiveEchoSpacing": 0.000300251,
  "EstimatedTotalReadoutTime": 0.0237198,
  "AcquisitionDuration": 626.962,
  "PixelBandwidth": 2104.91,
  "PhaseEncodingAxis": "j",
  "ImageOrientationPatientDICOM": [
    0.999515,
    -0.0205438,
    0.0234043,
    0.0301223,
    0.828502,
    -0.559176
  ],
  "InPlanePhaseEncodingDirectionDICOM": "COL",
  "ConversionSoftware": "dcm2niix",
  "ConversionSoftwareVersion": "v1.0.20220720",
  "TaskName": "BDM",
  "SliceTiming": [
    0E-8,
    0.05978260,
    0.11956520,
    0.17934780,
    0.23913040,
    0.29891300,
    0.35869560,
    0.41847820,
    0.47826080,
    0.53804340,
    0.59782600,
    0.65760860,
    0.71739120,
    0.77717380,
    0.83695640,
    0.89673900,
    0.95652160,
    1.01630420,
    1.07608680,
    1.13586940,
    1.19565200,
    1.25543460,
    1.31521720,
    1.37499980,
    1.43478240,
    1.49456500,
    1.55434760,
    1.61413020,
    1.67391280,
    1.73369540,
    1.79347800,
    1.85326060,
    1.91304320,
    1.97282580,
    2.03260840,
    2.09239100,
    2.15217360,
    2.21195620,
    2.27173880,
    2.33152140,
    2.39130400,
    2.45108660,
    2.51086920,
    2.57065180,
    2.63043440
  ],
  "PhaseEncodingDirection": "j"
}

fslhd output for func file

sizeof_hdr	348
data_type	INT16
dim0		4
dim1		80
dim2		80
dim3		45
dim4		173
dim5		1
dim6		1
dim7		1
vox_units	mm
time_units	s
datatype	4
nbyper		2
bitpix		16
pixdim0		-1.000000
pixdim1		3.000000
pixdim2		3.000000
pixdim3		3.000000
pixdim4		2.749998
pixdim5		0.000000
pixdim6		0.000000
pixdim7		0.000000
vox_offset	352
cal_max		0.000000
cal_min		0.000000
scl_slope	37.411068
scl_inter	0.000000
phase_dim	2
freq_dim	1
slice_dim	3
slice_name	Unknown
slice_code	0
slice_start	0
slice_end	0
slice_duration	0.000000
toffset		0.000000
intent		Unknown
intent_code	0
intent_name	
intent_p1	0.000000
intent_p2	0.000000
intent_p3	0.000000
qform_name	Scanner Anat
qform_code	1
qto_xyz:1	-2.998544 0.090374 0.023731 120.402924 
qto_xyz:2	0.061625 2.485505 -1.678828 -91.328682 
qto_xyz:3	0.070236 1.677527 2.486156 -109.903519 
qto_xyz:4	0.000000 0.000000 0.000000 1.000000 
qform_xorient	Right-to-Left
qform_yorient	Posterior-to-Anterior
qform_zorient	Inferior-to-Superior
sform_name	Scanner Anat
sform_code	1
sto_xyz:1	-2.998545 0.090367 0.023709 120.402924 
sto_xyz:2	0.061631 2.485506 -1.678828 -91.328682 
sto_xyz:3	0.070213 1.677527 2.486156 -109.903519 
sto_xyz:4	0.000000 0.000000 0.000000 1.000000 
sform_xorient	Right-to-Left
sform_yorient	Posterior-to-Anterior
sform_zorient	Inferior-to-Superior
file_type	NIFTI-1+
file_code	1
descrip		TE=30;Time=100618.790
aux_file

Hi @pganon32,

You need both an AP and PA field map, unless that’s a phasediff fmap.

Best,
Steven

Thanks Steven,

I am not quite sure but I know this is my case scenario:

Case 3: Direct field mapping

In some cases (for example GE), the scanner software will directly reconstruct a B0 field map along with a magnitude image used for anatomical reference.

I only get 2 volumes per B0 acquisition sequence (one fieldmap and one magnitude).

Does this clarify my situation?

Hi @pganon32,

Can you provide the tree output of an example bids subject?

Best,
Steven

sub-RGC901
β”œβ”€β”€ ses-1
β”‚   β”œβ”€β”€ anat
β”‚   β”‚   β”œβ”€β”€ sub-RGC901_ses-1_T1w.json
β”‚   β”‚   └── sub-RGC901_ses-1_T1w.nii.gz
β”‚   β”œβ”€β”€ fmap
β”‚   β”‚   β”œβ”€β”€ sub-RGC901_ses-1_run-1_fieldmap.json
β”‚   β”‚   β”œβ”€β”€ sub-RGC901_ses-1_run-1_fieldmap.nii.gz
β”‚   β”‚   β”œβ”€β”€ sub-RGC901_ses-1_run-1_magnitude.json
β”‚   β”‚   β”œβ”€β”€ sub-RGC901_ses-1_run-1_magnitude.nii.gz
β”‚   β”‚   β”œβ”€β”€ sub-RGC901_ses-1_run-2_fieldmap.json
β”‚   β”‚   β”œβ”€β”€ sub-RGC901_ses-1_run-2_fieldmap.nii.gz
β”‚   β”‚   β”œβ”€β”€ sub-RGC901_ses-1_run-2_magnitude.json
β”‚   β”‚   └── sub-RGC901_ses-1_run-2_magnitude.nii.gz
β”‚   └── func
β”‚       β”œβ”€β”€ sub-RGC901_ses-1_task-BDM_run-1_bold.json
β”‚       β”œβ”€β”€ sub-RGC901_ses-1_task-BDM_run-1_bold.nii.gz
β”‚       β”œβ”€β”€ sub-RGC901_ses-1_task-BDM_run-1_events.tsv
β”‚       β”œβ”€β”€ sub-RGC901_ses-1_task-BDM_run-2_bold.json
β”‚       β”œβ”€β”€ sub-RGC901_ses-1_task-BDM_run-2_bold.nii.gz
β”‚       β”œβ”€β”€ sub-RGC901_ses-1_task-BDM_run-2_events.tsv
β”‚       β”œβ”€β”€ sub-RGC901_ses-1_task-BDM_run-3_bold.json
β”‚       β”œβ”€β”€ sub-RGC901_ses-1_task-BDM_run-3_bold.nii.gz
β”‚       └── sub-RGC901_ses-1_task-BDM_run-3_events.tsv
└── ses-x
    β”œβ”€β”€ anat
    β”‚   β”œβ”€β”€ sub-RGC901_ses-x_T1w.json
    β”‚   └── sub-RGC901_ses-x_T1w.nii.gz
    β”œβ”€β”€ fmap
    β”‚   β”œβ”€β”€ sub-RGC901_ses-x_run-1_fieldmap.json
    β”‚   β”œβ”€β”€ sub-RGC901_ses-x_run-1_fieldmap.nii.gz
    β”‚   β”œβ”€β”€ sub-RGC901_ses-x_run-1_magnitude.json
    β”‚   β”œβ”€β”€ sub-RGC901_ses-x_run-1_magnitude.nii.gz
    β”‚   β”œβ”€β”€ sub-RGC901_ses-x_run-2_fieldmap.json
    β”‚   β”œβ”€β”€ sub-RGC901_ses-x_run-2_fieldmap.nii.gz
    β”‚   β”œβ”€β”€ sub-RGC901_ses-x_run-2_magnitude.json
    β”‚   └── sub-RGC901_ses-x_run-2_magnitude.nii.gz
    └── func
        β”œβ”€β”€ sub-RGC901_ses-x_task-BDM_run-1_bold.json
        β”œβ”€β”€ sub-RGC901_ses-x_task-BDM_run-1_bold.nii.gz
        β”œβ”€β”€ sub-RGC901_ses-x_task-BDM_run-1_events.tsv
        β”œβ”€β”€ sub-RGC901_ses-x_task-BDM_run-2_bold.json
        β”œβ”€β”€ sub-RGC901_ses-x_task-BDM_run-2_bold.nii.gz
        β”œβ”€β”€ sub-RGC901_ses-x_task-BDM_run-2_events.tsv
        β”œβ”€β”€ sub-RGC901_ses-x_task-BDM_run-3_bold.json
        β”œβ”€β”€ sub-RGC901_ses-x_task-BDM_run-3_bold.nii.gz
        └── sub-RGC901_ses-x_task-BDM_run-3_events.tsv

is it just that my run-1 and run-2 in the fmap and magnitude are overwriting my intendedfor json field?

Hi @pganon32,

Sorry I am not sure what you mean by this.

Perhaps fmriprep only supports PEPOLAR and GRE fieldmaps?

Just in case can you try the B0FieldSource/Identifier method?

Best,
Steven

Yes I can try that.

regarding your question.

I was thinking that maybe in the BIDS convention, if a fmap has run-1 in its file name, fmriprep applies it to func run-1, withouth looking at the intendedfor field in the json file for the fmap.

in my case I have 2 fmaps, i named them with run-1 and run-2 just to indicate that there is a first one (intended for task-run-1) and a second one (intended for task run 2 and 3).

So maybe the mismatch of run 1 and 2 in the fmap folder, and run 1 , 2 and 3 in the func folder is causing the issue.

thanks a lot!

That does not happen.

Best,
Steven

1 Like