# Split dwi

**URL:** <https://community.mrtrix.org/t/split-dwi/1039>\
**Category:** Uncategorized\
**Tags:** preprocessing\
**Created:** [July 18, 2017, 11:29am UTC](https://community.mrtrix.org/t/split-dwi/1039 "2017-07-18T11:29:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucius](https://community.mrtrix.org/user_avatar/community.mrtrix.org/lucius/32/1156_2.png) [@Lucius](https://community.mrtrix.org/u/Lucius)\
**Post date:** [July 18, 2017, 11:29am UTC](https://community.mrtrix.org/t/split-dwi/1039/1 "2017-07-18T11:29:15Z")

</div>

Hi all!

First, thank you very much for that fantastic application.

My problem:

I received a split dwi data set with 2x 923 images, I have no idea why it’s split.  
Now I can use mrcat to combine the datasets, but then I receive 2x bvecs and 2x bvals of course.  
When I want to use the command dwipreproc, the image has twice the amount of diffusion directions, so the command doesn’t work. How can I use both bvecs / bvals? Do I have to use dwipreproc for both sets before mrcat and then combine them?

I guess my question could be interesting in [this topic](https://community.mrtrix.org/t/beginner-combining-two-hardi-acquisitions/1023) as well.

I appreciate your help very much, best regards, Lucius

---

<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:** [July 18, 2017, 12:37pm UTC](https://community.mrtrix.org/t/split-dwi/1039/2 "2017-07-18T12:37:09Z")

</div>

So the simplest here would be to convert each image to a format that can hold the DW scheme in the header (i.e. `.mif`), importing the relevant bvecs/bvals in the process, then using `mrcat` to merge them as per the topic you linked to. So this might look like:

```
mrconvert dwi1.nii -fslgrad bvecs1 bvals1 dwi1.mif
mrconvert dwi2.nii -fslgrad bvecs2 bvals2 dwi2.mif
mrcat dwi1.mif dwi2.mif -axis 3 dwi_all.mif

```

Hopefully that’ll do it…

---

<div class="post-metadata">

**Author:** ![Lucius](https://community.mrtrix.org/user_avatar/community.mrtrix.org/lucius/32/1156_2.png) [@Lucius](https://community.mrtrix.org/u/Lucius)\
**Post date:** [July 18, 2017, 2:16pm UTC](https://community.mrtrix.org/t/split-dwi/1039/3 "2017-07-18T14:16:05Z")

</div>

Thank you ever so much! It worked perfectly.

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [July 18, 2017, 11:58pm UTC](https://community.mrtrix.org/t/split-dwi/1039/4 "2017-07-18T23:58:09Z")

</div>

Just to expand on this slightly: The reason this works is that commands such as `mrcat` can read the diffusion gradient scheme from each individual image header and perform the relevant operation (e.g. concatenation) to these data as well; these data would otherwise be very difficult to handle at the command-line interface.

There’s also a documentation page [here](http://mrtrix.readthedocs.io/en/latest/concepts/dw_scheme.html) on diffusion gradient scheme handling if you’re interested (or if you think it lacks certain information that otherwise may have helped, let us know).

---

<div class="post-metadata">

**Author:** ![Lucius](https://community.mrtrix.org/user_avatar/community.mrtrix.org/lucius/32/1156_2.png) [@Lucius](https://community.mrtrix.org/u/Lucius)\
**Post date:** [August 4, 2017, 6:52am UTC](https://community.mrtrix.org/t/split-dwi/1039/5 "2017-08-04T06:52:17Z")

</div>

Thank you as well, yes I’m interested in the diffusion gradient scheme handling. Right now it seems quite clear in the description.
