siibra.volumes.providers

Subpackage handling the digestion of different volume and mesh types

Submodules

Package Contents

Classes

FreesurferAnnot

Helper class that provides a standard way to create an ABC using

GiftiMesh

One or more surface mesh fragments in Gifti format.

GiftiSurfaceLabeling

A mesh labeling, specified by a gifti file.

NeuroglancerMesh

A surface mesh provided as neuroglancer precomputed mesh.

NeuroglancerProvider

Helper class that provides a standard way to create an ABC using

NiftiProvider

Helper class that provides a standard way to create an ABC using

ZippedFreesurferAnnot

Helper class that provides a standard way to create an ABC using

class siibra.volumes.providers.FreesurferAnnot(url: str | dict)
Inheritance diagram of siibra.volumes.providers.FreesurferAnnot

Helper class that provides a standard way to create an ABC using inheritance.

fetch(fragment: str = None, label: int = None, **kwargs)

Returns a 1D numpy array of label indices.

abstract get_boundingbox(clip=False, background=0.0) siibra.locations.boundingbox.BoundingBox
class siibra.volumes.providers.GiftiMesh(url: str | Dict[str, str], volume=None)
Inheritance diagram of siibra.volumes.providers.GiftiMesh

One or more surface mesh fragments in Gifti format.

property fragments
property variants
fetch(fragment: str = None, **kwargs)

Returns the mesh as a dictionary with two numpy arrays.

Parameters:

fragment (str, default: None) –

A fragment name can be specified to choose from multiple fragments.

Note

If not specified, multiple fragments will be merged into one mesh. In such a case, the verts and faces arrays of different fragments are appended to one another.

Returns:

  • ‘verts’: An Nx3 array of vertex coordinates,

  • ’faces’: an Mx3 array of face definitions using row indices of the vertex array

Return type:

dict

fetch_iter()

Iterator returning all submeshes

Returns:

  • ‘verts’: An Nx3 array of vertex coordinates,

  • ’faces’: an Mx3 array of face definitions using row indices of the vertex array

  • ’name’: Name of the of the mesh variant

Return type:

dict

abstract get_boundingbox(clip=False, background=0.0, **fetch_kwargs) siibra.locations.boundingbox.BoundingBox

Bounding box calculation is not yet implemented for meshes.

class siibra.volumes.providers.GiftiSurfaceLabeling(url: str | dict)
Inheritance diagram of siibra.volumes.providers.GiftiSurfaceLabeling

A mesh labeling, specified by a gifti file.

fetch(fragment: str = None, label: int = None, **kwargs)

Returns a 1D numpy array of label indices.

abstract get_boundingbox(clip=False, background=0.0) siibra.locations.boundingbox.BoundingBox
class siibra.volumes.providers.NeuroglancerMesh(resource: str | dict, volume=None)
Inheritance diagram of siibra.volumes.providers.NeuroglancerMesh

A surface mesh provided as neuroglancer precomputed mesh.

fetch(label: int, fragment: str)

Fetches a particular mesh. Each mesh is a dictionary with keys:

Parameters:
  • label (int) – Label of the volume

  • fragment (str, default: None) –

    A fragment name can be specified to choose from multiple fragments.

    Note

    If not specified, multiple fragments will be merged into one mesh. In such a case, the verts and faces arrays of different fragments are appended to one another.

Returns:

  • ‘verts’: An Nx3 array of vertex coordinates (in nanometer)

  • ’faces’: an MX3 array containing connection data of vertices

  • ’name’: Name of the of the mesh variant

Return type:

dict

abstract get_boundingbox(clip=False, background=0.0, **fetch_kwargs) siibra.locations.boundingbox.BoundingBox

Bounding box calculation is not yet implemented for meshes.

class siibra.volumes.providers.NeuroglancerProvider(url: str | Dict[str, str])
Inheritance diagram of siibra.volumes.providers.NeuroglancerProvider

Helper class that provides a standard way to create an ABC using inheritance.

fetch(fragment: str = None, resolution_mm: float = None, voi: siibra.locations.boundingbox.BoundingBox = None, **kwargs) nibabel.Nifti1Image

Fetch 3D image data from neuroglancer volume.

Parameters:
  • fragment (str, optional) – The name of a fragment volume to fetch, if any. For example, some volumes are split into left and right hemisphere fragments. See fragments()

  • resolution_mm (float, default: None (i.e, lowest)) – Desired resolution in millimeters. .. tip:: Set to -1 to get the highest resolution. (might need to set max_bytes)

  • voi (BoundingBox) – optional specification of a volume of interest to fetch.

  • max_bytes (float: Default: NeuroglancerVolume.MAX_BYTES) – Maximum allowable size (in bytes) for downloading the image. siibra will attempt to find the highest resolution image with a size less than this value.

get_boundingbox(clip=False, background=0, **fetch_kwargs) siibra.locations.boundingbox.BoundingBox

Return the bounding box in physical coordinates of the union of fragments in this neuroglancer volume.

Parameters:
  • clip (bool, default: True) – Whether to clip the background of the volume.

  • background (float, default: 0.0) – The background value to clip. .. note:: To use it, clip must be True.

  • fetch_kwargs – key word arguments that are used for fetchin volumes, such as voi or resolution_mm.

class siibra.volumes.providers.NiftiProvider(src: str | Dict[str, str] | nibabel.Nifti1Image | Tuple[numpy.ndarray, numpy.ndarray])
Inheritance diagram of siibra.volumes.providers.NiftiProvider

Helper class that provides a standard way to create an ABC using inheritance.

property fragments
fetch(fragment: str = None, voi: siibra.locations.boundingbox.BoundingBox = None, label: int = None)

Loads and returns a Nifti1Image object

Parameters:
  • fragment (str) – Optional name of a fragment volume to fetch, if any. For example, some volumes are split into left and right hemisphere fragments. see fragments()

  • voi (BoundingBox) – optional specification of a volume of interest to fetch.

  • label (int, default: None) – Optional: a label index can be provided. Then the mask of the 3D volume will be returned, where voxels matching this label are marked as “1”.

find_peaks(min_distance_mm=5)

Find peaks in the image data.

Parameters:
  • min_distance_mm (float) – Minimum distance between peaks in mm

  • Returns

  • --------

  • PointSet

get_boundingbox(clip=True, background=0, **fetch_kwargs) siibra.locations.boundingbox.BoundingBox

Return the bounding box in physical coordinates of the union of fragments in this nifti volume.

Parameters:
  • clip (bool, default: True) – Whether to clip the background of the volume.

  • background (float, default: 0.0) – The background value to clip. .. note:: To use it, clip must be True.

  • fetch_kwargs – Not used

get_shape(resolution_mm=None)
is_float()
class siibra.volumes.providers.ZippedFreesurferAnnot(url: str | dict)
Inheritance diagram of siibra.volumes.providers.ZippedFreesurferAnnot

Helper class that provides a standard way to create an ABC using inheritance.

fetch(fragment: str = None, label: int = None, **kwargs)

Returns a 1D numpy array of label indices.

abstract get_boundingbox(clip=False, background=0.0) siibra.locations.boundingbox.BoundingBox