Error when running DTI analysis

Hi Julien,

I am analyzing DTI images and I am having trouble with one dataset. I can’t see the FA images on FSLeyes and the FA values are showing 0 on the csv file. I repeated the analysis a couple of times with the same result. Below is the code and some of the screenshots:

Here is my code

Compute mean dMRI from dMRI data

sct_maths -i dmri.nii.gz -mean t -o dmri_mean.nii.gz

Segment SC on mean dMRI data

Note: This segmentation does not need to be accurate-- it is only used to create a mask around the cord

sct_propseg -i dmri_mean.nii.gz -c dwi -qc ~/qc_DTI_Cordotomy

Create mask (for subsequent cropping)

sct_create_mask -i dmri_mean.nii.gz -p centerline,dmri_mean_seg.nii.gz -size 35mm

Crop data for faster processing

sct_crop_image -i dmri.nii.gz -m mask_dmri_mean.nii.gz -o dmri_crop.nii.gz

Motion correction (moco)

sct_dmri_moco -i dmri_crop.nii.gz -bvec bvecs.txt

Segment SC on motion-corrected mean dwi data (check results in the QC report)

sct_propseg -i dmri_crop_moco_dwi_mean.nii.gz -c dwi -qc ~/qc_DTI_Cordotomy

Register template->dwi via t2s to account for GM segmentation

sct_register_multimodal -i $SCT_DIR/data/PAM50/template/PAM50_t1.nii.gz -iseg $SCT_DIR/data/PAM50/template/PAM50_cord.nii.gz -d dmri_crop_moco_dwi_mean.nii.gz -dseg dmri_crop_moco_dwi_mean_seg.nii.gz -param step=1,type=seg,algo=centermass:step=2,type=seg,algo=bsplinesyn,slicewise=1,iter=3 -initwarp warp_template2anat.nii.gz -initwarpinv warp_anat2template.nii.gz -qc ~/qc_DTI_Cordotomy

Rename warping fields for clarity

mv warp_PAM50_t12dmri_crop_moco_dwi_mean.nii.gz warp_template2dmri.nii.gz

mv warp_dmri_crop_moco_dwi_mean2PAM50_t1.nii.gz warp_dmri2template.nii.gz

Warp template

sct_warp_template -d dmri_crop_moco_dwi_mean.nii.gz -w warp_template2dmri.nii.gz -qc ~/qc_DTI_Cordotomy

Check results in the QC report


Compute DTI metrics using dipy [1]

sct_dmri_compute_dti -i dmri_crop_moco.nii.gz -bval bvals.txt -bvec bvecs.txt

sct_extract_metric -i dti_FA.nii.gz -z 0:9 -perslice 1 -method map -l 4,5,12,13,51,53,54 -o FAWMlesion.csv

Hi @AdiVeeMiami,

Could you please zip and upload your QC report (folder qc_DTI_Cordotomy/)

Here it is- thanks. (1.3 MB)

that’s not the full QC folder. It should include the index.html file. The folder you need to zip is the one called “qc_DTI_Cordotomy”

Here it is- this QC folder has the analysis for this (436.4 KB)

hum, nothing looks suspicious from the QC report. Could you copy/paste your terminal output: not just the syntax you ran but also the output, so I can spot if there was an error at some point. If this is too big you can just copy it in a txt file and upload it here.

Thanks- here it is. DTI_query_code.rtf (52.6 KB)

could you please upload dti_FA.nii.gz as well your warped template folder: label/ (zip it before uploading it)? (461.8 KB) dti_FA.nii.gz (637 Bytes)

ok, the dti_FA.nii.gz is the culprit (zeros everywhere, as you already pointed out). Could you upload:

  • dmri_crop_moco.nii.gz
  • bvals.txt
  • bvecs.txt

dmri_crop_moco.nii.gz (497.7 KB) bvals.txt (27 Bytes) bvecs.txt (314 Bytes)

Your bvals.txt file is wrong, it contains only zeros:

0 0 0 0 0 0 0 0 0 0 0 0 0 

Looking at your DWI data, the first volume is the b=0, however the other volumes are clearly diffusion-weighted, which should be reflected in your bvals.txt file. How did you generate this file? I recommend you use dcm2niix for converting your DICOM images to NIfTI files (which also generates the bvecs/bvals).

Thanks for your help. I used MRIconvert- it worked well for 6 other datasets and generated working bval and bvec files.

I used to use dcm2nii but the GUI doesn’t work with the new OS.
Does this work with terminal too?

Is there a specific code that I need to run to convert the DICOM images and get bval and bvec files using dcm2niix? Thanks a lot for your help!

I used to use dcm2nii but the GUI doesn’t work with the new OS.
Does this work with terminal too?

It only works with the Terminal. Usage is very easy, see here.

Perfect - thanks!