Cleaning Parameters#
This page documents the configuration options for controlling bundle cleaning in pyAFQ. Note that this goes inside of segmentation_params.
Example Usage#
from AFQ.api.group import GroupAFQ
import AFQ.data.fetch as afd
import os.path as op
afd.organize_stanford_data()
myafq = GroupAFQ(
bids_path=op.join(afd.afq_home, 'stanford_hardi'),
preproc_pipeline='vistasoft',
segmentation_params=dict(
cleaning_params=dict(
distance_threshold=5,
length_threshold=5, # More lenient cleaning
))
)
Cleaning Parameter Reference#
- AFQ.recognition.cleaning.clean_bundle(tg, n_points=100, clean_rounds=5, distance_threshold=4, length_threshold=4, min_sl=20, stat=<function mean>, core_only=0.6, return_idx=False, remove_lengths='long')[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: 4.
- 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.)
- core_onlyfloat, optional
If non-zero, only the core of the bundle is used for cleaning. The core is defined as the middle 60% of each streamline, thus our default is 0.6. This means streamlines are allowed to deviate in the starting and ending 20% of the bundle. This is useful for allowing more diverse endpoints. Default: 0.6
- return_idxbool
Whether to return indices in the original streamlines. Default: False.
- remove_lengthsstr
Specifies which streamlines to remove based on their length. Options are “long” (remove long streamlines), “short” (remove short streamlines), or “both” (remove both long and short streamlines). Default: “long”
- 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.