open-discussion > DTIPrep problem with b=0 not in first volume
Showing 1-4 of 4 posts
Display:
Results per page:
Dec 5, 2017  12:12 PM | Giuseppe Cabras - University of Udine
DTIPrep problem with b=0 not in first volume
Hello support for DTIPrep,
I have successfully used DTIPrep 1.2.4 and DWIConvert 1.0 to create a pre-processing pipeline for my local dwi.nii which has a b = 0 to the first volume. Now, I'm trying to pre-process with the same pipeline subjects from a different center that has a b = 0 not in the first volume, but a bit in the middle of dwi.nii 4Dimage. Apparently DTIPrep and DWIConvert work correctly and do the job, but when I look at the output QCed.bval and QCed.bvec, the resulting average b = 0 bval / bvec is in the first element, as expected, while the QCed.nii has the b = 0 NOT in the first volume and, of course, FA, MD and everything is in disarray. Where am I wrong?
Greetings,
Giuseppe
Dec 5, 2017  09:12 PM | Martin Styner
RE: DTIPrep problem with b=0 not in first volume
Hi Giuseppe

Some parts of DTIPrep's code assume that the first (input) DWI image has to be a b=0 image, so you may have to rearrange your DWI volume such that the b=0 is the first volume. You can use the "unu" NRRD tool http://teem.sourceforge.net/unrrdu/ (it's also disseminated with Slicer) for this purpose (I think this can also be done with the fsl tools)

Best
Martin
Dec 6, 2017  10:12 AM | Giuseppe Cabras - University of Udine
RE: DTIPrep problem with b=0 not in first vol
Thanks Martin,
do you know if there is a sample script that use unu for this or similar purpose?
Cheers,
Giuseppe
Dec 7, 2017  05:12 PM | Martin Styner
RE: DTIPrep problem with b=0 not in first vol
There are probably better ways to do this, but I would do it as follows:

Use "unu crop" 3 times to make 3 DWI parts:
a) the DWI's before b=0
b) the b=0 DWI
c) the DWI's after b=0

Assuming that the 4th axis is where your DWI images are indexed in the 4D DWI volume, this would look like, and 30 is the index of your b=0 DWI (starting index 0):

unu crop -i yourfile.nrrd -o part1.nrrd -min 0,0,0,0 -max M,M,M,29
unu crop -i yourfile.nrrd -o part2.nrrd -min 0,0,0,30 -max M,M,M,30
unu crop -i yourfile.nrrd -o part3.nrrd -min 0,0,0,31 -max M,M,M,M

Then use unu join to put these back together

unu join -i part2.nrrd part1.nrrd part3.nrrd -o joined.nrrd

Now, you will have to go end exit the nrrd header to change the informaiton of the gradients in the header (move the 30th diretion to the 0th and update all direction numbers).

I know that's quite ugly, there may be simpler/more elegant solutions out there.

Martin