DTIPrep
DTIPrep copied to clipboard
Incorrect gradient directions when B0 is not the first volume
We are using v1.2.4 of DTIPrep.
Several of our users like to concatenate multiple DTI runs together. Generally each run consists of a single B0 volume followed by diffusion-weighted volumes, and this works pretty well. I believe DTIPrep averages the B0 volumes together and the averaged volume is placed where the first B0 volume would have been in the original data, and the rest of the B0 images are removed. In most cases, the diffusion directions are output correctly.
This also generally works if any of the B0 volumes are excluded for poor quality. The averaged volume is placed where the first non-excluded B0 would have been.
However, we've noticed that if it excludes the first B0 volume, the averaged B0 goes where the second B0 would have been (as expected above), BUT the gradient directions are written out with the B0 direction always associated with the first volume.
To illustrate, if our dataset was:
B0a D0a D1a D2a D3a D4a D5a B0b D0b D1b D2b D3b D4b D5b
If no volumes were removed, then the resulting dataset would be:
B0 D0a D1a D2a D3a D4a D5a D0b D1b D2b D3b D4b D5b
where B0 is the average of B0a and B0b.
However, if the B0a was excluded, then the output image data would look like this:
D0a D1a D2a D3a D4a D5a B0b D0b D1b D2b D3b D4b D5b
But the gradient directions in the .nrrd file would be written out as:
B0b D0a D1a D2a D3a D4a D5a D0b D1b D2b D3b D4b D5b
Note that in this case there is only one B0 left so no averaging is done, but I suspect the same thing would happen if there were more than 2 concatenated runs.
One kludge, for subjects where this happens, is to have our users reverse the order of concatenation. This is not an automated workaround, but gets some more data through the gauntlet.
I looked at the source a while back (ca. v1.1.6) but was unable to pinpoint the place where the error was occuring. If anyone has an idea how to fix this, or can point me in the right direction, our users would be very appreciative. Thank you!