# Questions about dirorder

**URL:** https://community.mrtrix.org/t/questions-about-dirorder/4706
**Category:** Uncategorized
**Tags:** preprocessing
**Created:** [March 29, 2021, 1:01am UTC](https://community.mrtrix.org/t/questions-about-dirorder/4706 "2021-03-29T01:01:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ruifate](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/r/8baadc/32.png) [@ruifate](https://community.mrtrix.org/u/ruifate)
#### Post date: [March 29, 2021, 1:01am UTC](https://community.mrtrix.org/t/questions-about-dirorder/4706/1 "2021-03-29T01:01:33Z")

</div>

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

```auto
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

---

<div class="post-metadata">

### Author: ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)
#### Post date: [March 30, 2021, 9:40am UTC](https://community.mrtrix.org/t/questions-about-dirorder/4706/2 "2021-03-30T09:40:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dieloz](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/d/57b2e6/32.png) [@dieloz](https://community.mrtrix.org/u/dieloz)
#### Post date: [March 21, 2022, 10:58am UTC](https://community.mrtrix.org/t/questions-about-dirorder/4706/3 "2022-03-21T10:58:56Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)
#### Post date: [March 21, 2022, 1:03pm UTC](https://community.mrtrix.org/t/questions-about-dirorder/4706/4 "2022-03-21T13:03:33Z")

</div>

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

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

```auto
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.

> [@dieloz](#):
>
> - 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?

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).

---

<div class="post-metadata">

### Author: ![dieloz](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/d/57b2e6/32.png) [@dieloz](https://community.mrtrix.org/u/dieloz)
#### Post date: [March 24, 2022, 8:16am UTC](https://community.mrtrix.org/t/questions-about-dirorder/4706/5 "2022-03-24T08:16:58Z")

</div>

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
