siibra.volumes.sparsemap
Represents lists of probabilistic brain region maps.
Classes
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:
- 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.
- 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)
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:
‘spatial_index’, a 3D volume where non-negative values represent unique indices into a list of region assignments
‘probs’, a list of region assignments where each entry is a dict
More precisely, given
i = sparse_index.voxels[x, y, z]
we define thatif 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