AFQ.recognition.recognize
#
Module Contents#
Functions#
|
Segment streamlines into bundles. |
|
Helper function to return an empty dict under |
|
Helper function to add a bundle to a fiber group. |
|
Attributes#
- AFQ.recognition.recognize.recognize(tg, img, mapping, bundle_dict, reg_template, nb_points=False, nb_streamlines=False, clip_edges=False, parallel_segmentation={'engine': 'serial'}, rb_recognize_params=dict(model_clust_thr=1.25, reduction_thr=25, pruning_thr=12), refine_reco=False, prob_threshold=0, dist_to_waypoint=None, rng=None, return_idx=False, filter_by_endpoints=True, dist_to_atlas=4, save_intermediates=None, cleaning_params={})[source]#
Segment streamlines into bundles.
- Parameters
- tgstr, StatefulTractogram
Tractogram to segment.
- imgstr, nib.Nifti1Image
Image for reference.
- mappingMappingDefinition
Mapping from subject to template.
- bundle_dictdict or AFQ.api.BundleDict
Dictionary of bundles to segment.
- reg_templatestr, nib.Nifti1Image
Template image for registration.
- nb_pointsint, boolean
Resample streamlines to nb_points number of points. If False, no resampling is done. Default: False
- nb_streamlinesint, boolean
Subsample streamlines to nb_streamlines. If False, no subsampling is don. Default: False
- clip_edgesbool
Whether to clip the streamlines to be only in between the ROIs. Default: False
- parallel_segmentationdict or AFQ.api.BundleDict
How to parallelize segmentation across processes when performing waypoint ROI segmentation. Set to {“engine”: “serial”} to not perform parallelization. Some engines may cause errors, depending on the system. See
dipy.utils.parallel.paramap
for details. Default: {“engine”: “serial”}- rb_recognize_paramsdict
RecoBundles parameters for the recognize function. Default: dict(model_clust_thr=1.25, reduction_thr=25, pruning_thr=12)
- refine_recobool
Whether to refine the RecoBundles segmentation. Default: False
- prob_thresholdfloat.
Using AFQ Algorithm. Initial cleaning of fiber groups is done using probability maps from [Hua2008]. Here, we choose an average probability that needs to be exceeded for an individual streamline to be retained. Default: 0.
- dist_to_waypointfloat.
The distance that a streamline node has to be from the waypoint ROI in order to be included or excluded. If set to None (default), will be calculated as the center-to-corner distance of the voxel in the diffusion data. If a bundle has inc_addtol or exc_addtol in its bundle_dict, that tolerance will be added to this distance. For example, if you wanted to increase tolerance for the right arcuate waypoint ROIs by 3 each, you could make the following modification to your bundle_dict: bundle_dict[“Right Arcuate”][“inc_addtol”] = [3, 3] Additional tolerances can also be negative. Default: None.
- rngRandomState or int
If None, creates RandomState. If int, creates RandomState with seed rng. Used in RecoBundles Algorithm. Default: None.
- return_idxbool
Whether to return the indices in the original streamlines as part of the output of segmentation. Default: False.
- filter_by_endpoints: bool
Whether to filter the bundles based on their endpoints. Default: True.
- dist_to_atlasfloat
If filter_by_endpoints is True, this is the required distance from the endpoints to the atlas ROIs. Default: 4
- save_intermediatesstr, optional
The full path to a folder into which intermediate products are saved. Default: None, means no saving of intermediates.
- cleaning_paramsdict, optional
Cleaning params to pass to seg.clean_bundle. This will override the default parameters of that method. However, this can be overriden by setting the cleaning parameters in the bundle_dict. Default: {}.
References
- Hua2008
Hua K, Zhang J, Wakana S, Jiang H, Li X, et al. (2008)
Tract probability maps in stereotaxic spaces: analyses of white matter anatomy and tract-specific quantification. Neuroimage 39: 336-347 .. [R1b00de68c4c9-Yeatman2012] Yeatman, Jason D., Robert F. Dougherty, Nathaniel J. Myall, Brian A. Wandell, and Heidi M. Feldman. 2012. “Tract Profiles of White Matter Properties: Automating Fiber-Tract Quantification” PloS One 7 (11): e49790. .. [R1b00de68c4c9-Garyfallidis17] Garyfallidis et al. Recognition of white matter bundles using local and global streamline-based registration and clustering, Neuroimage, 2017.
- AFQ.recognition.recognize._return_empty(bundle_name, return_idx, fiber_groups, img)[source]#
Helper function to return an empty dict under some conditions.