[Neuroimaging] [Dipy] discrepancies of SH coeffs with MRtrix

Samuel St-Jean stjeansam at gmail.com
Wed Oct 19 12:48:48 EDT 2016

You might be both right on that, csdeconv itself does not normalize but 
peaks from model does give that option, so that could be it depending on 
how you called the function.

As a sidenote, the mrtrix basis is the mrtrix2 basis (it was written 
before mrtrix3) and they now use an orthonormal basis, so it is 
different from a small normalization factor, sqrt(2) if memory serve, 
but their wiki explains everything also [1].

Other small thing, the way the coefficients are ordered in fnav/dipy and 
mrtrix is different (both for the tensor and SH), so simply using one in 
the other will not directly work, but someone might have the required 
permutation figured out already since the conversion si offered in 
various software packages.

[1] Seems like they changed the location of the doc, here it is 

Le 2016-10-19 à 18:27, Ariel Rokem a écrit :
> Hi Eric,
> Thank you for your message, and for taking the time to figure these 
> things out together.
> On Wed, Oct 19, 2016 at 12:55 AM, Eric Moulton 
> <eric.moulton.jr at gmail.com <mailto:eric.moulton.jr at gmail.com>> wrote:
>     Hello Dipy contributors,
>     I have been playing with Dipy recently in hopes that I can use it
>     as the main tool to process my data. In particular, I have been
>     interested in using MRtrix's mrregister which is linear/non-linear
>     registration technique based on the SH coefficients
>     (http://www.sciencedirect.com/science/article/pii/S1053811911001534#bb0285
>     <http://www.sciencedirect.com/science/article/pii/S1053811911001534#bb0285>).
>     The papers results have reported that the best registration is
>     obtained with lmax = 4, so I have calculated the SH coefficient
>     volumes with Dipy and MRtrix. In Dipy, I did this with
>     peaks_from_model function and making sh_basis_type='mrtrix' and
>     then using the shm_coeff attribute. In MRtrix, I used the dwi2fod
>     function. I can develop on this more if you require more details.
>     In short, both gave me 4D volumes with 15 volumes in the 4th
>     dimension as expected for lmax = 4.
>     The first thing I noticed when I compared the two outputs was that
>     the Y(0,0) volume in Dipy was a single value brain volume where
>     every voxel coefficient was equal to 0.2821 - which is literally
>     the equation for Y(0,0) = 1/sqrt(4*pi) - whereas the Y(0,0) volume
>     had different coefficients for each voxel. I contacted them about
>     this, and they did a really good job explaining it to me
>     (http://community.mrtrix.org/t/first-spherical-harmonic-coefficient-y-0-0-meaning/507/1
>     <http://community.mrtrix.org/t/first-spherical-harmonic-coefficient-y-0-0-meaning/507/1>).
>     In short, they said that Dipy normalizes to the unit integral
>     whereas MRtrix doesn't.
> I'm sorry -- I might be misunderstanding what you -- but I am unable 
> to reproduce this. When I run this example:
> http://nipy.org/dipy/examples_built/reconst_csd.html 
> <http://nipy.org/dipy/examples_built/reconst_csd.html>
> setting the `sh_order` keyword argument of 
> `ConstrainedSphericalDeconvModel` to 4 (line 170), and then plotting 
> the first slice in the `sh_coeff` attribute of the fit object, 
> corresponding to Y(0, 0), I get a spatially varying function, as you 
> would expect.
> Maybe you could tell me what exactly you are doing? Are you by any 
> chance looking at the basis set itself (`csd_model.B_dwi[..., 0]`)? 
> That should be a constant for Y(0,0) -- it's a sphere, after all. And 
> indeed, it's all equal to 1/sqrt(4pi).
> Cheers,
> Ariel
>     As I said, my main goal is to use use mrregister and in particular
>     with the IIT HARDI template
>     (https://www.nitrc.org/frs/?group_id=432
>     <https://www.nitrc.org/frs/?group_id=432>) which has the same
>     MRtrix SH coefficient system (i.e. Y(0,0) is different for every
>     voxel). But to do that with Dipy, I imagine that I would need to
>     have similar SH coeff outputs for my data. I have tried playing
>     with the Dipy code to obtain similar results as with MRtrix
>     (taking out the normalization term in
>     spherical_harmonics(m,n,theta,phi) in dipy/reconst/shm.py, etc.)
>     but I still keep getting a single valued brain for the Y(0,0) term
>     that equals 1/sqrt(4*pi).
>     I was wondering if someone know where this difference in behavior
>     is coming from and where I could look to try to get MRtrix-type
>     outputs for the SH coeffs.
>     Thank you for your time,
>     Eric
>     _______________________________________________
>     Neuroimaging mailing list
>     Neuroimaging at python.org <mailto:Neuroimaging at python.org>
>     https://mail.python.org/mailman/listinfo/neuroimaging
>     <https://mail.python.org/mailman/listinfo/neuroimaging>
> _______________________________________________
> Neuroimaging mailing list
> Neuroimaging at python.org
> https://mail.python.org/mailman/listinfo/neuroimaging

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20161019/d48f4daf/attachment.html>

More information about the Neuroimaging mailing list