Fmriprep SDC distort the image and there is error for some subjects

Summary of what happened:

Hi everyone. We got some 7T fMRI data but encountered one issue during the preprocessing using fmriprep. As shown in the screenshots below, the SDC severely distorted the image. Two magnitude and one phase difference images were used for the correction. We tried the same preprocessing process on 5 subjects’ data, 4 out of 5 were distorted and there were errors raised for those subjects. We also tried the same process for 3T data and that works well.

As a fresher with fmriprep, I really have no idea what’s the issue and how to deal with it. If possible, I really hope to get some advice from people that is more experienced.

Thank you very much for any help in advance.

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

fmriprep-docker \
    --user $(id -u):$(id -g) \
    bids_7T/ \
    bids_7T/derivatives/ \
    participant \
    -w workdir/ \
    --participant_label '+pid+' \
    --ignore slicetiming \
    --output-spaces T1w run func \
    --fs-license-file /usr/local/freesurfer/license.txt \
    --force-bbr \
    --dummy-scans 10 \
    --use-aroma \
    --aroma-melodic-dimensionality -200 \
    --return-all-components \
    --fs-no-reconall \
    --write-graph \



Environment (Docker, Singularity, custom installation):


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

I got one warning from the validator:

#### **Warning 1: [Code 102] TOO_FEW_AUTHORS**

[Click here for more information about this issue](

The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered based on the presence of only one author field. Please ignore if all contributors are already properly listed.

Relevant log outputs (up to 20 lines):

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

	Traceback (most recent call last):
	  File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/", line 398, in run
	    runtime = self._run_interface(runtime)
	  File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/utility/", line 142, in _run_interface
	    out = function_handle(**args)
	  File "", line 7, in _to_join
	  File "/opt/conda/lib/python3.9/site-packages/nipype/interfaces/base/", line 398, in run
	    runtime = self._run_interface(runtime)
	  File "/opt/conda/lib/python3.9/site-packages/niworkflows/interfaces/", line 376, in _run_interface
	    raise ValueError("Number of columns in datasets do not match")
	ValueError: Number of columns in datasets do not match

Screenshots / relevant information:

Hi @syf00 , and welcome to NeuroStars!

When you began creating this post, there should have been a template that asks you for important information that can help us debug your problem. I have edited your post to add that template back in. Feel free to edit your post to include this information.

Some other things that would be good to know is what kind of fieldmaps you were using (or if you were using the fieldmapless SYN SDC approach), what the uncorrected images look like in the HTML file, and whether the errors persist on the recent fMRIPrep version 22.1.0, which includes a new SDCFlows version.


Hi Steven,

Thank you very much for your edit. I updated the post just now. Will have a try on the newer version.

Kind regards,

Sounds good! I would also recommend not using the --fs-no-reconall flag.

Hi Steven,

Thank you for the recommendation. We may include the freesurfer reconall later. At this point, we updated the fmriprep to the newest version with the exactly same command. There is no error, but the SDC still distort the image as shown below. Hope to get some advice if possible.

Many thanks,

What do the uncorrected images look like? It definitely looks better than before! Using Freesurfer may improve the results, since you may get a better T1 boundary from it, which could results in better SDC.

Hi Steven,

Sorry for the late reply. I have enabled the freesurfer surface preprocessing. Here is the new command used:

    --user $(id -u):$(id -g)
    -w {path_to_workdir}
    --participant_label '+pid+'
    --ignore slicetiming
    --output-spaces T1w run func
    --fs-license-file /usr/local/freesurfer/license.txt
    --dummy-scans 10
    --aroma-melodic-dimensionality -200

Unfortunately, the image is still distorted. The uncorrected and corrected Images are attached below.

I would really appreciate it if I can get any help with this issue. Thanks in advance.

Kind regards,

What does another subject look like, particularly one with good quality? The striping on the bottom of the brain indicates this subject might have moved a lot.

Thanks for your quick reply.
Here is another one that looks better.

Hi @syf00 , which SDC method is FMRIPREP using on your dataset? Do you provide any kind of fieldmap in your dataset? (pepolar, phase-difference …)

Another suggestion would be to try a newer version of fmriprep (the latest release currently is 22.1.1) which uses a newer version of SDCFlows for SDC.

@jsein Thanks for your suggestions. I am currently using the 22.1.1 version, but the issue persists. I have 2 magnitude and 1 phase-difference field map.

You are not the first one to mention this issue with SDC correction. The FMRIPREP team is working on it and the next release of FMRIPREP will hopefully do a better job at tackling this issue.

Here is a related post about this:

In the meantime, you may want to try an earlier version of FMRIPREP, that could give you different (and hopefully better) result on your dataset. For instance you can try FMRIPREP 20.2.7, the latest release of the LTS (long term support) branch.

1 Like

@jsein thank you very much for your information. I will have a try on that version.

I can confirm that there was a major regression in the SDC processing for (in my case) the phase difference field map method. The good news is rolling back to 20.2.7 as suggested worked well for me. I ran with 20.2.7, 22.0.2, 22.1.1. There was a small improvement from 22.0.2 to 22.1.1, but both still had gross errors, while 20.2.7 gave very clean results. I’ve included examples from 20.2.7 and 22.1.1
First version 22.1.1 showing gross distortions:

Second version 20.2.7 of the exact same data showing normal results:


Looking at @sabarnes’ data, very low SNR magnitude2 images seem to be the cause of the problem. @syf00 would you share a screenshot of your phasediff and magnitude images?