Diagnose tensor orientation problems
Sometimes when processing diffusion MRI data, the DWIs come to us flipped or in a different coordinate system than the b-vectors. This issue manifests itself in orientation problems with the fit tensors, which can be very subtle and hard to detect.
There are two types of mis-orientations:
- Permutations, where e.g. X has been exchanged with Y. These are easy to detect using an RGB-mapped visualization of the tensor field, or even by examining the DWIs if you know the b-vectors.
- Flips, where the images have been mirrored in e.g. X. These are easy to detect using a tensor ellipse visualization or by looking at a tractogram, a fair bit harder to spot by looking at a field of the off-diagonal elements of the tensors, and impossible to spot in an RGB visualization of the tensor field due to the mirror symmetry of the colormap. Since the tensors have three-way mirror symmetry (that is, orientation but not direction matters), only non-axis-aligned tensors display any irregularity when flipped in one dimension.
Since generating streamtubes takes a long time, it is ideal to detect orientation problems just by looking at the tensors, before generating the tubes. However, the effects of incorrect orientation are far more apparent in the tube visualization than in the tensor map.
HOWTO Detect Tensor Orientation Problems
... Before Generating Tubes
- Generate RGB-coded tensor maps with mriatlas:
cdinto the directory of the processed brain you'd like to diagnose.mriatlas -o tensors.pdf voxel_models/tensors- Open up the resulting tensors.pdf in your favorite PDF viewer.
- The color coding is: red = X, green = Y, blue = Z.
- mriatlas specifies slices by the plane's equation, e.g. x = 30. The named dimension is therefore the through-plane direction in the slice you're looking at.
- Check for orientation problems:
- Look at a slightly para-sagittal section; this section should contain the corpus callosum (going through-plane) and cingulum bundle (superior to the CC, running anterior-posterior). Verify that the CC is the appropriate through-plane color.
- If it's the wrong color, you have a permutation.
- Look at a coronal section and make sure that cingulum (which should now be running through-plane) is the appropriate color.
- Again, an incorrect color indicates a permutation.
- Look at a slightly para-sagittal section; this section should contain the corpus callosum (going through-plane) and cingulum bundle (superior to the CC, running anterior-posterior). Verify that the CC is the appropriate through-plane color.
Lots of other groups seem to use planes of diffusion ellipses to diagnose orientation problems, but we don't currently have a way to generate those from tensors in MRIimage format. If we did, we could detect dimension flips before fitting tubes.
... After Generating Tubes
- Generate tubes with
$G/bin/tubegen(check a diffusion processing pipeline Makefile to see how). - View them with Brainapp.
- Check for orientation problems:
- Look at a front view of the tubes through the callosum and make sure they complete a U the goes all the way to the superior cortex. Since the CC is almost always axis-aligned, it rarely visibly breaks.
- If they're broken, you have a flip in either the superior-inferior direction or the left-right direction.
- Look at a top view of tubes and make sure that forceps major and minor complete a pair of U shapes that go anterior and posterior from the callosum.
- If they're broken, you have a flip in either the anterior-posterior direction or the left-right direction.
- Look at a front view of the tubes through the callosum and make sure they complete a U the goes all the way to the superior cortex. Since the CC is almost always axis-aligned, it rarely visibly breaks.
Fixing Problems
There are two ways to correct tensor orientation problems: you can either transform each tensor in place, or you can transform all the DWIs and then re-fit the tensors. Transforming the DWIs is cheaper than transforming the tensors, which is cheaper than fitting the tensors. Therefore there are pros and cons to each approach.
... by Transforming the DWIs
$G/bin/mritransp can perform dimension permutations and flips on DWIs.
- Long-Term Advantage: the next time you get a dataset from the same protocol, you can fix the orientation problem cheaply at the DWI stage and then the tensors that you fit to the DWIs will be correct.
- Total processing (long term) = transform DWIs + fit tensors
- Immediate Disadvantage: when you discover the orientation problem for a single dataset, you have already fit the tensors, so fixing it by modifying the DWIs means you will have to re-fit the tensors, which takes time.
- Total processing (short term) = transform DWIs + fit tensors
... by Transforming the Tensors
$G/bin/mritensormult can perform general transformations on all the tensors in a DTI, leaving the tensors in the same positions but changing their values in place.
- Long-Term Disadvantage: the next time you get a dataset from the same protocol, the same orientation problem will probably be present, and so you will have to correct it, and transforming the tensors is expensive.
- Total processing (long term) = fit tensors + transform tensors
- Immediate Advantage: when you discover the orientation problem for a single dataset, you don't have to re-fit the tensors, which means that you can quickly move on to the next step in the pipeline without waiting.
- Total processing (short term) = transform tensors
Automatic Diagnosis
Automatic diagnosis is beyond our grasp at the moment but in principle it's not impossible, given certain assumptions about the structure that generated the data (that is, that it's a brain). This might be a neat project for someone.