Cleaning Parameters#
This page documents the configuration options for controlling bundle cleaning in pyAFQ. These parameters can be set in your configuration file or passed as arguments when using the API. 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=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.