August 6, 2007

Fieldmap Correction

No major changes to the function of the software have been made, but the underlying I/O software has been extensively modified to support future developments here at the lab and to increase its robustness. Moreover, the mathematical packages that are used by the programs has undergone a major revision that required modification of the code. During the modification, one change was made that could affect results.

First, some background. The program that creates fieldmaps differs in two ways from FSL. The first has to do with removing a constant shift from the fieldmap. The fieldmap is created by first computing phase images from data acquired at two TEs, "unwrapping" the phase and subtracting the two images (since phase angles lie between 0 and 2*pi, phase shifts outside this range are "wrapped"so they lie with this range when they are computed from the raw data. For example, a phase angle theta greater than 2*pi is represented by an angle theta'=theta - N*2*pi where N is an integer and the resulting angle is between 0 and 2*pi). The FSL program "prelude" does an excellent job of unwrapping these images, but it does so by starting at the upper left corner of the image (there is no good choice). Large phase shifts at the edge of the brain ensure that there will be an unknown number (i.e., N from above) of "phase wraps" in the unwrapped phase maps. Although it may partially cancel when the two phases are subtracted, this phase offset will persist in general. If this is not corrected, its effect on the fieldmap correction is to shift the image an integer number of voxels in the phase-encode direction (This defaults to the A-P direction for axial and sagittal views, and the L-R direction for coronals).

FSL uses the simple and robust solution of settting the average value of the fieldmap to zero. Although this usually works well, it does introduce a slight shift. The magnitude of the shift is dependent on the magnitude of the susceptibility artifact and the size of the region with large phase shifts at the edge of the brain and in the sinuses. This shift is more pronounced in large (i.e., male) brains. make_fmap avoids this by setting the fieldmap value to zero at the brains center-of-mass. This is reasonable because the center-of-mass is in the parietal lobe where the susceptibility artifacts are small and the distortion is well under one voxel.

The second issue relates to regions outside the brain and is related to the first. Regions outside the brain are largely in frontal regions, such as the sinuses, that bias the center-of-mass calculation towards a more anterior point. We don't want this. Moreover, the correction algorithm resamples the image based on phase values, so artifacts occur when large, phase shifts outside the brain ause regions from inside the brain are "corrected" to lie out side the brain as well as where it should be. The problem, then, is to eliminate regions outside the brain. Masking is dangerous because automatic skull-stripping programs are not sufficiently reliabl e for these data. The artifact is corrected in make_fmap by using the fact that the phase maps can only be computed if the phase images meets the Nyquist criterion (that there be two samples per cycle of the input). That means that any pixel whose phase shift is greater than pi from the a neighbor exceeds the Nyquist rate* and is either in a susceptibility artifact are at the edge of the brain. make_fmap uses this fact to "edit" the fieldmap by detecting the edges of the brain and setting regions outside the brain to zero.

In the latest release, this "editing" function had to be rewritten because the underlying functions had changed. It works slightly better than its predecessor by sometimes including an extra pixel of valid fieldmap at the edges. The other changes have no effect on accuracy and should be transparent except for a significant improvement in speed.

* This is not strictly true. The actual criterion is that the phase shift not exceed 2*pi in two voxels. In fieldmaps the phase is monotonic and increasing at the edge of the brain. Since the computation is done from the center of the brain out, and voxel with a phase shift greater than pi from one neighbor will have a larger phase shift from its next neighbor, so the much simpler criterion of a phase shift of pi between any two voxels can be used. A phase shift that would shift the image one pixel is roughly equal to pi/7, so a phase shift of pi is very large.

epirecon_ex

Apparently epirecon has a bug since it was originally written in a function that computes the homodyne reconstruction for partial k-space acquisitions. This only occurs for TE<27ms, so we don't encounter this in the average protocol. The problem was that a scale factor was converted to an integer, which would set it to zero if it had a value less than one. This was part of the balky approach to scaling the images that was replaced a couple of years ago. The effect on the images is to set them to zero everywhere. So if any of your studies include EPIs with no brains in them, it was probably caused by this bug even if it is consistent with the subject's behavior.

Novermber 12, 2007

Fieldmap Correction, I/O routines

The following modifications were made:

  • Support was added for data acquired at oblique angles. The fieldmap is resliced to the same plane as the data before correction.
  • Fieldmaps are now written in nifti format, as are all temporary files.
  • The /scratch partition will be used for temporary files if space allows.
  • Checks were added to make sure all input files are valid and output paths are writeable.
  • The cleanup function was updated to remove all temporary files.
  • Last modified July 10, 2009