By Dianne K Patterson at the University of Arizona
Was this helpful?
(Voting helps us personalize your learning experience!)
Susceptibility Distortion Correction
Left: dMRI image; Right: RPE Image for SDC Correction
By Dianne K Patterson at the University of Arizona
Was this helpful?
(Voting helps us personalize your learning experience!)
fMRI correction options: right top: Reverse Phase Encoded Bold scan; right bottom: Phasediff field map
By Dianne K Patterson at the University of Arizona
Was this helpful?
(Voting helps us personalize your learning experience!)
ASL correction options: top: Reverse Phase Encoded m0scan; bottom: Phasediff field map
By Dianne K Patterson at the University of Arizona
Was this helpful?
(Voting helps us personalize your learning experience!)
Corrected Images: What you get
For each modality, the unprocessed data is in a yellow frame.
The field map or reverse phase-encoded image used to do the correction is in a green frame.
The final corrected image is in a white frame.
The distortion correction results of topup applied to dMRI
By Dianne K Patterson at the University of Arizona
Was this helpful?
(Voting helps us personalize your learning experience!)
The distortion correction results of applying fieldmap correction in fmriprep
By Dianne K Patterson at the University of Arizona
Was this helpful?
(Voting helps us personalize your learning experience!)
fMRI Pepolar correction
By Dianne K Patterson at the University of Arizona
Was this helpful?
(Voting helps us personalize your learning experience!)
ASL Distortion Correction with Phasediff Fieldmap
By Dianne K Patterson at the University of Arizona
Was this helpful?
(Voting helps us personalize your learning experience!)
ASL Distortion Correction with Reverse Phase Encode Image
By Dianne K Patterson at the University of Arizona
Was this helpful?
(Voting helps us personalize your learning experience!)
Distortion Correction with BIDS Apps
BIDS Specification of the dMRI Correction Image
By Dianne K Patterson at the University of Arizona
Was this helpful?
(Voting helps us personalize your learning experience!)
BIDS Specification of fMRI Correction Image
By Dianne K Patterson at the University of Arizona
Was this helpful?
(Voting helps us personalize your learning experience!)
Resources
Digest
Stop and think about these concepts and terms
pepolar images
blip up/blip down
Reverse Phase Encode (RPE)
Field map
fmap
phasediff
geometric distortion
areas of high susceptibility (e.g. anterior temporal lobes and the ventromedial frontal lobe)
Echo-Planar Images (EPI)
DWI
fMRI
ASL
fMRIprep
QSIprep
Exit Questions
Did you like this lesson?
(Voting helps us personalize your learning experience!)
Close
Sharing lessons in OpenClass
OpenClass is on a mission to improve & democratize education. Through our platform, educators can share assignments privately or with our entire community to improve accessibility of the best learning resources around the world.
Our lessons organize course content into an easy-to-digest format for students to consume. If this lesson is relevant to your teachings, feel free to add it to one of your classes!
# Introduction/Overview
The study of distortion correction is evolving rapidly. This lesson examines distortion in [EPI](https://mriquestions.com/echo-planar-imaging.html) images (e.g., DWI, fMRI, and ASL), and common approaches to correct that distortion. EPI images are acquired quickly and suffer from more distortion as a result.
## <span style="color: green;">Practice</span>
The accompanying <span style="color: green;"><b>practice</b></span> lesson uses Google Cloud Shell and the `intend4` container to add the `IntendedFor` field to JSON sidecars that do not have it.
## <span style="color: blue;">Required Readings</span>
The <span style="color: blue;">required reading</span> lesson provided some general background on the issue of distortion correction.
<div class='text-with-darkorange-background'>
📝 <b>Table of Contents</b>
</div>
<div class='text-with-orange-background'>
~60-minutes:<br>
● Susceptibility Distortion: The Problem<br>
● Susceptibility Distortion Correction<br>
● Corrected Images: What you get<br>
● Distortion Correction with BIDS Apps<br>
</div>
# Problem Overview
- EPI (echo planar images) are susceptible to distortion that makes it difficult to align them to the structural scan or properly normalize them to standard space. DWI is especially prone to this problem. However, other modalities where distortion is a concern include fMRI and ASL.
- The most visible distortion effects in EPI images occur in areas with larger air-tissue interfaces, especially areas near the sinuses like the anterior temporal lobes, and the ventromedial frontal lobe.
- In general, distortion is really terrible in DWI images, but milder in fMRI and ASL images.
This 5-minute video describes issues with voxel shift (geometric distortion) and intensity distortion. Ted Trouard supplements and enriches the presentation with deeper explanations.
# DWI Distortion is the worst!
As seen in the video, and the figures below, DWI displays striking distortions which are marked by red arrows.
- Figure 1 displays elongated horns in the DWI image (right) compared to the T1w image (left).
- Figure 2 displays stretched eyeballs in the DWI image (right) compared to the T1w image (left).
<div class="callout caution-callout">
<div class="callout-title">
<svg class="callout-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide-zap">
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon>
</svg>
<span class="callout-title-text">Caution!</span>
</div>
<div class="callout-body">
It is unfortunately very easy to get the wrong polarity when collecting these images at the scanner. This is because the polarity cannot be set at the outset and needs to be manually adjusted every time you run the scan. You should help the MRI tech remember to set the polarity and then you should check after running to ensure the polarity is correct. The RPE scan is typically short (less than 5 minutes), so if you catch any mistakes BEFORE you get the participant out of the scanner, you can re-run the RPE scan.
</div>
</div>
# SDC Overview
Distorted images benefit from a process called **susceptibility distortion correction (SDC)**. Although there are several approaches to SDC, the optimal approaches rely on special correction/calibration images.
- Several tools support pepolar correction including FSL's DWI and ASL pipelines; and BIDS apps like [QSIprep](https://qsiprep.readthedocs.io/en/latest/), [fMRIprep](https://fmriprep.org/en/stable/), [ASLprep](https://aslprep.readthedocs.io/en/latest/), [dMRIprep](https://dmriprep-personal.readthedocs.io/en/refactor/#), and MRtrix3_connectome. Algorithms to do pepolar correction include FSL's [TOPUP](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/topup), and AFNI's [3dqwarp](https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dQwarp.html).
- Field map based correction is available in FSL's fMRI and ASL pipelines; and BIDS apps like fMRIprep (at least).
- This 25-minute video describes the basic approaches to correction using either
(1) pepolar (a.k.a blip-up/blip-down) or
(2) field map images.
Again, Ted Trouard enriches the presentation with supplemental information.
## DWI Distortion Correction Images
- For DWI, the best correction image is pepolar correction with a <span style="color: Lime">**reverse phase-encoded (RPE)**</span> DWI image.
<div class='text-with-darkyellow-background'>● In the figure below, the main image (a.k.a blip-up), on the left, was acquired Anterior-Posterior and has stretchy eyeballs.</div><br>
<div class='text-with-darkgreen-background'>● The reverse-phase-encode (RPE) correction image (a.k.a blip-down) was acquired Posterior-Anterior and distorts the data in the opposite direction, squishing the eyeballs.</div>
<br>
<div class="callout note-callout">
<div class="callout-title">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide-pencil">
<line x1="18" y1="2" x2="22" y2="6"></line><path d="M7.5 20.5 19 9l-4-4L3.5 16.5 2 22z"></path>
</svg>
<span class="callout-title-text">Note</span>
</div>
<div class="callout-body">
- These direction choices are not set in stone. Researchers also use RL (Right-to-Left) and LR (Left-to-Right). Which image is main and which is for correction is also a choice. For DWI, I had the best and most consistent results if the main image was AP.<br>
- In addition, normally the RPE acquisition consists of several B0 volumes, but if you have the time and want really nice correction, you can collect the entire DWI sequence with the reverse polarity.
</div>
</div>
## fMRI Distortion Correction Images
- For fMRI the standard correction image is the <span style="color: Lime">**phasediff field map image**</span> (bottom-right). The phasediff image maps areas of distortion in the field that correspond to tissue differences in the participant's head (especially air pockets).
- Other correction options exist, including the <span style="color: Lime">**RPE image**</span> (top-right).
- As of 4/16/2022 I know of no formal comparison between these two distortion correction options for fMRI, but generally, the community agrees that both options are very similar.
- Unless you go to some special effort, you are unlikely to have the RPE bold images. But if you do want to collect them, acquire several volumes (~5-10). You can use this one RPE set to correct any of the fMRI images in that session.
- fMRIprep provides a mechanism for using either the field maps or the RPE images for distortion correction.
## ASL Distortion Correction Images
- Processing choices for ASL are reported for the FSL tool, [BASIL](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/BASIL), which seems to be best in class for ASL processing (April 11, 2022).
- Note that for our ASL sequences, the main image is PA (squishy), so the RPE image is AP (stretchy). This is the opposite of the DWI sequences! As already mentioned, these direction choices are not set in stone. Researchers also use RL and LR. Which image is main and which is used for correction is also a choice, and only by testing them can you determine if there is some reason to prefer one over the other. All else being equal, it'd be good if all the researchers used the same solution.
- BASIL offers two choices for distortion correction pictured in the figure below:
- The reverse-phase encode m0scan (top right)
- The phasediff field map (bottom right)
- Although there is no consensus on which is better (Michael Chappell, personal communication), Matt Glasser recommends the field map (personal communication).
# Summary: Correction Images
As you have seen, distortion correction usually involves either **pepolar** or **field map** correction: Pepolar correction is the standard for DWI, whereas either pepolar or field map correction work pretty similarly for fMRI and ASL, but field map correction is more common.
# Pepolar Corrected DWIs
- Pepolar (a.k.a blip-up/blip-down) susceptibility distortion correction reconstructs the corrected image from the original image and its reverse-phase encoded complement.
- Here pepolar correction is illustrated with FSL's topup and DWI images.
- Pepolar correction is better than other methods of distortion correction for DWI ([Graham et al. 2017](https://d2l.arizona.edu/d2l/le/content/1094193/viewContent/12494144/View)).
# Corrected fMRIs
Although results of distortion correction for fMRI are less spectacular than for DWI, there are still visible effects in the anterior temporal lobes and ventromedial frontal lobe.
## Field map Corrected fMRI
The following figure displays the results of correction using fMRIprep and field maps. Slice selection is relatively inferior to emphasize the features of the phasediff image. This is the most common distortion correction approach for fMRI.
## Pepolar Corrected fMRI
The following image displays the results of using a reverse phase-encoded fMRI image to do distortion correction. This is less common than using field maps but is available as an option in fMRIprep. Again, the final result of fMRIprep's preprocessing has been cropped and bias-corrected. In this case, the slice selection is through the eyeballs to emphasize the stretchy-squishy comparison.
# Corrected ASLs
- The 3D GRASE PASL ASL images we generate on our U of A Siemens research scanner have relatively little distortion compared to 2D ASL images.
- In addition, the actual structural tissue is suppressed in the resulting calibrated perfusion images.
- However, distortion correction still has some effect.
- There is no consensus on which correction method (*pepolar* or *field map based*) is better.
## Field map Corrected ASL
## Pepolar Corrected ASL
# Overview of BIDS Distortion Correction
- The BIDS directory structure stores all correction/calibration images in a directory called *fmap*. This includes magnitude and phasediff field map images, the RPE image for DWI correction, and possibly other images as well.
- BIDS apps that use the standard library [SDCFlows](https://www.nipreps.org/sdcflows/master/index.html), notably QSIprep and fMRIprep, offer a choice of SDC methods and require a mechanism for selecting the intended choice.
- Selection methods may rely on the presence of special fields in the JSON files. The **IntendedFor** field has the longest history in the BIDS infrastructure, but it is more complicated and less flexible than the newer pair of fields: [B0FieldIdentifier](https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#using-b0fieldidentifier-metadata) and [B0FieldSource](https://bids-specification.readthedocs.io/en/stable/glossary.html#b0fieldsource-metadata). Currently (Dec 28, 2022), the [BIDS standard](https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#using-b0fieldidentifier-metadata) recommends using both approaches (i.e., *IntendedFor* and *B0fieldIdentifier/B0FieldSource*) to maintain compatibility with tools that support older datasets.
# IntendedFor Specification
To initiate **field map** or **pepolar** distortion correction, BIDS apps like [fMRIprep](https://fmriprep.org/en/stable/workflows.html#susceptibility-distortion-correction-sdc) and [QSIprep](https://qsiprep.readthedocs.io/en/latest/preprocessing.html?highlight=distortion%20correction#head-motion-eddy-current-distortion-correction-fsl) depend on fields in the [JSON](https://www.json.org/json-en.html) sidecars. In particular, the `IntendedFor` field should be added to the JSON sidecar of the appropriate field map. The `IntendedFor` field is a key-value pair that tells a compliant BIDS app what target image to correct with that particular field map.
## The Problem
Unfortunately, DICOM-to-BIDS conversion tools do not always generate and populate the optional *IntendedFor* field, despite the fact that the field and its values may be necessary for some apps to implement optimal susceptibility distortion correction. In addition, it is entirely possible to only discover after the fact that you should have added an IntendedFor field!
## Comparison of ezBIDS and HeuDiConv
In the ezBIDS lesson, you provided an `IntendedFor` value, and that key-value pair was created in the accompanying JSON sidecar for the field map. In the HeuDiConv lesson, the `IntendedFor` field was **not** created in the JSON sidecar at all! You can verify this by opening the field map JSON files from each dataset with a code editor, like [VScode](https://code.visualstudio.com/), and searching for `IntendedFor`.
For example, in the ezBIDS dataset my `fmap/sub-188_phasediff.json` contains this entry:
<div class='oc-markdown-activatable oc-markdown-custom-container' data-value='```JSON
"IntendedFor": [
"func/sub-188_task-nad1_run-01_bold.nii.gz",
"func/sub-188_task-nad1_run-02_bold.nii.gz",
"func/sub-188_task-nad1_run-03_bold.nii.gz",
"func/sub-188_task-nad1_run-04_bold.nii.gz"
]
```'></div> and the `fmap/sub-188_dir-PA_epi.json` created by ezBIDS also contains the `IntendedFor` entry:
<div class='oc-markdown-activatable oc-markdown-custom-container' data-value='```JSON
"IntendedFor": [
"dwi/sub-188_dir-AP_dwi.nii.gz"
]
```'></div>
`IntendedFor` fields are NOT present in the corresponding Heudiconv sidecars!
# IntendedFor Value is Relative
The specification of the path in <i>IntendedFor</i> is relative to the subject's directory, as illustrated in the two figures below.
# Generating the IntendedFor Field
## Solutions
- **Manual**: You can add the *IntendedFor* field manually. This works but is tedious and error-prone.
- **Choose a different DICOM-to-BIDS converter**: Some may add an **IntendedFor** field if you specify it.
- For example, if you specify it correctly, BIDSkit can add IntendedFor to field maps meant to correct fMRI data.
- ezBIDS does a good job of handling the IntendedFor field for both fMRI and DWI images.
- Unfortunately, HeuDiConv does not offer a straightforward way to do this. Obviously, this is frustrating if you have already converted to BIDS.
- In the practice, you will use the **Intend4 tool** allows you to modify the *IntendedFor* field for fMRI and DWI images in existing BIDS datasets. Documentation is available on Github at [hickst/intend4](https://github.com/hickst/intend4). The tool facilitates reliable modification of individual subjects or an entire bids data directory quickly and accurately. It is designed to support the addition or removal of fMRI scans to the phasediff sidecar and/or DWI scans to the RPE image.
# Alternatives to IntendedFor
The IntendedFor field works for the simple cases we usually care about, but as the alternatives for doing distortion correction evolve, other choices are in the works. See the following discussions:
- [BIDS: B0FieldIdentifier](https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#using-b0fieldidentifier-metadata) and and [B0FieldSource](https://bids-specification.readthedocs.io/en/stable/glossary.html#b0fieldsource-metadata)
- [BIDS Fieldmapping Standard](https://github.com/bids-standard/bids-specification/pull/622)
- [fMRIprep Hierarchy github issue](https://github.com/nipreps/fmriprep/issues/2328)
- [Abreu R, Duarte JV (2021) Quantitative Assessment of the Impact of Geometric Distortions and Their Correction on fMRI Data Analyses. Front Neurosci 15: 642808.](https://d2l.arizona.edu/d2l/le/content/1094193/viewContent/12494143/View)
- [BIDS: B0FieldIdentifier and B0FieldSource](https://github.com/bids-standard/bids-specification/pull/622)
- [fMRIprep: Automatic selection of the appropriate SDC method](https://fmriprep.org/en/0.8.0/api/index.html#sdc-base)
- [fMRIprep Correction Methods](https://fmriprep.org/en/0.8.0/sdc.html#correction-methods)
- [fMRIprep: What's New](https://fmriprep.org/en/stable/changes.html)
- [FSL Prepare Fieldmaps Tutorial](https://www.fmrib.ox.ac.uk/primers/intro_primer/ExBox19/IntroBox19.html)
- [Graham MS, Drobnjak I, Jenkinson M, Zhang H (2017) Quantitative assessment of the susceptibility artefact and its interaction with motion in diffusion MRI. PloS one 12: e0185647.](https://d2l.arizona.edu/d2l/le/content/1094193/viewContent/12494144/View)
- [Intend4 tool](https://github.com/hickst/intend4/) for adding IntendedFor field to fMRI or DWI data
- [JQ](https://arizona.openclass.ai/resource/lesson-61d3b0b6e290d33b8ca5cf31) for manipulating JSON files
- [JD](https://arizona.openclass.ai/resource/lesson-61d4cd5d0eefc550e0582e8f) for patching JSON files
- [nipreps sdc flows](https://www.nipreps.org/sdcflows/master/index.html) This library of distortion correction approaches is accompanied by some excellent explanatory text and figures.
# Summary
- Distortion correction is a process that can help improve the quality of your results for DWI, fMRI, and ASL.
- Distortion correction requires that you collect extra images at the scanner to use for the correction.
- For DWI, these should be reverse-polarity B0 images. Note that you need to be very careful that this RPE image has the correct polarity because it must be set manually every time you run!
- For fMRI and ASL images, a set of magnitude and phasediff field maps can be used for correction. Interestingly, these field maps are probably not the same resolution as your epi images, and that's fine.
- Once you collect the additional images, you still are not done! You must ensure they are used in the preprocessing. For BIDS apps like fMRIprep and QSIprep, this may require you to add a special field to the field map JSON sidecar.
- In the practice lesson, you will use a Docker container that adds `IntendedFor` for fMRI, DWI, or both. This is handy for data converted to BIDS by any number of methods.
- Interestingly, ezBIDS does a very nice job of ensuring the `IntendedFor` field is added.
## Why Spend so much time on Distortion Correction?
- Distortion correction is important but easy to get wrong. It's better to confront this now than to mess up your own data collection or processing.
- In addition, the focus on distortion correction gives you the opportunity to think about the role of field maps, to work directly with JSON sidecars, and to understand more about EPI sequences, which are so important to neuroimaging research.
- Finally, you must be aware of this issue to continue following it. The strategies for addressing distortion are evolving and BIDS apps are continuing to work on strategies for correction.
# TO DO Checklist
✅ Participate in the Discussion of Distortion Correction
● [Distortion Correction Alternatives](https://d2l.arizona.edu/d2l/le/1236664/discussions/topics/1094351/View)
● [Student Supplied Threads: Distortion Correction](https://d2l.arizona.edu/d2l/le/1236664/discussions/topics/1099513/View)