Questions about dirorder

Hi MRTrix-ers,

Hope you guys are doing well.

I would like to use dirorder to downsampling angular resolution from a multi-shell high-angular-resolution dwi. However when I used

dirorder bvecs reorder_bvecs

this command returned [ERROR] unexpected number of columns for directions file “bvecs”. But my bvecs can be successfully recognized by “dirstat”. So I need you help. Thank you very much.

Best regards,
Rui

Apologies, dirorder is indeed not very well documented. It expects as input either a 2-column matrix of [ az el ] pairs, or a 3-column matrix of [ x y z ] triplets (one row per direction). The latter is effectively the transpose of the bvecs¹.

Also, just in case: note that this implies that the directions you’re providing correspond to a single shell. You can’t provide all the directions for a multi-shell scheme and expect the output to be sensible, it won’t know which direction belongs to which shell…


¹ bearing in mind that the bvecs are defined with respect to the image axes, not the scanner / world frame as would typically be expected for MRtrix applications – though this shouldn’t make any difference here.

Hi Jacques-Donald,

As Rui, I’m insterested to downsample a DWI dataset from 64 to 32 directions. I was able to run the dirorder on bvecs file that I previously transposed using python. Two questions:

  • Do you know which mrtrix function that exports ONLY the 3 Cartesian coordinates (mrinfo -grad exports the [x y z bvals]) column-wise?

  • the bvect dirorder output is exactly the same as the input. Does it mean that if I select the first 32 directions I can correctly and homogeneously dowsample the DWI data?

In anticipation, thanks for your atention and time

Diego

No, we don’t provide that functionality, but it’s easy enough with a bit of old-school Unix, for example:

awk '{ print $1, $2, $3 }' < dw_scheme.txt > dirs.txt

Where dw_scheme.txt is a text file in the format produced by mrinfo -dwgrad, and dirs.txt is the output file with only the direction vectors in it.

Feeding the output of that command as its input produces the same output again, so if that’s the case, then yes, I think you can safely assume that you can pick the first N directions and that they would be relatively evenly distributed (within the limits of what can be done when simply picking directions from an existing set).

Dear Jacques-Donald,
Thank you very much for your prompt reply and sorry for the delay in my response. I can cofirm that I correclty picked up the b0 plus the first 30 directions doing this:
mrconvert dwi.mif -coord 3 0:30 dwi30.mif
All the best
Diego

1 Like