Here we consider the problem of applying susceptibility distortion correction to EPI imaging data. We derive an efficient algorithm for simultaneously correcting for head motion and susceptibility distortions.
Consider a collection of MRI scans of a human brain. When collected, each image is in the "scanner space", which is to say that the elements of the data arrays (voxels) correspond to locations inside an MR scanner. When comparing images for the same subject, this space is generally unhelpful, as subjects may move within the scanner, and the scanner operator may select a different location within the scanner to consider the origin .
Therefore images must be brought into register with one another. Generally, one uses successive approximations of transformations, such as rotations and translations, to minimize a cost function. The resulting transformation may be used to transform coordinates in one image to the equivalent coordinates in another.
Images contain an internal affine transformation that translates from indices in the data matrix into world coordinates, conventionally in millimeters (mm) right, anterior and superior of some origin. Because the world coordinate space is abstracted from the details of the data array, it is convenient to represent transformations between images as transformations between their world coordinates, not their array indices.
During a sequence of scans, such as functional or diffusion MRI (fMRI, dMRI), subjects' brains generally move slightly due to a combination of breathing or other movements of the head and neck, as well as pulsing of the vasculature of the brain. Head motion correction is a series of registrations from each volume in a series to a single reference volume, which may be the first volume, a separately acquired reference volume, or any other convenient target.
Head motion correction is typically modeled as rigid transformations, with three translational and three rotational degrees of freedom per volume.
fMRI and dMRI sequences generally take advantage of magnetic susceptibility differences in tissues, such as oxygenated and deoxygenated blood, to measure the signals of interest. As a result, the sequences also suffer from distortion in macroscopic susceptibility differences, most notably in air passages. This distortion appears as stretching and compression of the image along the phase-encoding direction, and it scales with a parameter called the total readout time and the inhomogeneity of the primary magnetic field .
Susceptibility distortions are an interaction of the tissues, a property of the subject, and the magnetic field of the immobile scanner. Therefore, a subject in motion can produce susceptibility artifacts that are constant in direction relative to the scanner while different in direction relative to the principal axes of the brain.
It is therefore potentially problematic to correct for head motion and then susceptibility distortion, even with concatenated transformations. The susceptibility distortion must be calculated with respect to the rotation of the brain in the magnetic field
In this section I introduce notation and terminology. The concepts, if not the specific notation should be familiar to those who have previously read a mathematical treatment of susceptibility distortion correction. The only (possibly) new concept is that of a readout field.
Here a space is defined by an image, which contains a 3-dimensional data array and an affine matrix that map indices into world coordinates. The world coordinates and the space may sometimes be used interchangeably; the indices into the data array will always be specified when intended.
We have the following spaces:
The problem at hand is to resample the voxel data in to , taking into account distortions that are known to scale with a parameter sampled in .
For a given space , there is an affine matrix that transforms a discrete index to a "world coordinate" .
Without loss of generality, the BOLD volumes share a common affine, but not a common space. If a term with the subscript omits the superscript, the value of the term in that context does not change with .
By assumption, the subject moves between volumes, so volumes have been registered to one another. In this case, the BOLD reference space acts as a common registration target. Only affine registrations are considered here, and for simplicity they may be assumed to be rigid (rotation and translation) transforms.
A transform is the affine transform from coordinates in space to . Assume we have invertible transforms:
To invert a transform, we may either use the superscript or swap the subscripts to indicate from/to.
and its inverse vary by . This is in fact the only source of variation between volumes , and what permits and to be meaningfully superscripted.
MRI acquisitions in general are sensitive to to inhomogeneities in the scanner magnetic field (), which are induced by inhomogeneous materials, such as the human head. A fieldmap is a measure of , with the unit of Hz (radians/sec), and when we estimate this value (by any technique), we can describe the result as a discretely sampled field in the space :
More usefully, we will consider the function over the world coordinates, which will be interpolated over the discrete field:
Echo-planar images are acquired with phase-encoding and frequency-encoding directions. Importantly the phase-encoding direction has a polarity, indicating which end of the data matrix is collected at an early or late phase.
BOLD volumes share a phase-encoding direction that corresponds to an (oriented) axis in the data matrix, for example j-
indicates that readout will occur in the negative direction in the second dimension, which we can indicate with an orientation vector field:
Phase-encoding directions may be i
, j
or k
and may have positive or negative polarity. See Algorithm for a Python implementation.
The readout field is a vector field over the voxel space of the BOLD image, and it scales with the total readout time () of the BOLD image:
This readout field is an orientation vector in voxel-seconds. If scaled by a fieldmap in Hz, it would provide a displacement map in voxels along the direction of the phase encoding axis.
The problem is to correct a bold volume in simultaneously accounting for motion and distortion to resample in .
First, let's review resampling. When resampling from a source space to a target space , we select a grid of indices in the target space, and find values in to place in each array element (voxel). Assuming we have an affine transform from to , we can map our new indices into our source data:
We are looking to resample a volume into the the BOLD reference volume , given a transform :
We would like to find an additional displacement that would account for distortion induced shift. At each index , we can find a corresponding shift by mapping into the volume world space, then reference, and finally fieldmap space, and multiplying the scalar result by our readout vector:
Taken over all indices, this is the fieldmap, resampled into the volume space , multiplied the readout vector to get a voxel shift map. Using our earlier calculations, we can decompose this into the fieldmap resampled into the reference space and the orientation vector:
Hence, by resampling once into ,
We are able to fully calculate the index-to-index mapping:
Somewhat surprisingly, the fieldmap does not need to be resampled into the individual spaces in order to fully account for the effect of distortions, because it is a shift in indices based on the geometry of the target space .
What is novel is that the shift applies to indices in and not in where they seem to naturally occur.
Let recap the components of this final equation:
Note that there is no requirement for to be the BOLD reference space, nor must the transformations be affine. The critical features are that the fieldmap be resampled into the target space and used to calculate voxel shifts in the source space.
The final equation we derived was:
The standard way of combining head motion and distortion corrections is to concatenate transforms, which composes index mapping functions. Here, applying the voxel shift map to and then applying the motion correction to yield would yield:
The difference in source voxel selection is , which intuitively measures the degree of rotation of phase-encoding axis encoded in the . For small rotations or rotations about the phase-encoding axis, the difference is minimal.
In the previous section, we assumed transformations were affine for conceptual and notational simplicity.
We will now show that invertibility is sufficient, and demonstrate that any target space may be used, and not merely an intermediate BOLD reference space.
Let be an invertible mapping from to :
Let's consider the following common spaces:
The following transforms (and their inverses) have been calculated:
For notational convenience, the following compositions are defined, which map group coordinates into the fieldmap and individual BOLD coordinate spaces:
To resample to from each volume, we need:
We again seek a displacement based on the fieldmap, which has been registered to the BOLD reference space, as above:
Substituting :
The first term resamples the fieldmap, in Hz, onto the target space:
Hence, the final index-to-index mapping is:
We have now shown that all that is required to use this algorithm is some sequence of transforms that can map both the fieldmap and the individual BOLD volumes to a target space. The BOLD reference volume is a convenient space, but any other intermediate spaces may be used.
For example, if it is simpler to register the fieldmap to the physical space, it remains possible to find a target space. However, typically fieldmap correction is used to improve the anatomical fidelity of the EPI prior to registration to the anatomical scan. The above analysis suggests that a fieldmap registered to the anatomical space could be used when computing the cost function during coregistration.
The above analysis establishes that we may resample a fieldmap into
a convenient space, and we use the target space as the most clearly
convenient space. However, the exact same logic can produce any of
the following mappings:
In all cases, we are mapping indices in onto indices in . The only condition is that the fieldmap must be
interpolated at a high enough resolution to make these terms equivalent.
Here we make explicit the notion of a BOLD reference space with an
identical affine and index grid as each individual volume.
This is typically true of the space , but rather than
require , we will simply use .
Finally, let us abstract from any particular target space. We will
consider , and if an intermediate space is needed
we will use .
Therefore:
The derivative of the affine transformation
dT_XY
Letting be the voxel-to-voxel warp,
Note that is a positive or negative unit vector
along one of the dimensions of ,
so the gradient simplifies to the partial derivative in the direction of .
We also neglect
To this point, we have considered the problem of mapping coordinates
from a target grid onto a source grid.
Resampling an image, however, uses mapped coordinates to interpolate
intensity values from the source image into the target grid.
We will use the symbol to indicate the image intensity
at a location in space at time .
For any neighborhood in , we would like the average intensity
of to match the average intensity of the
corresponding region of .
So we need some per-voxel scaling parameter , which
we would apply after resampling:
We will show that the scale factor is the product of the Jacobian
determinants of the transformation and the
transformation described by the fieldmap.
More generally, we can accumulate Jacobians
Consider a differentiable transform , and let be the displacement field of , such that:
At each point we can compute the Jacobian of the transformation:
The Jacobian determinant describes the proportional change in volume of
a unit cube in the source coordinate space when transformed into the
target coordinate space.
We now consider the specific case of the voxel shift map in the BOLD
reference space . This is a displacement field where the
coordinates are voxel indices:
Without loss of generality, suppose that the phase-encoding direction
is i
, and therefore:
Therefore, the Jacobian determinant at each voxel index is
This is simply one plus the gradient of the voxel shift map in the phase-encoding direction. Resampling with scaling becomes:
Note that is affine and will thus scale all voxels equally. We are here concerned with relative changes in brightness, and can ignore any scaling effects of this term.
Note also that this Jacobian does not simplify to this trivial form as
soon as
Assume an interpolation function interpolate3D
:
We define a resampling function that accepts a transformation from
voxel indices to voxel indices in addition to a 4D displacement map,
such that the value at a 3D voxel index is a 3-vector.
Because the transformed indices may not be integers, we use
interpolate3D
to interpolate the source data:
The final algorithm to correct the volume is as follows: