# Problem in perfoming MSMT constrained spherical deconvolution

**URL:** <https://community.mrtrix.org/t/problem-in-perfoming-msmt-constrained-spherical-deconvolution/376>\
**Category:** Uncategorized\
**Created:** [August 6, 2016, 3:00am UTC](https://community.mrtrix.org/t/problem-in-perfoming-msmt-constrained-spherical-deconvolution/376 "2016-08-06T03:00:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bwlee89](https://community.mrtrix.org/user_avatar/community.mrtrix.org/bwlee89/32/213_2.png) [@bwlee89](https://community.mrtrix.org/u/bwlee89)\
**Post date:** [August 6, 2016, 3:00am UTC](https://community.mrtrix.org/t/problem-in-perfoming-msmt-constrained-spherical-deconvolution/376/1 "2016-08-06T03:00:48Z")

</div>

Dear Matrix Experts,

I’m trying to follow the HCP tutorial: [http://mrtrix.readthedocs.io/en/0.3.16/tutorials/hcp\_connectome.html](http://mrtrix.readthedocs.io/en/0.3.16/tutorials/hcp_connectome.html) \*

and now facing a problem with performing multi-shell, multi-tissue constrained spherical deconvolution.

I ran the following command:

dwi2fod msmt\_5tt DWI.mif RF\_WM.txt WM\_FODs.mif RF\_GM.txt GM.mif RF\_CSF.txt CSF.mif -mask nodif\_brain\_mask.nii.gz

but got an error as follows:

dwi2fod: [100%] uncompressing image “nodif\_brain\_mask.nii.gz”  
dwi2fod: [ERROR] unexpected value supplied for argument “algorithm” (valid choices are: csd, msmt\_csd)

So I used msmt\_csd instead of msmt\_5tt and WM\_FODs.mif, GM.mif, CSF.mif, was created.  
After that, I ran the following command:

mrconvert WM\_FODs.mif - -coord 3 0 | mrcat CSF.mif GM.mif - tissueRGB.mif -axis 3

and had this following warning

[WARNING] Diffusion encoding of input file does not match number of image volumes; omitting gradient information from output image

I first ignored this warning and went through all the step to connectome generation (tck2connectome).  
But when I tried to visualize with mrview with following command:

mrview nodes\_fixSGM.mif -connectome.init nodes\_fixSGM.mif -connectome.load connectome.csv

I got this error massage:

mrview: [ERROR] Input parcellation image must have an integer datatype; try running mrconvert -datatype uint32  
mrview: [ERROR] Connectome matrix contains 84 nodes; expected 0

I guess this error is due to the ignoring the warning appeared during diffusion image processing.  
Is it because I used msmt\_csd instead of msmt\_5tt? (but the command dwi2fod msmt\_5tt DWI.mif … didn’t work for me)

Thanks 🙂  
Lee

\*now located at [Processing of HCP data](https://community.mrtrix.org/t/processing-of-hcp-data/2241)

---

<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:** [August 6, 2016, 5:14am UTC](https://community.mrtrix.org/t/problem-in-perfoming-msmt-constrained-spherical-deconvolution/376/2 "2016-08-06T05:14:24Z")

</div>

Hi Lee,

> `dwi2fod: [ERROR] unexpected value supplied for argument "algorithm" (valid choices are: csd, msmt_csd)`

That’s me stnanking the documentation in light of the [most recent tagged update](http://community.mrtrix.org/t/mrtrix3-version-incremented-to-0-3-15/300/1). `dwi2response` has an algorithm called ‘`msmt_5tt`’, named such because it uses a five-tissue-type (5TT) image to assist in determining appropriate tissue response functions for the MSMT algorithm. But longer-term, this will not be the _exclusive_ algorithm for determining response functions for the MSMT algorithm. In `dwi2fod`, the algorithm is referred to as `msmt_csd`.

Thankfully the terminal error pointed you in the right direction, but thanks for letting us know: I’ll fix the documentation imminently.

> `[WARNING] Diffusion encoding of input file does not match number of image volumes; omitting gradient information from output image`

The _MRtrix3_ developers have had multiple internal arguments about this issue. What’s happening here is:

- _MRtrix3_ will store the diffusion gradient table within the image header where possible. In this particular example, these data are used by `dwi2fod`.

- These data are also propagated through to the image(s) output by `dwi2fod`. Note however that these images are not diffusion volumes, but represent coefficients in the spherical harmonic basis. Therefore, the number of volumes in such an FOD image will almost always differ from the number of DWIs (and hence the number of entries in the diffusion gradient table).

- Later, when you run `mrconvert -coord 3 #`, the `mrconvert` command observes that you are extracting a subset of image volumes, and tries to extract only the appropriate corresponding entries in your diffusion gradient table. But it can’t do this unambiguously, since there is a mismatch between the number of diffusion gradient table entries, and the number of image volumes. Therefore, it _discards_ the gradient table, and warns you that it is doing so.

Some argue that the diffusion gradient table is no longer relevant / necessary if an image contains spherical harmonic coefficients, and will inevitably result in ambiguous cases and corresponding warnings such as this, and should therefore be erased from the image header by `dwi2fod`. Others argue that knowing the diffusion gradient table that was used in deriving a spherical harmonic representation may still be useful later on.

We welcome user feedback regarding what people think is the most intuitive / useful behaviour here.

> `mrview: [ERROR] Input parcellation image must have an integer datatype; try running mrconvert -datatype uint32 mrview: [ERROR] Connectome matrix contains 84 nodes; expected 0`

This is not to do with the diffusion image processing, but the parcellation image `nodes_fixSGM.mif`. A ‘label image’ must by design contain integer values corresponding to different parcels. Therefore, the `mrview` connectome tool will refuse to be initialised by an image that is stored using a floating-point value type. Note that it’s possible for an image to in fact contain only integer values, despite using a floating-point data representation; but I chose to instead enforce the data type of the image when used as the parcellation image in the `mrview` connectome tool, as a way of guaranteeing that an appropriate image is being provided.

Short-term, you can use the suggestion contained within the terminal error message to fix the problem:

```auto
mrconvert nodes_fixSGM.mif nodes_fixSGM_int.mif -datatype uint32

```

Longer-term, I’ll need to figure out where the issue is arising and fix it. `labelconvert` [explicitly makes the output image an integer type](https://github.com/MRtrix3/mrtrix3/blob/master/cmd/labelconvert.cpp#L91) for precisely this reason, so there must be a command being used within the `labelsgmfix` script that is setting the image type back to floating-point.

The second error line:

```auto
mrview: [ERROR] Connectome matrix contains 84 nodes; expected 0

```

is a red herring. That’s `mrview` loading your connectome matrix, and checking to see if it has the same number of rows/columns as your parcellation image has parcels; but because the parcellation image didn’t load properly, there’s an inevitable mismatch between these two quantities.

Thanks for the reports, and welcome to the forum!  
Rob

---

<div class="post-metadata">

**Author:** ![bwlee89](https://community.mrtrix.org/user_avatar/community.mrtrix.org/bwlee89/32/213_2.png) [@bwlee89](https://community.mrtrix.org/u/bwlee89)\
**Post date:** [August 6, 2016, 6:50am UTC](https://community.mrtrix.org/t/problem-in-perfoming-msmt-constrained-spherical-deconvolution/376/3 "2016-08-06T06:50:45Z")

</div>

Thanks for your help Rob.  
Now it runs without any errors 🙂

Thanks again.  
Lee
