fMRIPrep field maps for multiecho resting: AP/PA runs used as epi fieldmaps

Summary of what happened:

We collect two multiecho resting state scans, the longer being the AP direction (~20 minutes) and the shorter in the PA (~10 minutes). Sifting through different conversations on here, I was able to test a few different ways of getting fmriprep to recognize the first echo of each as a field map. The way that finally worked was when I renamed the first echo of each run to sub-P###_ses-baseline_dir-AP_run-01_epi.nii.gz & sub-P###_ses-baseline_dir-PA_run-01_epi.nii.gz. I added an IntendedFor listing all fives echos + their sbref files in each direction to both of the jsons. I added a B0FieldIdentifier: sub-P### and a RawSources: to the fmap jsons + a B0FieldSource: sub-P### to each of the individual echo jsons.

Things seemed to run correctly because a fmap folder was produced, but the summary html lists: Susceptibility distortion correction: None

I was hoping someone could tell me why would fmap be produced but then ‘Susceptibility distortion correction: None’ would be in the html?

The output fmap folder contains:

sub-P###_ses-baseline_run-1_fmapid-auto00000_desc-coeff_fieldmap.nii.gz
sub-P###_ses-baseline_run-1_fmapid-auto00000_desc-preproc_fieldmap.json
sub-P###_ses-baseline_run-1_fmapid-auto00000_desc-epi_fieldmap.nii.gz
sub-P###_ses-baseline_run-1_fmapid-auto00000_desc-preproc_fieldmap.nii.gz

but in the output func folder there are no files related to auto00000.

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

singularity run --cleanenv \
  --no-home \
  -B ${jobTmpDir}:/tmp \
  -B "/home/julgrier/templateflow:/templateflow" \
  -B "/appl/freesurfer-7.1.1:/freesurfer" \
  -B ${inputdir}:/data/input \
  -B ${outputdir}:/data/output \
  -B /project/fmriprep/prerun_output/$1:/fssubdir \
/project/singularity_containers/fmriprep-23.2.3.simg \
/data/input /data/output participant \
--skull-strip-template OASIS30ANTs \
--fs-license-file /freesurfer/license.txt \
--fs-subjects-dir /fssubdir/sourcedata/freesurfer \
--output-spaces fsaverage T1w fsnative fsLR MNI152NLin6Asym:res-2 --cifti-output 91k \
--bold2t1w-dof 6 \
--dvars-spike-threshold 1.5 \
--fd-spike-threshold 0.5 \
--ignore slicetiming \
--me-output-echos \
--notrack \
--nthreads 16 --omp-nthreads 15 \
--work-dir ${SINGULARITYENV_TMPDIR} \
--skip_bids_validation \
--stop-on-first-crash \
--verbose \
--participant-label $1

Version:

fMRIPrep 23.2.3

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

Singularity

Relevant log outputs (up to 20 lines):

log:

fMRIPrep finished successfully!

html:

Susceptibility distortion correction: None

but then further down:

Alignment of functional and anatomical MRI data (coregistration)

This panel shows the alignment of the reference EPI (BOLD) image to the anatomical (T1-weighted) image. The reference EPI has been contrast enhanced and susceptibility-distortion corrected (if applicable) for improved anatomical fidelity. The anatomical image has been resampled into EPI space, as well as the anatomical white matter mask, which appears as a red contour.


Hi @julieg,

Please return the BIDS validation report, tree structure of an example subject raw data, and contents of the relevant JSON files. Additionally, if you see the SDCFlows initialization report towards the top of the fmriprep job log, please return that too.

Thanks,
Steven

Bids Validator:

The Intended for Error: these files do exist in func, see below in tree structure:

The Task Name Error: If you think this is the source of the error, I will try this, I did not realize this before running fmriprep

The third error is the dataset_description.json which I have on the cluster where I’m running the job I just didn’t download to upload to bids validator.

Tree Structure:

sub-P913/
└── sub-P913
    └── ses-baseline
        ├── anat
        │   ├── sub-P913_ses-baseline_T1w.json
        │   ├── sub-P913_ses-baseline_T1w.nii.gz
        │   ├── sub-P913_ses-baseline_T2w.json
        │   └── sub-P913_ses-baseline_T2w.nii.gz
        ├── fmap
        │   ├── sub-P913_ses-baseline_dir-AP_run-01_epi.json
        │   ├── sub-P913_ses-baseline_dir-AP_run-01_epi.nii.gz
        │   ├── sub-P913_ses-baseline_dir-PA_run-01_epi.json
        │   └── sub-P913_ses-baseline_dir-PA_run-01_epi.nii.gz
        └── func
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-1_bold.json
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-1_bold.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-1_sbref.json
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-1_sbref.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-2_bold.json
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-2_bold.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-2_sbref.json
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-2_sbref.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-3_bold.json
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-3_bold.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-3_sbref.json
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-3_sbref.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-4_bold.json
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-4_bold.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-4_sbref.json
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-4_sbref.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-5_bold.json
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-5_bold.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-5_sbref.json
            ├── sub-P913_ses-baseline_task-rest_dir-AP_echo-5_sbref.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-1_bold.json
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-1_bold.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-1_sbref.json
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-1_sbref.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-2_bold.json
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-2_bold.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-2_sbref.json
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-2_sbref.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-3_bold.json
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-3_bold.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-3_sbref.json
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-3_sbref.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-4_bold.json
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-4_bold.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-4_sbref.json
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-4_sbref.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-5_bold.json
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-5_bold.nii.gz
            ├── sub-P913_ses-baseline_task-rest_dir-PA_echo-5_sbref.json
            └── sub-P913_ses-baseline_task-rest_dir-PA_echo-5_sbref.nii.gz

Relevant json contents for one of the fmap jsons:

{
	"ConversionSoftware": "dcm2niix",
	"ConversionSoftwareVersion": "v1.0.20230411",
	"B0FieldIndentifier": "sub-P913",
	"IntendedFor": ["func/sub-P913_ses-baseline_task-rest_dir-AP_echo-1_bold.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-AP_echo-2_bold.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-AP_echo-3_bold.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-AP_echo-4_bold.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-AP_echo-5_bold.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-AP_echo-1_sbref.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-AP_echo-2_sbref.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-AP_echo-3_sbref.nii.gz","func/sub-P913_ses-baseline_task-rest_dir-AP_echo-4_sbref.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-AP_echo-5_sbref.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-PA_echo-1_bold.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-PA_echo-2_bold.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-PA_echo-3_bold.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-PA_echo-4_bold.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-PA_echo-5_bold.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-PA_echo-1_sbref.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-PA_echo-2_sbref.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-PA_echo-3_sbref.nii.gz","func/sub-P913_ses-baseline_task-rest_dir-PA_echo-4_sbref.nii.gz", "func/sub-P913_ses-baseline_task-rest_dir-PA_echo-5_sbref.nii.gz"],	
	"RawSources": ["/data/input/sub-P913/sub-P913/ses-baseline/fmap/sub-P913_ses-baseline_dir-AP_run-01_epi.nii.gz", "/data/input/sub-P913/sub-P913/ses-baseline/fmap/sub-P913_ses-baseline_dir-PA_run-01_epi.nii.gz"]
}

Relevant json content for one of the func jsons:

{
	"ConversionSoftware": "dcm2niix",
	"ConversionSoftwareVersion": "v1.0.20230411",
	"B0FieldSource": "sub-P913"
}

I don’t see an SDCFlows report.

Thanks,
Julie

Hi @julieg,

Your IntendedFor items do not have the ses-<> folder.

You should add the TaskName field to your func jsons, and the dataset_description.json file to your BIDS root directory.

Best,
Steven

Thanks for your help!

Ok I added both of those things:
in fmap jsons:

{
"B0FieldIndentifier": "sub-P913",
	"IntendedFor": ["ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-AP_echo-1_bold.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-AP_echo-2_bold.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-AP_echo-3_bold.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-AP_echo-4_bold.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-AP_echo-5_bold.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-AP_echo-1_sbref.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-AP_echo-2_sbref.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-AP_echo-3_sbref.nii.gz","ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-AP_echo-4_sbref.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-AP_echo-5_sbref.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-PA_echo-1_bold.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-PA_echo-2_bold.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-PA_echo-3_bold.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-PA_echo-4_bold.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-PA_echo-5_bold.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-PA_echo-1_sbref.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-PA_echo-2_sbref.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-PA_echo-3_sbref.nii.gz","ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-PA_echo-4_sbref.nii.gz", "ses-baseline/func/sub-P913_ses-baseline_task-rest_dir-PA_echo-5_sbref.nii.gz"],	
	"RawSources": ["/data/input/sub-P913/sub-P913/ses-baseline/fmap/sub-P913_ses-baseline_dir-AP_run-01_epi.nii.gz", "/data/input/sub-P913/sub-P913/ses-baseline/fmap/sub-P913_ses-baseline_dir-PA_run-01_epi.nii.gz"]
}

and in func jsons

{
	"B0FieldSource": "sub-P913",
	"TaskName": "rest"
}

and the dataset_description.json is there.

Should the sdc workflow already be apparent in the fmriprep job, it’s been running for about an hour now and there’s nothing related to SDC initialization.

Hi @julieg,

I’m surprised that you don’t see any SDCFlow initialization if the fmap files are created. Mind sharing the start of your log file, until it gets to the node-specific processes? When you rerun, remove --skip-bids-validation, use a new work directory, consider upgrading to 24.0.1, and please share the BIDS validation report included in the fmriprep log.

Best,
Steven

Sure here’s the beginning, including the bids validation report:


240724-15:03:28,494 cli INFO:
	 Making sure the input data is BIDS compliant (warnings can be ignored in most cases).
bids-validator@1.14.6
	1: [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.

	2: [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: 
        49 Files, 4.26GB        rest                    MRI                   
        1 - Subject                                                           
        1 - Session                                                           


	If you have any questions, please post on https://neurostars.org/tags/bids.
240724-15:03:42,240 nipype.workflow IMPORTANT:
	 Running fMRIPrep version 23.2.3

         License NOTICE ##################################################
         fMRIPrep 23.2.3
         Copyright 2023 The NiPreps Developers.
         
         This product includes software developed by
         the NiPreps Community (https://nipreps.org/).
         
         Portions of this software were developed at the Department of
         Psychology at Stanford University, Stanford, CA, US.
         
         This software is also distributed as a Docker container image.
         The bootstrapping file for the image ("Dockerfile") is licensed
         under the MIT License.
         
         This software may be distributed through an add-on package called
         "Docker Wrapper" that is under the BSD 3-clause License.
         #################################################################
240724-15:03:42,285 nipype.workflow IMPORTANT:
	 Building fMRIPrep's workflow:
           * BIDS dataset path: /data/input.
           * Participant list: ['P913'].
           * Run identifier: 20240724-150326_9944c146-945b-43b1-a4c9-1465f77fbc39.
           * Output spaces: fsaverage:den-164k T1w fsnative fsLR MNI152NLin6Asym:res-2.
           * Pre-run FreeSurfer's SUBJECTS_DIR: /fssubdir/sourcedata/freesurfer.
240724-15:03:43,231 nipype.workflow INFO:
	 ANAT Stage 1: Adding template workflow
240724-15:03:44,303 nipype.workflow INFO:
	 ANAT Stage 2: Preparing brain extraction workflow
240724-15:03:44,405 nipype.workflow INFO:
	 ANAT Stage 3: Preparing segmentation workflow
240724-15:03:44,410 nipype.workflow INFO:
	 ANAT Stage 4: Preparing normalization workflow for ['MNI152NLin6Asym', 'MNI152NLin2009cAsym']
240724-15:03:44,463 nipype.workflow INFO:
	 ANAT Stage 5: Preparing surface reconstruction workflow
240724-15:03:44,492 nipype.workflow INFO:
	 ANAT Stage 6: Preparing mask refinement workflow
240724-15:03:44,496 nipype.workflow INFO:
	 ANAT Stage 7: Creating T2w template
240724-15:03:44,502 nipype.workflow INFO:
	 ANAT Stage 8: Creating GIFTI surfaces for ['white', 'pial', 'midthickness', 'sphere_reg', 'sphere']
240724-15:03:44,525 nipype.workflow INFO:
	 ANAT Stage 8: Creating GIFTI metrics for ['thickness', 'sulc']
240724-15:03:44,534 nipype.workflow INFO:
	 ANAT Stage 8a: Creating cortical ribbon mask
240724-15:03:44,539 nipype.workflow INFO:
	 ANAT Stage 9: Creating fsLR registration sphere
240724-15:03:44,544 nipype.workflow INFO:
	 ANAT Stage 10: Creating MSM-Sulc registration sphere
240724-15:03:44,979 nipype.workflow INFO:
	 Using single-band reference file(s) sub-P913_ses-baseline_task-rest_dir-AP_echo-1_sbref.nii.gz,sub-P913_ses-baseline_task-rest_dir-AP_echo-2_sbref.nii.gz,sub-P913_ses-baseline_task-rest_dir-AP_echo-3_sbref.nii.gz,sub-P913_ses-baseline_task-rest_dir-AP_echo-4_sbref.nii.gz,sub-P913_ses-baseline_task-rest_dir-AP_echo-5_sbref.nii.gz.
240724-15:03:45,168 nipype.workflow INFO:
	 Stage 1: Adding HMC boldref workflow
240724-15:03:45,181 nipype.workflow INFO:
	 Stage 2: Adding motion correction workflow
240724-15:03:45,196 nipype.workflow INFO:
	 Stage 3: Adding coregistration boldref workflow
240724-15:03:45,907 nipype.workflow IMPORTANT:
	 Generating T2* map and optimally combined ME-EPI time series.
240724-15:03:46,421 nipype.workflow INFO:
	 Using single-band reference file(s) sub-P913_ses-baseline_task-rest_dir-PA_echo-1_sbref.nii.gz,sub-P913_ses-baseline_task-rest_dir-PA_echo-2_sbref.nii.gz,sub-P913_ses-baseline_task-rest_dir-PA_echo-3_sbref.nii.gz,sub-P913_ses-baseline_task-rest_dir-PA_echo-4_sbref.nii.gz,sub-P913_ses-baseline_task-rest_dir-PA_echo-5_sbref.nii.gz.
240724-15:03:46,484 nipype.workflow INFO:
	 Stage 1: Adding HMC boldref workflow
240724-15:03:46,490 nipype.workflow INFO:
	 Stage 2: Adding motion correction workflow
240724-15:03:46,495 nipype.workflow INFO:
	 Stage 3: Adding coregistration boldref workflow
240724-15:03:47,129 nipype.workflow IMPORTANT:
	 Generating T2* map and optimally combined ME-EPI time series.
240724-15:03:50,663 nipype.workflow INFO:
	 fMRIPrep workflow graph with 707 nodes built successfully.
240724-15:04:04,341 nipype.workflow IMPORTANT:
	 fMRIPrep started!
240724-15:04:04,933 nipype.workflow INFO:
	 Workflow fmriprep_23_2_wf settings: ['check', 'execution', 'logging', 'monitoring']
240724-15:04:05,353 nipype.workflow INFO:
	 Running in parallel.
240724-15:04:05,402 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 37 jobs ready. Free memory (GB): 338.60/338.60, Free processors: 16/16.

Thanks for sharing. I think fmriprep prioritizes the b0 fields in the JSON if both that and IntendedFor are present. Can you try running a test using just the IntendedFor now that they’re pointed to the right files?

	 B0 field inhomogeneity map will be estimated with the following 1 estimator(s): [<EstimatorType.PEPOLAR: 2>].
240724-15:29:09,300 nipype.workflow INFO:
	 Setting-up fieldmap "auto_00000" (EstimatorType.PEPOLAR) with <sub-P913_ses-baseline_dir-AP_run-01_epi.nii.gz, sub-P913_ses-baseline_dir-PA_run-01_epi.nii.gz>

That seems to have at least initialized the fieldmap workflow and sdcflow is present as well. Thanks a lot for your help!

Good sign! Please update here if it does/doesn’t work in the end.

Best,
Steven