AFQ.recognition.cleaning#
Module Contents#
Functions#
  | 
Compute the cardinal orientation of each streamline  | 
  | 
Clean a segmented fiber group based on the Mahalnobis distance of  | 
Attributes#
- AFQ.recognition.cleaning.clean_by_orientation(streamlines, primary_axis, affine, tol=None)[source]#
 Compute the cardinal orientation of each streamline
- Parameters
 - streamlinessequence of N by 3 arrays
 Where N is number of nodes in the array, the collection of streamlines to filter down to.
- Returns
 - cleaned_idx, indicies of streamlines that passed cleaning
 
- AFQ.recognition.cleaning.clean_bundle(tg, n_points=100, clean_rounds=5, distance_threshold=3, length_threshold=4, min_sl=20, stat='mean', return_idx=False)[source]#
 Clean a segmented fiber group based on the Mahalnobis distance of each streamline
- Parameters
 - tgStatefulTractogram class instance or ArraySequence
 A whole-brain tractogram to be segmented.
- n_pointsint, optional
 Number of points to resample streamlines to. Default: 100
- clean_roundsint, optional.
 Number of rounds of cleaning based on the Mahalanobis distance from the mean of extracted bundles. Default: 5
- distance_thresholdfloat, optional.
 Threshold of cleaning based on the Mahalanobis distance (the units are standard deviations). Default: 3.
- length_threshold: float, optional
 Threshold for cleaning based on length (in standard deviations). Length of any streamline should not be more than this number of stdevs from the mean length.
- min_slint, optional.
 Number of streamlines in a bundle under which we will not bother with cleaning outliers. Default: 20.
- statcallable or str, optional.
 The statistic of each node relative to which the Mahalanobis is calculated. Default: np.mean (but can also use median, etc.)
- return_idxbool
 Whether to return indices in the original streamlines. Default: False.
- Returns
 - ——-
 - A StatefulTractogram class instance containing only the streamlines
 - that have a Mahalanobis distance smaller than `clean_threshold` from
 - the mean of each one of the nodes.