AFQ.recognition.clustering#

Functions#

_compute_mean_euclidean_matrix(group_n, group_m)

_distance_to_similarity(distance, sigmasq)

_rectangular_similarity_matrix(fgarray_sub, ...)

spectral_atlas_label(sub_fgarray, atlas_fgarray[, ...])

Use an existing atlas to label a new streamlines.

subcluster_by_atlas(sub_trk, mapping, dwi_ref, ...[, ...])

Use an existing atlas to label a new set of streamlines, and return the

Module Contents#

AFQ.recognition.clustering._compute_mean_euclidean_matrix(group_n, group_m)[source]#
AFQ.recognition.clustering._distance_to_similarity(distance, sigmasq)[source]#
AFQ.recognition.clustering._rectangular_similarity_matrix(fgarray_sub, fgarray_atlas, sigma)[source]#
AFQ.recognition.clustering.spectral_atlas_label(sub_fgarray, atlas_fgarray, atlas_data=None, sigma_multiplier=1.0, cluster_indices=None)[source]#

Use an existing atlas to label a new streamlines.

Parameters:
sub_fgarrayndarray

Resampled fiber group to be labeled.

atlas_fgarrayndarray

Resampled atlas to use for labelling.

atlas_datadict, optional

Precomputed atlas data formatted as a dictionary of arrays and floats. See afd.read_org800_templates as a reference.

sigma_multiplierfloat, optional

Multiplier for the sigma value used in computing the similarity matrix. Default is 1.0.

cluster_indiceslist of int, optional

If provided, only these cluster indices from the atlas will be used for labeling. Default is None, which uses all clusters.

Returns:
tuple of (ndarray, ndarray)

Cluster indices for all the fibers and their embedding

AFQ.recognition.clustering.subcluster_by_atlas(sub_trk, mapping, dwi_ref, cluster_indices, atlas_data=None, n_points=20, batch_size=int(50000.0))[source]#

Use an existing atlas to label a new set of streamlines, and return the cluster indices for each streamline.

Parameters:
sub_trkStatefulTractogram

streamlines to be labeled.

mappingDIPY or pyAFQ mapping

Mapping to use to move streamlines.

dwi_refNifti1Image

Image defining reference for where the atlas streamlines move to.

cluster_indiceslist of int

Cluster indices from the atlas to use for labeling.

atlas_datadict, optional

Precomputed atlas data formatted as a dictionary of arrays and floats. See afd.read_org800_templates as a reference.

n_pointsint, optional

Number of points to resample streamlines to for labeling. Default is 20.

batch_sizeint, optional

Number of streamlines to process in a batch. Default is 50,000.