Fieldmaps with wrap around still usable?

Hello NeuroStars-Community,
i am quite new to fMRI preprocessing, and i got a dataset from a few years ago to analyse.

Summary of what happened:

The preprocessing was already run once using fmriprep v.21.0.2. But the output looks quite strange and while inspecting the raw BIDS, i found that espcially in the fieldmaps some participants have wrap around.
From what i´ve read so far, this is normally a exclusion criteria if it happens in the func or anat scans. But i could not find anything on the fieldmaps, if it is still possible to use them or if it would be better to use the flags --use-syn-sdc and --ignore fieldmaps.

In an attempt to rerun the preprocessing, we could fix the strange sdc, but i am still wondering if it is advisable to use such fieldmaps or if it would be better to use no fieldmaps.

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

The original code used for the processing was (from the html-output):

/opt/conda/bin/fmriprep /home/project/BIDS /home/project/BIDS/derivatives participant --participant-label sub-36 --skip-bids-validation --md-only-boilerplate --fs-license-file /home/project/BIDS/derivatives/license.txt --fs-no-reconall --output-spaces MNI152NLin6Asym:res-2 --nthreads 4 --stop-on-first-crash --mem_mb 15000 -w /home/project/BIDS

Version:

21.0.2

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

Singularity

Screenshots / relevant information:

Fieldmap-Magnitude Image with wrap around:

Thank you in advance for any help! I checked the topics here, but i could not find a similar issue. If i have overlooked something, please let me know!

Best, Jan


Hi @JanSch and welcome to neurostars!

Do results improve when processing with the newest version (23.2.1 at this time)? Or alternatively could —use-syn-sdc and ignoring the dedicated field maps work for you?

Best,
Steven

Hi @Steven,

thank you for your reply.
Using version 23.2.1 did improve the results from the sdc partially:

Old “Correction”, where the scan is pushed in a pyramid like shape

vs. the new Correction, which looks much better, but still the frontal areas do not look very good

For version 23.2.1 is used the following code:

/opt/conda/envs/fmriprep/bin/fmriprep /data /out participant --participant-label 36 --skip-bids-validation --nthreads 4 --stop-on-first-crash --mem_mb 11000 -w /scratch --output-spaces MNI152NLin6Asym:res-2

I have not yet finished running the script using --use-syn-sdc and --ignore fieldmaps, as soon as it finishes i will update my answer.

Hi @Steven,

i tried running fmriprep with and --ignore fieldmaps at first seems to provide good results:

Results for one task with functional scans:

But for another task the results look different:

When using the fieldmaps all the tasks looked better, just a bit distorted in the frontal area. Icould so far not get to run --use-sync-sdc, where i get an error, which i was so far not able to work around.

Would you suggest still using the fieldmaps, to get consistent results over all tasks (in total 3, and 2 of 3 tasks looked fine).

My code for the run without fieldmaps:

/opt/conda/envs/fmriprep/bin/fmriprep /data /out participant --participant-label 36 --skip-bids-validation --ignore fieldmaps --nthreads 4 --stop-on-first-crash --mem_mb 11000 -w /scratch --output-spaces MNI152NLin6Asym:res-2

Thnaks for your help!

Hi @JanSch,

What was the error?

Hi @Steven,

here is the error report:

Traceback (most recent call last):
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node syn.

Cmdline:
	antsRegistration --collapse-output-transforms 1 --dimensionality 3 --initialize-transforms-per-stage 0 --interpolation Linear --output fmap_syn --transform SyN[ 0.8, 6.0, 3.0 ] --metric Mattes[ /scratch/fmriprep_23_2_wf/sub_pain36_wf/syn_preprocessing_auto_00001/anat2epi/clipped_noise_corrected_trans.nii.gz, /scratch/fmriprep_23_2_wf/sub_pain36_wf/fmap_preproc_wf/wf_auto_00001/clip_epi/clipped.nii.gz, 0.5, 48, Random, 0.8 ] --metric Mattes[ /scratch/fmriprep_23_2_wf/sub_pain36_wf/fmap_preproc_wf/wf_auto_00001/lap_anat_norm/clipped_noise_corrected_trans_maths_norm.nii.gz, /scratch/fmriprep_23_2_wf/sub_pain36_wf/fmap_preproc_wf/wf_auto_00001/lap_epi_norm/clipped_maths_norm.nii.gz, 0.5, 48, Random, 0.8 ] --convergence [ 200x100, 1e-06, 5 ] --smoothing-sigmas 2.0x0.0vox --shrink-factors 1x1 --use-histogram-matching 1 --restrict-deformation 0.1x1.0x0.1 --masks [ /scratch/fmriprep_23_2_wf/sub_pain36_wf/syn_preprocessing_auto_00001/mask2epi/sub-pain36_desc-brain_mask_trans_uint8.nii.gz, /scratch/fmriprep_23_2_wf/sub_pain36_wf/fmap_preproc_wf/wf_auto_00001/epi_umask/clipped_mask_union.nii.gz ] --transform SyN[ 0.8, 2.0, 1.0 ] --metric Mattes[ /scratch/fmriprep_23_2_wf/sub_pain36_wf/syn_preprocessing_auto_00001/anat2epi/clipped_noise_corrected_trans.nii.gz, /scratch/fmriprep_23_2_wf/sub_pain36_wf/fmap_preproc_wf/wf_auto_00001/clip_epi/clipped.nii.gz, 0.5, 48 ] --metric Mattes[ /scratch/fmriprep_23_2_wf/sub_pain36_wf/fmap_preproc_wf/wf_auto_00001/lap_anat_norm/clipped_noise_corrected_trans_maths_norm.nii.gz, /scratch/fmriprep_23_2_wf/sub_pain36_wf/fmap_preproc_wf/wf_auto_00001/lap_epi_norm/clipped_maths_norm.nii.gz, 0.5, 48 ] --convergence [ 10, 1e-08, 2 ] --smoothing-sigmas 0.0vox --shrink-factors 1 --use-histogram-matching 1 --restrict-deformation 0.1x1.0x0.1 --masks [ /scratch/fmriprep_23_2_wf/sub_pain36_wf/syn_preprocessing_auto_00001/mask2epi/sub-pain36_desc-brain_mask_trans_uint8.nii.gz, /scratch/fmriprep_23_2_wf/sub_pain36_wf/fmap_preproc_wf/wf_auto_00001/epi_umask/clipped_mask_union.nii.gz ] --winsorize-image-intensities [ 0.001, 0.998 ]  --write-composite-transform 0
Stdout:

Stderr:
	Killed
Traceback:
	Traceback (most recent call last):
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 453, in aggregate_outputs
	    setattr(outputs, key, val)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/traits/trait_types.py", line 2699, in validate
	    return TraitListObject(self, object, name, value)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/traits/trait_list_object.py", line 582, in __init__
	    super().__init__(
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/traits/trait_list_object.py", line 213, in __init__
	    super().__init__(self.item_validator(item) for item in iterable)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/traits/trait_list_object.py", line 213, in 
	    super().__init__(self.item_validator(item) for item in iterable)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/traits/trait_list_object.py", line 865, in _item_validator
	    return trait_validator(object, self.name, value)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py", line 330, in validate
	    value = super(File, self).validate(objekt, name, value, return_pathlike=True)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py", line 135, in validate
	    self.error(objekt, name, str(value))
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/traits/base_trait_handler.py", line 74, in error
	    raise TraitError(
	traits.trait_errors.TraitError: Each element of the 'reverse_forward_transforms' trait of a RegistrationOutputSpec instance must be a pathlike object or string representing an existing file, but a value of '/scratch/fmriprep_23_2_wf/sub_pain36_wf/fmap_preproc_wf/wf_auto_00001/syn/fmap_syn0Warp.nii.gz'  was specified.

	During handling of the above exception, another exception occurred:

	Traceback (most recent call last):
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 400, in run
	    outputs = self.aggregate_outputs(runtime)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 460, in aggregate_outputs
	    raise FileNotFoundError(msg)
	FileNotFoundError: No such file or directory '['/scratch/fmriprep_23_2_wf/sub_pain36_wf/fmap_preproc_wf/wf_auto_00001/syn/fmap_syn0Warp.nii.gz']' for output 'reverse_forward_transforms' of a FixHeaderRegistration interface

I did not have the time to look in it in detail, so please excuse me if there is an obvious error.

Hi @JanSch,

This means you are out of memory. Upping your resources should get you past this.

Best,
Steven

@Steven Ah, thank you for the help. I increased it and started running again. I will update here if it finished!

Hi @JanSch, what you could try is to use Synbold-DISCO, if you have a T1w image acquired on the same subject.

There is a discussion on how to use this tool methodology with fmriprep:

Hi @Steven,
i upped the memory to 30 GB, but still encountered the same error. In the next few weeks i am unfortunately not able to further increase memory, because we would need to change it on the server directly. As soon as i am able to devote more memory i will try again.

@jsein thank you for your suggestion, that looks quite interesting. I will give it a try, and report back the results

Hey Neurostars Community,

as an update: we did get synBOLD-disco running which provided really good results so far.

The Option syn-sdc worked interestingly good for our first test subject, however in the QA the results for the alignment of the fieldmap and the EPI are clearly faulty/buggy:
BOLD Reference:


Fieldmap Reference:

However the SDC looks fine and seem to not show any strange corrections due to the fieldmaps, so maybe its an error in the QA visualization?

We choose now for the approach recommended by @jsein to use SynBOLD-DisCo.
Thank you very much for your help @jsein & @Steven!

Best!

1 Like