-
Notifications
You must be signed in to change notification settings - Fork 28
Description
What happened?
I am pre-processing an fMRI dataset using the latest version of fmriprep. It seems that for a significant portion of my dataset, during SDC correction, the alignment between the anatomical reference of the fieldmap and the target EPI is quite poor. Here is an example:
I believe this issue is related to #461 and #430. It appears the solution suggested in #461 (dilation of the fmap and epi masks) has been implemented in the latest version of fmriprep to make this coregistration step more robust. However the discussion in #463 raised a concern regarding whether all the different types of fieldmap are as resilient to a dilated mask.
My dataset uses the Siemens' phase-difference method (i.e. fmap data consists of two magnitude images and one phase-difference image), where the tissue contrast in the magnitude images is inverted compared to the tissue contrast in the EPI images.
Additionally, as you can see in the screenshot above, the fmap data and the EPI data are fairly well aligned to start off with. Participants have fmap and EPI data acquired shortly after another, so there are only small rotations/translations between images. As such, I would expect that this would not be a difficult registration problem.
However the output of the registration is a significant misalignment (BOLD data in red, clipped_trans.nii.gz (fmap data) in grey):
What are some potential solutions to make this coregistration step more robust?
What command did you use?
# fmriprep_singlesubject.sh
DATA_DIRECTORY='./hande_fmri'
OUTPUT_DIRECTORY='./hande_fmri/derivatives/fmriprep'
WORKING_DIRECTORY='./fmriprep_scratch'
SUBJECT="64"
LICENSE='./license.txt'
N_THREADS=4
find "$DATA_DIRECTORY" -name "*._*" -delete
fmriprep-docker "$DATA_DIRECTORY" "$OUTPUT_DIRECTORY" \
participant \
--skip-bids-validation \
--participant-label "$SUBJECT" \
--task-id "taprest" \
--output-spaces MNI152NLin2009cAsym:res-2 \
--bold2anat-init "t1w" \
--md-only-boilerplate \
--fs-license-file "$LICENSE" \
--stop-on-first-crash \
--work-dir "$WORKING_DIRECTORY"What version of the software are you running?
25.1.4
How are you running this software?
Docker
Is your data BIDS valid?
Yes
Are you reusing any previously computed results?
No
Please copy and paste any relevant log output.
# The following log output shows that dilate_fmap_mask is implemented ...
250807-04:28:43,648 nipype.workflow INFO:
[Node] Setting-up "fmriprep_25_1_wf.sub_03_wf.bold_ses_12_task_taprest_run_1_wf.bold_fit_wf.fmapreg_wf.dilate_fmap_mask" in "/scratch/fmriprep_25_1_wf/sub_03_wf/bold_ses_12_task_taprest_run_1_wf/bold_fit_wf/fmapreg_wf/dilate_fmap_mask".
# The following log output shows that fmriprep completed without errors ...
250807-22:47:08,284 nipype.workflow IMPORTANT:
fMRIPrep finished successfully!Additional information / screenshots
The relevant ANTs registration command generated by fmriprep is as follows:
antsRegistration
--collapse-output-transforms 1
--dimensionality 3
--initial-moving-transform [ /scratch/fmriprep_25_1_wf/sub_03_wf/fmap_preproc_wf/wf_fmap_sub03_ses12/magnitude_wf/brainextraction_wf/clipper_post/clipped.nii.gz, /scratch/fmriprep_25_1_wf/sub_03_wf/bold_ses_12_task_taprest_run_1_wf/bold_fit_wf/enhance_and_skullstrip_bold_wf/n4_correct/sub-03_ses-12_task-taprest_run-1_bold_average_corrected.nii.gz, 1 ]
--initialize-transforms-per-stage 0
--interpolation LanczosWindowedSinc
--output transform
--transform Rigid[ 0.1 ]
--metric Mattes[ /scratch/fmriprep_25_1_wf/sub_03_wf/fmap_preproc_wf/wf_fmap_sub03_ses12/magnitude_wf/brainextraction_wf/clipper_post/clipped.nii.gz, /scratch/fmriprep_25_1_wf/sub_03_wf/bold_ses_12_task_taprest_run_1_wf/bold_fit_wf/enhance_and_skullstrip_bold_wf/n4_correct/sub-03_ses-12_task-taprest_run-1_bold_average_corrected.nii.gz, 1, 32, Random, 0.25 ]
--convergence [ 50, 1e-07, 5 ]
--smoothing-sigmas 8.0mm
--shrink-factors 2
--use-histogram-matching 1
--masks [ /scratch/fmriprep_25_1_wf/sub_03_wf/bold_ses_12_task_taprest_run_1_wf/bold_fit_wf/fmapreg_wf/dilate_fmap_mask/clipped_mask_dil.nii.gz, /scratch/fmriprep_25_1_wf/sub_03_wf/bold_ses_12_task_taprest_run_1_wf/bold_fit_wf/fmapreg_wf/dilate_target_mask/sub-03_ses-12_task-taprest_run-1_bold_average_corrected_brain_mask_maths_dil.nii.gz ]
--transform Rigid[ 0.1 ]
--metric Mattes[ /scratch/fmriprep_25_1_wf/sub_03_wf/fmap_preproc_wf/wf_fmap_sub03_ses12/magnitude_wf/brainextraction_wf/clipper_post/clipped.nii.gz, /scratch/fmriprep_25_1_wf/sub_03_wf/bold_ses_12_task_taprest_run_1_wf/bold_fit_wf/enhance_and_skullstrip_bold_wf/n4_correct/sub-03_ses-12_task-taprest_run-1_bold_average_corrected.nii.gz, 1, 32, Random, 0.5 ]
--convergence [ 20, 1e-08, 3 ]
--smoothing-sigmas 2.0mm
--shrink-factors 1
--use-histogram-matching 1
--masks [ /scratch/fmriprep_25_1_wf/sub_03_wf/bold_ses_12_task_taprest_run_1_wf/bold_fit_wf/fmapreg_wf/dilate_fmap_mask/clipped_mask_dil.nii.gz, /scratch/fmriprep_25_1_wf/sub_03_wf/bold_ses_12_task_taprest_run_1_wf/bold_fit_wf/fmapreg_wf/dilate_target_mask/sub-03_ses-12_task-taprest_run-1_bold_average_corrected_brain_mask_maths_dil.nii.gz ]
--winsorize-image-intensities [ 0.001, 0.999 ]
--write-composite-transform 0
Looking into the masks used, it seems for the particular subject I am using as an example, the automatic masking seems to fail and includes many bright voxels in the scalp and neck. I wonder if this is maybe driving the problem. Screenshot of clipped_mask_dil.nii.gz:
