-
Notifications
You must be signed in to change notification settings - Fork 0
/
tacking-lt-direction getter.tex
61 lines (54 loc) · 9.4 KB
/
tacking-lt-direction getter.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
\section{Local Tracking Components}
By framing the local tracing problem as one of independent but interacting modules, we're able to focus on the behaviour of the independent components. In this section we discuss how the components of the local tracking model are built, the responsibilities of each component and how the components interact.
\subsection{Direction Getter}
As the name suggests, it is the responsibility of the direction getter to pick tracking directions based on the tissue information at the current tacking location. The first current tracking location is the last point, so far, of the streamline being tracked given relative to the diffusion MRI images. The second piece of available information is the direction of previous streamline segment. This second piece of information is important because it allows crossings, and other complex architectures, to be modeled by the tracking algorithm. When multiple plausible tracking directions are available, the best directions can be chosen contingent on the direction of the previous segment. The direction getter must also be able to provide initial directions for tracking from seed points. Because seed points are used to initialize the tracking procedure, there is no previous segment from which to extract a direction. A direction getter can provide multiple initial directions for a given seed point, for example if the seed point is in a WM structure where axons from different tracts cross. The tracking framework is then responsible for either picking the best of the initial directions or tracking multiple directions and returning a streamline for each of the directions.
Dipy provides several standard direction getters. The function \verb|peaks_from_model|, from \verb|dipy.direction| returns a deterministic direction getter which estimates tracking directions from ODF or FOD peaks. Both q-ball type, which typically estimate ODFs, and spherical deconvolution type, which typically estimate FODs, can be used with this direction getter. Dipy also provides a probabilistic direction getter, \verb|ProbabilisticDirectionGetter|
in \verb|dipy.probabilistic_direction_getter|. This direction getter returns directions stochastically by choosing from a discrete set of predefined directions based on a set of weights. The \verb|ProbabilisticDirectionGetter| is usually constructed using the FODs as those weights. While in principle any function defined on the surface of the sphere can be used to weight the selection probabilities of the tracking directions, ODF functions tend to be too smooth and produce poor tracking results. For that reason, the FODs of spherical deconvolution type models, or similar functions, are typically used with the \verb|ProbabilisticDirectionGetter|.
Dipy also allows users to define their own direction getter class, either in python or in cython. Here are the requirements for implementing a direction getter.
\begin{enumerate}
\item A direction getter should inherit from \verb|DirectionGetter|
from the module \verb|dipy.tracking.local|.
\item A direction getter should implement a \verb|get_direction| method.
\begin{enumerate}
\item The \verb|get_direction| method takes two arguments, \verb|point| and \verb|direction|.
\begin{enumerate}
\item Both arguments are of type \verb|memoryview| with shape \verb|(3,)| and format \verb|'d'|.
\item \verb|point| is the current streamline position in voxel coordinates.
\item \verb|direction| is the direction of the previous tracking step, given as a unit vector.
\end{enumerate}
\item \verb|get_direction| should return \verb|1| if no tracking direction can be established and \verb|0| otherwise.
\item \verb|get_direction| should update \verb|direction| with the next tracking direction if \verb|0| is returned.
\end{enumerate}
\item A direction getter should implement an \verb|initial_direction| method.
\begin{enumerate}
\item The \verb|initial_direction| method takes one argument, \verb|point| similar to \verb|get_direction|.
\item The \verb|initial_direction| method should return an \verb|(N, 3)| array of directions as unit vectors.
\begin{enumerate}
\item These directions should be suitable tracking directions for tracking from seeds at \verb|point|.
\item Because of the antipodal symmetry in diffusion imaging, the directions \verb|x| and \verb|-x| are considered the same. Only one of the directions associated with each pair should be included.
\item If some directions are more suitable for tracking, the directions should be sorted in order of suitability. The most preferred direction first.
\item If no suitable directions can be established, a \verb|(0, 3)| array should be returned.
\end{enumerate}
\end{enumerate}
\end{enumerate}
\subsection{Tissue Classifier}
The tissue classifier is the component of the local tracking model which is aware of the different tissue types in the image. At it's most basic, it is the responsibility of the tissue classifier to terminate streamlines when they leave WM tissues. However, the tissue classifier can also be used to exclude streamlines which pass through tissues which are known not to contain axons. Currently dipy supports four point classes, \verb|TRACKPOINT|, \verb|ENDPOINT|, \verb|INVALIDPOINT|, and \verb|OUTSIDEIMAGE|. The choice of tissue classifier when tracking depends on the imaging and other data available for assessing tissue types. Based on all the available information about anatomical tissues, the tissue classifier must be able to determine which of the above point classes best represents each tracking point.
Dipy currently has several standard tissue classifiers available. The threshold classifier, \verb|ThresholdTissueClassifier| from the module \verb|dipy.tracking.local|, allows metric maps to be used, along with a threshold value, to classify tissues as either WM or not WM. This classifier is a good choice when the user does not have or want to use imaging data in addition to the diffusion MRI data set. In this case, simple metrics like FA or generalized fractional anisotropy (GFA) can identify WM tissues reasonably well. The binary classifier, \verb|BinaryTissueClassifier| from the module \verb|dipy.tracking.local|, allows WM segmentations to be imported as binary masks. This option is a good choice when additional imaging data or better analysis tools are available for producing a white matter segmentation. For example, freesurfer \cite{Dale_1999} or FSL's FAST \cite{Zhang_2001} can be used to identify WM tissues from structural images, and those results can be used for fiber tracking. Lastly, the Anatomically-Constrained Tractography (ACT) classifier, \verb|ActTissueClassifier| from the module \verb|dipy.tracking.local|, allows the use of two probabilistic tissue maps, an include map and an exclude map. This approach allows for a more fine grained classification of streamline points and allows some streamlines to be excluded completely based on the tissues traversed. This classifier is based on work by Smith et. al. \cite{Smith_2012} and Girard et. al. \cite{girard2014towards}.
Dipy also allows a user to define their own tissue classifiers. Here are the requirements for implementing a direction getter
\begin{enumerate}
\item The tissue classifier must inherit from \verb|TissueClassifier| from the module \verb|dipy.tracking.local.tissue_classifier|.
\item The tissue classifier must implement a \verb|check_point| method.
\begin{enumerate}
\item The \verb|check_point| method takes one argument, \verb|point|.
\begin{enumerate}
\item \verb|point| is of type \verb|memoryview| with shape \verb|(3,)| and format \verb|'d'|.
\item \verb|point| is the current streamline position in voxel coordinates.
\end{enumerate}
\item The \verb|check_point| method should return a \verb|TissueClass|.
\begin{enumerate}
\item Currently the four valid tissue classes are: \verb|TRACKPOINT|, \verb|ENDPOINT|, \verb|INVALIDPOINT|, and \verb|OUTSIDEIMAGE|.
\end{enumerate}
\end{enumerate}
\end{enumerate}
\subsection{Local Tracking Class}
The local tracking class implements the basic logic of the local fiber tracking algorithm. In the heart of the local tracking class is the main tracking loop. The main tracking loop uses a direction getter, a tissue classifier, and a seed to produce half a streamline. Because of antipodal symmetry, each seed is tracked in two opposing directions and the results joined to produce each streamline. Appendix \ref{appendix:algo} contains psudo-code for the local tracking algorithm including the basic loop. In dipy, the basic tracking loop is implemented using cython. Because this is the very inner loop of the tracking algorithm, it is important that this part of the code be optimized for performance. By implementing this loop in cython, we're able to compile this piece of the code and call the compiled code from python. Using cython has another major advantage. Because the abstract base classes \verb|DirectionGetter| and \verb|TissueClassifier| are both also defined in cython, their subclasses can implement the direction getter and tissue classifier interfaces either in cython or in python. While implementing these subclasses in python will be slower than using an optimized cython implementation, this design gives users maximum flexibility. For development and testing of new concepts, developing in python allows users to quickly implement and try out different ideas and for many basic use cases, python is often fast enough. However, for performance critical tasks users can implement direction getters and tissue classifiers in cython.