3. Reference documentation

This is the class and function reference of fmralign. Please refer to the full user guide for further details, as the class and function raw specifications may not be enough to give full guidelines on their uses.

3.1. fmralign.alignment.pairwise_alignment: Pairwise Alignment

Classes:

PairwiseAlignment([method, labels, n_jobs, ...])

Performs pairwise alignment between two subjects.

3.2. fmralign.alignment.group_alignment: Group Alignment

Classes:

GroupAlignment([method, labels, n_jobs, ...])

Performs group-level alignment of various subject data.

3.3. fmralign.methods: Alignment Methods

Classes:

Identity()

Compute no alignment, used as baseline for benchmarks : RX = X.

DetSRM([n_components])

Compute the alignment from one subjects to the shared latent response.

Procrustes([scaling])

Compute a orthogonal mixing matrix R and a scaling sc.

RidgeAlignment([alphas, cv])

Compute a scikit-estimator R using a mixing matrix M s.t Frobenius norm || XM - Y ||^2 + alpha * ||M||^2 is minimized.

OptimalTransport([solver, metric, reg, ...])

Compute the optimal coupling between X and Y with entropic regularization, using the pure Python POT (https://pythonot.github.io/) package.

3.4. fmralign.embeddings: Embedding Methods

Functions:

connectivity.get_connectivity_features(labels)

Compute connectivity features for a single subject.

Parameters:
data: array-like of shape (n_samples, n_voxels)
labels: array-like of shape (n_voxels,)

Labels for connectivity seeds.

Returns:
correlation_features: array-like of shape (n_labels, n_voxels)

Connectivity features computed as the correlation between averaged signals within each parcel and the original data.

parcellation.get_labels(masker, n_pieces=1, clustering='ward', smoothing_fwhm=5, verbose=0)

Generate an array of labels for each voxel in the data.

Use nilearn Parcellation class in our pipeline. It is used to find local regions of the brain in which alignment will be later applied. For alignment computational efficiency, regions should be of hundreds of voxels.

Parameters:
imgs: Niimgs

data to cluster

n_pieces: int

number of different labels

masker: a fitted instance of NiftiMasker or MultiNiftiMasker

Masker to be used on the data. For more information see: http://nilearn.github.io/manipulating_images/masker_objects.html

clustering: string or 3D Niimg

If you aim for speed, choose k-means (and check kmeans_smoothing_fwhm parameter) If you want spatially connected and/or reproducible regions use ‘ward’ If you want balanced clusters (especially from timeseries) used ‘hierarchical_kmeans’ If 3D Niimg, image used as predefined clustering, n_pieces is ignored

smoothing_fwhm: None or int

By default 5mm smoothing will be applied before kmeans clustering to have more compact clusters (but this will not change the data later). To disable this option, this parameter should be None.

verbose: int, default=0

Verbosity level.

Returns:
labelslist of ints (len n_features)

Parcellation of features in clusters

whole_brain.get_adjacency_from_mask(radius)

Creates a sparse adjacency matrix from a mask image where each voxel is connected to its neighbors within a specified radius.

Parameters:
mask_img: 3D Nifti1Image

Mask image to define the voxels.

radius: float

Radius in mm to define the neighborhood for each voxel.

Returns:
sparse_matrix: sparse torch.Tensor of shape (n_voxels, n_voxels)