siibra.volumes.sparsemap

Represents lists of probabilistic brain region maps.

Classes

SparseIndex

SparseMap

A sparse representation of list of statistical (e.g. probabilistic) brain

Module Contents

class siibra.volumes.sparsemap.SparseIndex
add_img(imgdata: numpy.ndarray, affine: numpy.ndarray)
coords(volume: int)
classmethod from_sparsemap(sparsemap: SparseMap) SparseIndex
classmethod load(filepath_or_url: str) SparseIndex

Loads a precomputed SparseIndex to the memory.

Parameters:

filepath_or_url (str) – Path/url to the SparseIndex files (eg. https://url_to_files/basefilename): - basefilename.sparseindex_v1.probs.txt.gz - basefilename.sparseindex_v1.bboxes.txt.gz - basefilename.sparseindex_v1.voxels.nii.gz

Return type:

SparseIndex

mapped_voxels(volume: int)
max()
save(base_filename: str, folder: str = '')

Save SparseIndex (3x) files to under the folder folder with base_filename. If SparseIndex is not cached, siibra will first create it first.

Parameters:
  • base_filename (str) – The files that will be created as: - base_filename.sparseindex_v1.probs.txt.gz - base_filename.sparseindex_v1.bboxes.txt.gz - base_filename.sparseindex_v1.voxels.nii.gz

  • folder (str, default="") –

affine: numpy.ndarray = None
bboxes = []
property num_volumes
probs = []
shape = None
voxels: numpy.ndarray = None
class siibra.volumes.sparsemap.SparseMap(identifier: str, name: str, space_spec: dict, parcellation_spec: dict, indices: Dict[str, siibra.commons.MapIndex], volumes: list = [], shortname: str = '', description: str = '', modality: str = None, publications: list = [], datasets: list = [], prerelease: bool = False)
Inheritance diagram of siibra.volumes.sparsemap.SparseMap

A sparse representation of list of statistical (e.g. probabilistic) brain region maps.

It represents the 3D statistical maps of N brain regions by two data structures:

  1. ‘spatial_index’, a 3D volume where non-negative values represent unique indices into a list of region assignments

  2. ‘probs’, a list of region assignments where each entry is a dict

More precisely, given i = sparse_index.voxels[x, y, z] we define that

  • if i<0, no brain region is assigned at this location

  • if i>=0, probs[i] defines the probabilities of brain regions.

Each entry in probs is a dictionary that represents the region assignments for the unique voxel where spatial_index == i. The assignment maps from a MapIndex to the actual (probability) value.

property affine
property shape
property sparse_index