Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

3.4.3. fmralign.embeddings.whole_brain.get_adjacency_from_mask

fmralign.embeddings.whole_brain.get_adjacency_from_mask(mask_img, radius)[source]

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)