I’m new to using MRtrix and I ran into a problem when using the dwi2response command.
dwi2response tournier dwi.mif resp.txt
dwi2response:
dwi2response: Note that this script makes use of commands / algorithms that have relevant articles for citation. Please consult the help page (-help option) for more information.
dwi2response:
dwi2response: Generated temporary directory: /tmp/dwi2response-tmp-SYKG4W/
Command: mrconvert /home/dario/Desktop/20160708_232214_StructuralConnectivity_1_42_E4/dwi.mif - -stride 0,0,0,1 | dwiextract - /tmp/dwi2response-tmp-SYKG4W/dwi.mif
dwi2response:
dwi2response: [ERROR] Command failed: mrconvert /home/dario/Desktop/20160708_232214_StructuralConnectivity_1_42_E4/dwi.mif - -stride 0,0,0,1 | dwiextract - /tmp/dwi2response-tmp-SYKG4W/dwi.mif
dwi2response: Output of failed command:
dwiextract: [ERROR] No dwi volumes present
dwi2response: Changing back to original directory (/home/dario/Desktop/20160708_232214_StructuralConnectivity_1_42_E4)
dwi2response: Script failed while executing the command: mrconvert /home/dario/Desktop/20160708_232214_StructuralConnectivity_1_42_E4/dwi.mif - -stride 0,0,0,1 | dwiextract - /tmp/dwi2response-tmp-SYKG4W/dwi.mif
dwi2response: For debugging, inspect contents of temporary directory: /tmp/dwi2response-tmp-SYKG4W/
If the image did not contain any gradient table at all, this should have resulted in a more specific error message. The fact that it reports “No dwi volumes present” means that MRtrix3 is labeling all volumes within your file as b=0 volumes. This could be either due to that file actually containing b=0 volumes only, or (more likely) that the gradient table has been provided with the incorrect b-value units. The software expects b-values to be defined in s.mm^-2 (e.g. values of 1000 and 3000 are common), while a default threshold of 10 is used to define b=0 volumes, consistent with the DICOM standard. If your b-values are stored as ms.um^-2 (e.g. values of 1 or 3), then all DWI volumes will be erroneously labeled as b=0 volumes, which will lead to this error.
I used mrconvert to convert de DICOM file into a .mif file. It seems, as if during that conversion, the DICOM header information got lost, since the DICOM header shows an intact gradient table…
OK, that’s not good… What scanner was used to acquire the data? Was this a product sequence? If so, is there any chance you could send me the data so I can try and fix the DICOM import?
Ah, OK. In my experience, Bruker DICOM files are problematic on many levels. I’m surprised to hear you say you can find the information in the DICOM headers at all…
OK, the first error is actually slightly misleading: dwiextract: [ERROR] invalid diffusion gradient table dimensions
The second one is more telling: dwiextract: [ERROR] unable to get valid diffusion gradient table for image "/tmp/mrtrix-tmp-4ZimTD.mif"
NIfTI images can’t include the diffusion gradient table in the header. So when you call dwi2response and provide a NIfTI image as input, the script has no way of knowing which volumes correspond to which directions & b-values - hence dwiextract (which is responsible for extracting the b-value shell of interest from the image series) fails. You need to either provide the gradient table from external file(s) using the -grad or -fslgrad options, or use an image format that can embed the gradient table in the image header.
Hello, I ran into a problem when using the dwi2mask command.“dwi2mask: [ERROR] Gradient encoding matrix does not represent a HARDI sequence
” The scanner is also bruker BioSpec. Can you teach me how to process the data from bruker BioSpec?
That particular error suggests that the diffusion gradient scheme has been imported, but the b-values are not arranged in “shells” (i.e. volumes with the same diffusion sensitisation strength but different directions). This is typically the case for “DSI” acquisitions. So you’ll need to determine whether this is in fact the case for your acquired data, or whether something has gone wrong during the importing process that is leading to the error.
The best first step would be to post the output of mrinfo -dwgrad, and describe what you know about the acquisition.
One of the issue with Bruker data is that their DICOM output is (in my experience) not consistent, at least in terms of the diffusion gradient table information. There is a script that now ships with MRtrix3 to convert their raw 2dseq format (convert_bruker, in the scripts/ folder) , but it isn’t perfect either, and can also get the directions wrong (although in this case it’s typically just a matter of inverting or swapping components of the direction vectors). It also doesn’t extract the image orientation, which might be problematic for oblique acquisitions. The other issue is that as far as I can tell from my (limited) research into the Bruker raw format, their conventions change routinely between software versions, making it very tricky to robustly interpret their header information. So the convert_bruker script is provided on a best-effort basis, in the hope that it may help users such as yourself - and if you find ways to improve it, feel free to let us know!
Thank you very much rsmith!!! I did the command and this is the result:
promote:~ admin$ mrinfo -dwgrad /Users/admin/Documents/MATLAB/DICOM
mrinfo: [done] scanning DICOM folder “/Users/admin/Documents/MATLAB/DICOM”
Select series (‘q’ to abort):
0 - 15 MR images unnamed (FLASH (pvm)) [65537]
1 - 12 MR images unnamed (RARE (pvm)) [131073]
2 - 9 MR images unnamed (RARE (pvm)) [196609]
3 - 128 MR images unnamed (FieldMap (pvm)) [262145]
4 - 700 MR images unnamed (DtiEpi (pvm)) [393217]
? 4
mrinfo: [100%] reading DICOM series “”
mrinfo: [ERROR] floating-point sequence specifier is empty
promote:~ admin$
If I used this command in the right way? Dose it means there are no b-value table in the header ? I can get the b-value table which is in the form of “.txt”
Thank you very much !!! I understand what you mean probably,but how can I use the script:joy:. I saw the script just now, should I just copy the script and then past it in the Terminal?
No, it should already be in your PATH if you installed MRtrix3 correctly. It produces a .mih file, which is a text header that MRtrix3 commands can understand, and will load the corresponding raw data given the information in that header. You can then mrconvert that to .mif or .nii if you wish (although the .nii format will lose the DW gradient table information unless you also export the bvecs/bvals using the -export_grad_fsl option).
What did you use to try converting before, just out of interest?
The only sensible point in the code that would throw this particular error message is here - which indeed would indicate that the DW gradient information is missing - or more precisely, the DICOM header contained appropriate tags to store that information, but either the tags were empty, or the information was badly formatted.
which will print out exactly what our DICOM importer managed to extract, without trying to interpret it in any way. Otherwise, you can use dcminfo -all DICOM_FILE, where DICOM_FILE is a single file within your DICOM folder that corresponds to one of the 700 frames from your DtiEpi series, and post the output of that so we can see what was actually written in the raw DICOM headers.
I tried this and the result is this:promote:~ admin$ mrinfo /Users/admin/Documents/MATLAB/DICOM -property dw_scheme
mrinfo: [done] scanning DICOM folder “/Users/admin/Documents/MATLAB/DICOM”
Select series (‘q’ to abort):
0 - 15 MR images unnamed (FLASH (pvm)) [65537]
1 - 12 MR images unnamed (RARE (pvm)) [131073]
2 - 9 MR images unnamed (RARE (pvm)) [196609]
3 - 128 MR images unnamed (FieldMap (pvm)) [262145]
4 - 700 MR images unnamed (DtiEpi (pvm)) [393217]
? 4
mrinfo: [100%] reading DICOM series “”
mrinfo: [WARNING] no “dw_scheme” entries found in “lyf1204depression1 (lyf1204depression1) [MR]” .And the result of the other 4 folder are the same
while the result of this is:
promote:~ admin$ dcminfo -all /Users/admin/Documents/MATLAB/DICOM/1/MRIm001
TYPE GRP ELEM VR SIZE OFFSET NAME CONTENTS