# Amp2sh for multi-shell dMRI

**URL:** <https://community.mrtrix.org/t/amp2sh-for-multi-shell-dmri/4020>\
**Category:** Uncategorized\
**Created:** [August 24, 2020, 1:06pm UTC](https://community.mrtrix.org/t/amp2sh-for-multi-shell-dmri/4020 "2020-08-24T13:06:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oeslle](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/o/958977/32.png) [@Oeslle](https://community.mrtrix.org/u/Oeslle)\
**Post date:** [August 24, 2020, 1:06pm UTC](https://community.mrtrix.org/t/amp2sh-for-multi-shell-dmri/4020/1 "2020-08-24T13:06:02Z")

</div>

Hi MRtrix experts!

I recently try to compute the SH coefficients for a subject from the HCP. I tried the following command.

`amp2sh dwi_mif dwi_sh_mif -lmax 8 -shells 1000,2000 -force`

But I got the following error:

`amp2sh: [ERROR] User selected 2 non b=0 shells, but the command requires single-shell data`

Is there anything I am missing out in order to use this command for multi-shell dMRI? Based on this [post](https://community.mrtrix.org/t/spherical-harmonic-coeffs-to-dwi-images/2014/4) the fitting is done per shell and if I use the b0 zero as a second shell it works.

Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![bjeurissen](https://community.mrtrix.org/user_avatar/community.mrtrix.org/bjeurissen/32/28_2.png) [@bjeurissen](https://community.mrtrix.org/u/bjeurissen)\
**Post date:** [August 24, 2020, 3:42pm UTC](https://community.mrtrix.org/t/amp2sh-for-multi-shell-dmri/4020/2 "2020-08-24T15:42:07Z")

</div>

Hi!

You simply have to calculate the SH coefficients for each shell individually as follows:

```auto
amp2sh dwi.mif -shells 1000 dwi_sh_1000.mif
amp2sh dwi.mif -shells 2000 dwi_sh_2000.mif
amp2sh dwi.mif -shells 3000 dwi_sh_3000.mif

```

Hope that helps!

---

<div class="post-metadata">

**Author:** ![Oeslle](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/o/958977/32.png) [@Oeslle](https://community.mrtrix.org/u/Oeslle)\
**Post date:** [August 25, 2020, 10:51am UTC](https://community.mrtrix.org/t/amp2sh-for-multi-shell-dmri/4020/3 "2020-08-25T10:51:17Z")

</div>

Hi @bjeurissen,

Thank you for the very quick response!  
I would like to take advantage of the multi-shell acquisition to compute the SH coefficients. From what I understood, doing what you suggested will give me 3 files for the SH coefficients.  
Is there a way I can combine these files into a single one? Or the only way is to use `dwi2fod` to compute the FOD coefficients?

Many thanks,

---

<div class="post-metadata">

**Author:** ![bjeurissen](https://community.mrtrix.org/user_avatar/community.mrtrix.org/bjeurissen/32/28_2.png) [@bjeurissen](https://community.mrtrix.org/u/bjeurissen)\
**Post date:** [August 25, 2020, 12:16pm UTC](https://community.mrtrix.org/t/amp2sh-for-multi-shell-dmri/4020/4 "2020-08-25T12:16:56Z")

</div>

> [@Oeslle](#):
>
> I would like to take advantage of the multi-shell acquisition to compute the SH coefficients. From what I understood, doing what you suggested will give me 3 files for the SH coefficients.
> 
> Is there a way I can combine these files into a single one?

This is not how spherical harmonics work… they represent functions _on the sphere_ (so no dependency on b-value). If you want to model the diffusion MRI signal using a straight SH representation you will have to do that _per shell_.

> [@Oeslle](#):
>
> Or the only way is to use `dwi2fod` to compute the FOD coefficients?

Yes, but be aware that this approach produces the SH coefficients of the _FOD_ rather than the raw dMRI signal (as you were trying to achieve above). I am not sure what your use case is, but usually, the SH coefficients of the FOD are exactly what one is after as they capture the properties of the microstructure rather than those of the raw signal.

---

<div class="post-metadata">

**Author:** ![Oeslle](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/o/958977/32.png) [@Oeslle](https://community.mrtrix.org/u/Oeslle)\
**Post date:** [August 25, 2020, 12:31pm UTC](https://community.mrtrix.org/t/amp2sh-for-multi-shell-dmri/4020/5 "2020-08-25T12:31:32Z")

</div>

> @bjeurissen  
> This is not how spherical harmonics work… they represent functions _on the sphere_ (so no dependency on b-value). If you want to model the diffusion MRI signal using a straight SH representation you will have to do that _per shell_.

Thanks for explaining it. What I meant is that I want to have all the dMRI signal for all shells represented in SH functions in a single file. If that is not possible I might pick only one shell in the end.

> @bjeurissen  
> Yes, but be aware that this approach produces the SH coefficients of the _FOD_ rather than the raw dMRI signal (as you were trying to achieve above). I am not sure what your use case is, but usually, the SH coefficients of the FOD are exactly what one is after as they capture the properties of the microstructure rather than those of the raw signal.

So far, I just want t to represent the raw signal in SH functions. If I can manage to do that for multi-shell dMRI It would be perfect. Otherwise, I can use `amp2sh` on one shell only. I am trying to avoid to produce the SH coefficients of the _FOD_.

---

<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:** [September 9, 2020, 2:01am UTC](https://community.mrtrix.org/t/amp2sh-for-multi-shell-dmri/4020/6 "2020-09-09T02:01:34Z")

</div>

Hi @Oeslle,

Sounds like you’re inadvertently touching on a topic that is still somewhat of a moving target in _MRtrix3_ development: how to represent and manipulate multiple spherical functions within a single image. This is a capability that will be increasingly utilised in the future, especially once @dchristiaens’s [SHARD reconstruction](https://arxiv.org/abs/1905.02996) makes its way into the software. But right now the capabilities for handling such are severely limited.

You can see in [this Pull Request](https://github.com/MRtrix3/mrtrix3/pull/1617) (the contents of which were included in the 3.0.0 release) that the `shconv` and `sh2amp` commands are already compatible with such data, where the fifth image dimension is used to encode _b_-value shell. The fact that the `amp2sh` command does _not_ possess the corresponding capability should be considered a feature gap, and would be an entirely reasonable feature request if you wish to add it to the [GitHub image list](https://github.com/MRtrix3/mrtrix3/issues) yourself (or we can add it for you).

The functionality would essentially be equivalent to running `amp2sh` multiple times, manually specifying each _b_-value in succession using the `-shell` option (as shown by @bjeurissen), ensuring that the `lmax` is identical for all shells, and then running `mrcat` to concatenate the results along the fifth image dimension. Note however that the only commands that would be capable of reading and interpreting such an image as intended would be `shconv` and `sh2amp`; even loading that SH image in the `mrview` ODF plot tool, there is not yet the capability to toggle the visualisation between shells within the interface. So while you _can_ do it, you may not actually get any benefit from such currently.

Cheers  
Rob

---

<div class="post-metadata">

**Author:** ![Oeslle](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/o/958977/32.png) [@Oeslle](https://community.mrtrix.org/u/Oeslle)\
**Post date:** [October 8, 2020, 10:50am UTC](https://community.mrtrix.org/t/amp2sh-for-multi-shell-dmri/4020/7 "2020-10-08T10:50:20Z")

</div>

Hi @rsmith,

Thank you for much for a very detailed clarification! I will have a look at SHARD representation too.

Many Thanks,  
Oeslle
