AFQ.recognition.roi#

Functions#

_interp_arr_with_affine(roi, arr, affine)

check_sls_with_inclusion(sls, include_rois, ...)

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(fgarray, target, target_idx[, tol, ...])

Clean a collection of streamlines based on an endpoint ROI.

Module Contents#

AFQ.recognition.roi._interp_arr_with_affine(roi, arr, affine)[source]#
AFQ.recognition.roi.check_sls_with_inclusion(sls, include_rois, include_roi_tols)[source]#
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(fgarray, target, target_idx, tol=0, flip_sls=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 ———- fgarray : ndarray of shape (N, M, 3)

Where N is number of streamlines, M is number of nodes. Assumed to be in RASMM space.

target: Nifti1Image

Nifti1Image containing a distance transform 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.

Yields#

boolean array of streamlines that survive cleaning.