AFQ.recognition.roi#

Module Contents#

Functions#

check_sls_with_inclusion(sls, include_rois, ...)

check_sl_with_inclusion(sl, include_rois, include_roi_tols)

Helper function to check that a streamline is close to a list of

check_sl_with_exclusion(sl, exclude_rois, exclude_roi_tols)

Helper function to check that a streamline is not too close to a

clean_by_endpoints(streamlines, target, target_idx[, ...])

Clean a collection of streamlines based on an endpoint ROI.

AFQ.recognition.roi.check_sls_with_inclusion(sls, include_rois, include_roi_tols)[source]#
AFQ.recognition.roi.check_sl_with_inclusion(sl, include_rois, include_roi_tols)[source]#

Helper function to check that a streamline is close to a list of inclusion ROIS.

AFQ.recognition.roi.check_sl_with_exclusion(sl, exclude_rois, exclude_roi_tols)[source]#

Helper function to check that a streamline is not too close to a list of exclusion ROIs.

AFQ.recognition.roi.clean_by_endpoints(streamlines, target, target_idx, tol=0, flip_sls=None, accepted_idxs=None)[source]#

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)

tolint, 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_sls1d array, optional

Length is len(streamlines), whether to flip the streamline.

accepted_idxs1d 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.