Dwifslpreproc

Hello!

I am trying to run the dwifslpreproc but got a “No diffusion gradient table found”. I looked it up online and it mentioned that I have to provide this information using one of the command-line options (-grad or -fslgrad). I tried to do this but didn’t get anything again. Here is my script:

Akilas-MacBook-Air:sub_01 akilasekar$ mrconvert sub1.dwi.nii dwi.mif
mrconvert: [100%] copying from "sub1.dwi.nii" to "dwi.mif"
Akilas-MacBook-Air:sub_01 akilasekar$ dwifslpreproc dwi.mif dwi_pp.mif -rpe_none -pe_dir j
dwifslpreproc: 
dwifslpreproc: Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information.
dwifslpreproc: 
dwifslpreproc: Generated scratch directory: /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwifslpreproc-tmp-GO6P6T/
Command:  mrconvert /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwi.mif /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwifslpreproc-tmp-GO6P6T/dwi.mif -json_export /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwifslpreproc-tmp-GO6P6T/dwi.json
dwifslpreproc: Changing to scratch directory (/Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwifslpreproc-tmp-GO6P6T/)

dwifslpreproc: [ERROR] No diffusion gradient table found
Akilas-MacBook-Air:sub_01 akilasekar$ dwifslpreproc dwi.mif dwi_pp.mif -fslgrad dwi.mif.bvec dw.mif.bval -nocleanup -pe_dir j -rpe_none

dwifslpreproc:

dwifslpreproc: *Note that this script makes use of commands / algorithms that have relevant articles for citation; INCLUDING FROM EXTERNAL SOFTWARE PACKAGES. Please consult the help page (-help option) for more information.*

dwifslpreproc:

dwifslpreproc: *Generated scratch directory: /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwifslpreproc-tmp-353R1G/*

*Command:* mrconvert /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwi.mif /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwifslpreproc-tmp-353R1G/dwi.mif -fslgrad /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwi.mif.bvec /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dw.mif.bval -json_export /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwifslpreproc-tmp-353R1G/dwi.json

dwifslpreproc: **[ERROR] mrconvert /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwi.mif /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwifslpreproc-tmp-353R1G/dwi.mif -fslgrad /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwi.mif.bvec /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dw.mif.bval -json_export /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwifslpreproc-tmp-353R1G/dwi.json** *(dwifslpreproc:182)*

dwifslpreproc: **[ERROR] Information from failed command:**

dwifslpreproc:

mrconvert: [ERROR] input file "/Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwi.mif.bvec" for option "-fslgrad" not found

dwifslpreproc:

dwifslpreproc: **[ERROR] For debugging, inspect contents of scratch directory: /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwifslpreproc-tmp-353R1G/**

dwifslpreproc: *Scratch directory retained; location: /Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwifslpreproc-tmp-353R1G/*

Thanks for the help!

Hi Akila,

While I’m no expert, I believe your problem is that you didn’t supply the diffusion gradient to the mif file when you created it using mrconvert.

The complete command should be

mrconvert -fslgrad file.bvec file.bval file.nii out.mif

So the resulting mif will contain the diffusion gradient provided in the bval and bvec files.

Hi Sebastian,

Thanks for your input! I have B=0 images for my DWI therefore don’t have the bval and .bvec files, any idea how to go about this?

Thanks!

Akila

Hi Akila,

I guess I’m a bit confused why you need to perform dwifslpreproc on b0 images only. Shouldn’t these b0 images be part of the dwi data in the same file (e.g. 64 volumes in which the fist one or two are b0 and the rest are b4000)? Did you prepare the data yourself from scratch from a DICOM converter?

Cheers,

Hi Akila,

The first error message:
dwifslpreproc: [ERROR] No diffusion gradient table found
means that there was neither a diffusion gradient table embedded in the input image header, nor did you explicitly provide one yourself. So providing such information yourself via the -grad or -fslgrad options, or first embedding the gradient table within the image header using mrconvert as suggested by @Sebastian_Quezada1, are both possible solutions.

The second error message:
mrconvert: [ERROR] input file "/Users/akilasekar/Desktop/Cambridge/Data/sub_01/dwi.mif.bvec" for option "-fslgrad" not found
means that the file “dwi.mif.bvec” does not exist. It’s not just a matter of appending “.bvec” and “.bval” to the image file path, you need to actually have those data on your file system.

I think perhaps your statement:

I have B=0 images for my DWI therefore don’t have the bval and .bvec files

may be slightly misleading. Almost all DWI acquisitions will have some b=0 volumes within them. The key point is whether or not you actually have information regarding the gradient table, whether they be within the DICOM headers, or in .bvec / .bval files, or something else. If you literally do not have those data in any form, then you need to go all the way to the point of acquisition to discover what diffusion sensitisation gradients were applied.

An alternative interpretation is that you are in fact attempting to run dwifslpreproc on an image series that contains only b=0 data. This would be quite a strange thing to do. If you really wanted to do this, then you would need to synthesize a gradient table that encodes the fact that for every image volume contained within the b-value is zero. But if you have one image series that contains only b=0 volumes, and elsewhere some other image series that contains b>0 volumes, then most likely you do not want to be executing dwifslpreproc independently on those images; you instead want to be concatenating them together to produce a single 4D image series, and then running dwifslpreproc on that. If you don’t do it this way, then you will have b=0 and b>0 data that are not aligned with one another.

Rob