Traco Redesign

I've put together a pull request to help clarify some of the ideas I proposed earlier on this thread.

In this pull request there is an example called newApi.py this example still needs some work, but I hope it will help show how this new tracking framework is meant to be used. In the example I've done some probabilistic tracking with the CSA and CSD models and some deterministic tracking with the CSA model. Be warned that the CSD fitting takes about 45 min.

To describe how this works, in each of the three tracking examples I create a direction getter and a tissue classifier which I pass with seeds and affine and a step_size to LocalTracking.

LocalTracking is an example of what we've been calling a “streamline manager” it tracks each seed and yields a streamline if the streamline doesn't hit any invalid points during tracking.

For the deterministic tracking I've modified the PeaksAndMetrics class to make it a bonefied DirectionGetter. It calls existing cython code that was written for EuDx.

For something to be a  DirectionGetter it needs to subclass from dipy.tracking.local.DirectionGetter and implement a cython cdef method called get_direction. The cython requirement is so the inner tracking loop can be compiled. A DirectionGetter needs to also have an initial_direction method. This method is python for now (but we can change this).

For the probabilist tracking the direction getter is ProbabilisticOdfWightedDirectionGetter (I'm open to a more succinct name). I've written the it in python, but used a cython helper type to make it work. Let me know if anyone wants to hear me rant about how this awesomeness works.

I've implemented one example tissue classifier,  ThresholdTissueClassifier, which like direction getter has a cython method called check_point. This method returns the type of tissue to the streamline manager/framework which then has to decide what to do next.

This PR needs more tests, a better example and there are some corner cases to deal with (literally the interpolation breaks at the corners of the image). But I promised you guys some code so here it is
Ya, I know what you mean, but it really needs to be called by the
constructor, and at some point we decided that peaks was going to be the
constructor for this class.

On Wed, Sep 24, 2014 at 6:31 PM, Stefan van der Walt <
notifications@github.com> wrote:

> In dipy/reconst/_peakdg.pyx:
>
> > +
> > +
> > +cdef class PAMDirectionGetter(DirectionGetter):
> > +
> > +    cdef:
> > +        public double qa_thr, ang_thr, total_weight
> > +        public double[:, :, :, ::1] _qa, _ind
> > +        public double[:, ::1] _odf_vertices
> > +        int initialized
> > +
> > +    def __cinit__(self):
> > +        self.qa_thr = 0.0239
> > +        self.ang_thr = 60
> > +        self.total_weight = .5
> > +
> > +    def _initialize(self):
>
> The reason this caught my attention is because it is being used outside
> the class (e.g. in peaks). If we can avoid such external calls, then it
> should be fine as-is.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/nipy/dipy/pull/341/files#r18011018>.
>