Error running sct_dmri_moco, SCT v4.1.0

Hello @jcohenadad

When running motion correction on DWI sequences using ‘sct_dmri_moco’, I get the following error:

“ERROR in Size of data (1) and size of bvecs (70) are not the same. Check your bvecs file.”

I am not sure how to correct this to move forward.

Thank you in advance for the help!

As the error message states, it looks like you are inputting a 3D volume (as opposed to 4D).

@jcohenadad How do I convert it to a 4D volume?

Thank you!

A diffusion MRI dataset is de facto 4D (i.e. it includes multiple 3D volumes, each being submitted to a particular diffusion gradient direction).

What syntax are you running (to help me identify the type of data you are running this function with)?

@jcohenadad I am running the following in command line on my own dmri data, and run into the aforementioned error at the sct_dmri_moco step:

sct_maths -i dmri.nii.gz -mean t -o dmri_mean.nii.gz
sct_propseg -i dmri_mean.nii.gz -c dwi -qc ~/qc_singleSubj
sct_create_mask -i dmri_mean.nii.gz -p centerline,dmri_mean_seg.nii.gz -size 35mm
sct_crop_image -i dmri.nii.gz -m mask_dmri_mean.nii.gz -o dmri_crop.nii.gz
sct_dmri_moco -i dmri_crop.nii.gz -bvec bvecs.txt

how do you get the file dmri.nii.gz? How do you convert it from Dicom? What scanner do you have? if you have FSL, can you run: fslhd dmri.nii.gz

hum, this is strange, those data are 4D.
can you run:

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

and copy/paste the entire Terminal output (please use ~~~ to format Terminal output).

could you upload the file mask_dmri_mean.nii.gz?

I’d prefer not to upload confidential files online - could I share securely?

sure, you can email it to me (please note that mask_dmri_mean.nii.gz is simply a binary mask)

jcohen “at”

It seems like the file you sent me differs from the one you refer to above. Here is my output of fslhd:

**julien-macbook:** ~/Desktop $ fslhd dmri.nii.gz 
filename dmri.nii.gz
size of header 348
data_type INT16
dim0 3
dim1 146
dim2 146
dim3 20
dim4 1

you notice dim4=1 vs. 70 in this post. Could you please send me the correct dmri image so i can reproduce your analysis?

p.s. i noticed you removed your posts above-- i recovered them as they are important to be able to follow the history of the commands you ran, on what images, etc. You don’t need to worry about displaying sensitive information (this is just the nifti header, not the image itself).

just checking if the issue is solved on your end?

Hi Julien,

Yes, solved on our end! Thank you so much for all of your time and help!