nipy/dipy — pull request #208 by Garyfallidis (2013-06-27 19:09:49+00:00)
Title: Shm coefficients in peaks_from_model

Hello,

Recently, together with JC and Max figure out a problem with large datasets and our odf models. Basically, if you lets say upsample your datasets to go to 1mm isotropic and try to calculate the odf you will most likely get a MemoryError because the odfs will be of about a size 250*250*250*700 where 724 is lets say the number of points on the sphere. Yeah, this is very big indeed.

To overcome this problem rather than returning the ODF we can actually return the spherical harmonic coefficients (shm_coeff) which can represent the entire odf with much fewer parameters. For, example we represent very well the odfs up to many decimals precision using only 45 parameters (sh_order = 8). This technique was available already in sf_to_sh and it was used in the ISBI 2013 challenge.

However, sf_to_sh needs all the odfs as input in order to be efficient as the calculation of invB matrix takes some time. The solution was to actually enable the same idea inside the peaks_from_model function which at the same time calculates many other metrics. In that way we really reduce a lot of computation.

So, now whenever you do

peaks = peaks_from_model(mode, data ...)

you get the odfs as the sh approximation using peaks.shm_coeff.

You can then save those and load them in mitk or fibernav or any other software that supports spherical harmonics.

Enjoy hacking!