Fieldmap correction gone wrong

Thank you @wwgraves for sharing this example of SDC going wrong with fmriprep v 23.0.2! Do you confirm that the SDC correction method used in your case by fmriprep v23.0.2 is the “phase difference” case?

May you try with fmriprep v20.2.7 and confirm that the SDC correction is still much better with this earlier version?

Yes, as far as I know it’s a “phase difference” case. I used the field map sequence that came with our Siemens Prisma. Using dcm2bids output two magnitude images, and one phase image, where the phase image had two echo times. That’s why I assume it’s a phase difference map. Please let me know if there’s a better way to verify.
I’m running fMRIPrep v20.2.7 now. I’ll post here once I’ve gotten a chance to take a look at the results!

Indeed, what you report sounds exactly like the the phase difference method for SDC.

Yes @jsein, it turns out changing only the fMRIPrep version to 20.2.7 led to WAY better distortion correction:

In light of this, I’ll be interested to hear what developers think about next steps.

1 Like

@jsein @Steven Replying to confirm that phasediff fieldmap correction is still providing incorrect distortion correction in the latest fmriprep versions. Only version 20.2.7 seems to work with phasediff fieldmap input.

1 Like

@wwgraves @jsein @Steven So far only solution seems to be to convert the phasediff + magnitude fieldmap into a rad/s fieldmap (and appropriately name it as per direct fieldmap under BIDS convention) before feeding it to fmriprep.

Instructions on how to create a rad/s fieldmap are found in the FSL website: FUGUE/Guide - FslWiki

2 Likes

Dear all,

after updating fmriprep to version 23.1.3 we unfortunately have encountered similar problems. We acquired our fieldmaps also at a Siemens MAGNETOM Prisma Scanner, and used two magnitude and the phasediff images for fieldmap correction.

Resulting fieldmaps using fmriprep version 23.1.3:

These fieldmaps then resulted also in heavily distorted func images, like shown in the post above. These problems did not occure when using fmriprep version 20.2.1. Our current workaround is therefore to simply use fmriprep 20.2.1 for this project, but we would be also highly interested in using newer versions of fmriprep in the future for our projects. Would very much apprecite any help or official fix for this problem!

Best
Simon

Hi Simon,

The cause of these failures was identified and the fix will be released in the next version (23.2).

Best,
Chris

4 Likes

Note to readers of this thread that 23.2.0a1 is out, which is a pre-release. It is “feature complete”, in that everything we intend to have in 23.2.0 is in it, but we want to give some time for people to run tests and catch bugs before we make it the obvious latest release. If you had any of the issues described here, we would love to hear from you about how it runs.

1 Like

Actually, before everybody’s off to the races, please wait on 23.2.0a2, which should be out by tomorrow morning. @Steven found a bug that will affect anybody using T2w images and we’re fixing it ASAP.

2 Likes

Hi Chris,
I’ve been testing 23.2.0a2. For some reason, my fieldmaps don’t seem to be detected and no sdc is performed. The data includes blip-up/blip-down scans, and I believe that all the correct information is included in the json files (PE direction, “IntendedFor” field). The fieldmaps are recognized and used with previous versions. I’m using a singularity container with the command included below submitted in a batch script. Do you have any idea what I might be doing wrong?


singularity run --cleanenv /storage/group/sjw42/default/sjw42_collab/sw/singularity/fmriprep/fmriprep_v23.2.0a2.sif \
--participant_label 108 \
--nthreads 2 \
--omp-nthreads 1 \
--low-mem \
--mem 39000 \
--level full \
--use-aroma \
--output-layout legacy \
--output-spaces MNI152NLin6Asym:res-2 MNI152NLin6Asym:res-native \
--fs-license-file /storage/group/sjw42/default/sjw42_collab/sw/freesurfer-6.0.1/license.txt \
--work /storage/group/sjw42/default/ASH/LAPS/work \
/storage/group/sjw42/default/ASH/LAPS/bids \
/storage/group/sjw42/default/ASH/LAPS/bids/derivatives \
participants

Hi @Steve_Wilson,

Please share an example field map JSON contents. Also, AROMA is deprecated and mo longer a function of fmriprep (a separate app is in development for it).

Best,
Steven

Hi Steven - I’ve pasted the JSON contents for one of the field maps below. Thanks for letting me know about the change with AROMA!
Steve


{
    "Modality": "MR",
    "MagneticFieldStrength": 3,
    "ImagingFrequency": 123.252515,
    "Manufacturer": "Siemens",
    "ManufacturersModelName": "MAGNETOM Prisma Fit",
    "InstitutionName": "Penn State SLEIC",
    "InstitutionAddress": "University Park Chandlee Laboratory,State College,PA,US,16802",
    "DeviceSerialNumber": "67039",
    "StationName": "AWP67039",
    "BodyPartExamined": "BRAIN",
    "PatientPosition": "HFS",
    "SoftwareVersions": "syngo MR XA30",
    "MRAcquisitionType": "2D",
    "SeriesDescription": "sms_distortion_map_PA_68_51",
    "ProtocolName": "sms_distortion_map_PA_68_51",
    "ScanningSequence": "GR\\EP",
    "SequenceVariant": "SK",
    "ScanOptions": "FS\\PER",
    "SequenceName": "*epse2d1_92",
    "ImageType": [
        "ORIGINAL",
        "PRIMARY",
        "M",
        "ND",
        "NORM",
        "MFSPLIT"
    ],
    "ImageTypeText": [
        "ORIGINAL",
        "PRIMARY",
        "M",
        "NONE"
    ],
    "NonlinearGradientCorrection": false,
    "SeriesNumber": 17,
    "AcquisitionTime": "13:37:1.482500",
    "AcquisitionNumber": 1,
    "SliceThickness": 2.4,
    "SpacingBetweenSlices": 2.4,
    "SAR": 0.127954,
    "EchoTime": 0.058,
    "RepetitionTime": 7.06,
    "FlipAngle": 90,
    "PartialFourier": 1,
    "BaseResolution": 92,
    "ShimSetting": [
        -1950,
        8279,
        9491,
        311,
        0,
        -409,
        53,
        23
    ],
    "TxRefAmp": 256.527,
    "PhaseResolution": 1,
    "VendorReportedEchoSpacing": 0.00051,
    "ReceiveCoilName": "HeadNeck_64",
    "ReceiveCoilActiveElements": "HC1-7;NC1",
    "CoilString": "HeadNeck_64",
    "PulseSequenceDetails": "%SiemensSeq%\\ep2d_se",
    "CoilCombinationMethod": "Sum of Squares",
    "MatrixCoilMode": "SENSE",
    "PercentPhaseFOV": 100,
    "PercentSampling": 100,
    "EchoTrainLength": 92,
    "PhaseEncodingSteps": 92,
    "AcquisitionMatrixPE": 92,
    "ReconMatrixPE": 92,
    "BandwidthPerPixelPhaseEncode": 21.313,
    "EffectiveEchoSpacing": 0.000509997,
    "DerivedVendorReportedEchoSpacing": 0.000509997,
    "TotalReadoutTime": 0.0464097,
    "PixelBandwidth": 2470,
    "DwellTime": 2.2e-06,
    "PhaseEncodingDirection": "j",
    "SliceTiming": [
        3.53,
        0,
        3.6325,
        0.1025,
        3.7375,
        0.2075,
        3.84,
        0.31,
        3.945,
        0.415,
        4.0475,
        0.52,
        4.1525,
        0.6225,
        4.2575,
        0.7275,
        4.36,
        0.83,
        4.465,
        0.935,
        4.5675,
        1.0375,
        4.6725,
        1.1425,
        4.775,
        1.245,
        4.88,
        1.35,
        4.9825,
        1.4525,
        5.0875,
        1.5575,
        5.19,
        1.66,
        5.295,
        1.765,
        5.3975,
        1.8675,
        5.5025,
        1.9725,
        5.605,
        2.075,
        5.71,
        2.18,
        5.8125,
        2.2825,
        5.9175,
        2.3875,
        6.02,
        2.4925,
        6.125,
        2.595,
        6.23,
        2.7,
        6.3325,
        2.8025,
        6.4375,
        2.9075,
        6.54,
        3.01,
        6.645,
        3.115,
        6.7475,
        3.2175,
        6.8525,
        3.3225,
        6.955,
        3.425
    ],
    "ImageOrientationPatientDICOM": [
        0.998511,
        -0.0335475,
        0.0430195,
        0.0402788,
        0.985198,
        -0.166619
    ],
    "InPlanePhaseEncodingDirectionDICOM": "COL",
    "ConversionSoftware": "dcm2niix",
    "ConversionSoftwareVersion": "v1.0.20230411",
    "Dcm2bidsVersion": "3.1.0",
    "IntendedFor": [
        "bids::sub-108/func/sub-108_task-lapse_run-01_bold.nii.gz",
        "bids::sub-108/func/sub-108_task-lapse_run-02_bold.nii.gz",
        "bids::sub-108/func/sub-108_itask-iat_run-01_bold.nii.gz",
        "bids::sub-108/func/sub-108_task-iat_run-02_bold.nii.gz"
    ]
}

I just noticed the different format dcm2bids is using for the IntendedFor field. I wonder if that might be the issue.

Yes, fmriprep does not support BIDS URI at the moment. Please remove bids::sub-XXX/ from your fields.

Best,
Steven

Ah, sounds good - I should have caught that before. Thanks, Steven!

1 Like

Hello,

I had SDC problems similar to the reported in the beggining of the thread. So i’ve tried running version 23.2.0a2 but I ran into this error that leads to a crash of fmriprep. Do you know what I might’ve done wrong?

Node: fmriprep_23_2_wf.sub_05_wf.bold_task_subriskrun1_wf.bold_native_wf.boldref_fmap
Working directory: /tmp/work/fmriprep_23_2_wf/sub_05_wf/bold_task_subriskrun1_wf/bold_native_wf/boldref_fmap

Node inputs:

fmap_ref_file =
in_coeffs =
inverse = [True]
target_ref_file =
transforms =

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 boldref_fmap.

Traceback:
Traceback (most recent call last):
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py”, line 397, in run
runtime = self._run_interface(runtime)
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/fmriprep/interfaces/resampling.py”, line 169, in _run_interface
fieldmap = reconstruct_fieldmap(
File “/opt/conda/envs/fmriprep/lib/python3.10/site-packages/fmriprep/interfaces/resampling.py”, line 661, in reconstruct_fieldmap
raise ValueError(‘Reference passed is not aligned with spline grids’)
ValueError: Reference passed is not aligned with spline grids

Hi @Patricia_Fernandes and welcome to neurostars!

We will need more information to address your issue Please open a new issue under the Software Support category and fill in all of the information in the prepopulated post template.

Best,
Steven

Just a quick update that the sdc results look very good with version 23.2.0a2!

another quick update:

  • The PEPOLAR method for SDC works well with 23.2.0a2 on our data (it was also doing a good job with previous fmriprep version)

  • For testing purposed I ran also the Fieldmap-Less method on the same subject and unfortunately the correction is still quite a bit off for this method in 23.2.0a2. Here are some examples below of the HMTL output from fmriprep 23.2.0a2 with the fieldmap-less method:

This is confirmed in another report (even if for us the result is really not that bad with the Fieldmap- Less method!) : fieldmap-less SDC in v. 23.2.0a2 producing odd/distorted results · Issue #3158 · nipreps/fmriprep · GitHub