:py:mod:`AFQ.recognition.roi` ============================= .. py:module:: AFQ.recognition.roi Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: AFQ.recognition.roi.check_sls_with_inclusion AFQ.recognition.roi.check_sl_with_inclusion AFQ.recognition.roi.check_sl_with_exclusion AFQ.recognition.roi.clean_by_endpoints .. py:function:: check_sls_with_inclusion(sls, include_rois, include_roi_tols) .. py:function:: check_sl_with_inclusion(sl, include_rois, include_roi_tols) Helper function to check that a streamline is close to a list of inclusion ROIS. .. !! processed by numpydoc !! .. py:function:: check_sl_with_exclusion(sl, exclude_rois, exclude_roi_tols) Helper function to check that a streamline is not too close to a list of exclusion ROIs. .. !! processed by numpydoc !! .. py:function:: clean_by_endpoints(streamlines, target, target_idx, tol=0, flip_sls=None, accepted_idxs=None) Clean a collection of streamlines based on an endpoint ROI. Filters down to only include items that have their start or end points close to the targets. Parameters ---------- streamlines : sequence of N by 3 arrays Where N is number of nodes in the array, the collection of streamlines to filter down to. target: Nifti1Image Nifti1Image containing a boolean representation of the ROI. target_idx: int. Index within each streamline to check if within the target region. Typically 0 for startpoint ROIs or -1 for endpoint ROIs. If using flip_sls, this becomes (len(sl) - this_idx - 1) % len(sl) tol : int, optional A distance tolerance (in units that the coordinates of the streamlines are represented in). Default: 0, which means that the endpoint is exactly in the coordinate of the target ROI. flip_sls : 1d array, optional Length is len(streamlines), whether to flip the streamline. accepted_idxs : 1d array, optional Boolean array, where entries correspond to eachs streamline, and streamlines that pass cleaning will be set to 1. Yields ------- boolean array of streamlines that survive cleaning. .. !! processed by numpydoc !!