A better way to create a response function for CSD

This implementation includes the recursive calibration of the response function for CSD, Using an FA threshold is not a very robust method.It is dependent on the dataset (non-informed used subjectivity), and still depends on the diffusion tensor (FA and first eigenvector), which has low accuracy at high b-value. This function recursively calibrates the response function, for more information see Tax et al. NeuroImage 2014.

This implementation is slow only on one line (788) which calls real_sph_harm. I would appreciate any help to optimize this function. Thx!
Yep - gotcha - sorry about that.


On Thu, Aug 21, 2014 at 10:53 AM, ChantalTax <notifications@github.com>
wrote:

> In dipy/reconst/csdeconv.py:
>
> > +
> > +        csd_peaks = peaks_from_model(model=csd_model,
> > +                                     data=data,
> > +                                     sphere=sphere,
> > +                                     relative_peak_threshold=peak_thr,
> > +                                     min_separation_angle=25,
> > +                                     parallel=parallel)
> > +
> > +        dirs = csd_peaks.peak_dirs
> > +        vals = csd_peaks.peak_values
> > +        single_peak_mask = (vals[:, 1] / vals[:, 0]) < peak_thr
> > +        data = data[single_peak_mask]
> > +        dirs = dirs[single_peak_mask]
> > +
> > +        for num_vox in range(0, data.shape[0]):
> > +            rotmat = vec2vec_rotmat(dirs[num_vox, 0], np.array([0, 0, 1]))
>
> Hey @arokem <https://github.com/arokem>, thanks a lot for your comments!
> I'm not sure if this is the case? I want to rotate the main peak direction
> of every voxel towards the z-axis here. So I actually need to compute the
> rotation matrix that does this for every voxel independently (this is
> rotmat). Then I rotate the gradients accordingly, and fit spherical
> harmonics. Maybe I overlook something, could you perhaps comment on that?
> Thank you!
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/nipy/dipy/pull/404/files#r16555307>.
>