siibra.volumes.providers.neuroglancer

Module Contents

Classes

NeuroglancerMesh

A surface mesh provided as neuroglancer precomputed mesh.

NeuroglancerProvider

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

NeuroglancerScale

One scale of a NeuroglancerVolume.

NeuroglancerSurfaceMesh

Only shadows NeuroglancerMesh for the special surface srctype,

NeuroglancerVolume

class siibra.volumes.providers.neuroglancer.NeuroglancerMesh(resource: str | dict, volume=None)
Inheritance diagram of siibra.volumes.providers.neuroglancer.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.neuroglancer.NeuroglancerProvider(url: str | Dict[str, str])
Inheritance diagram of siibra.volumes.providers.neuroglancer.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.neuroglancer.NeuroglancerScale(volume: NeuroglancerProvider, scaleinfo: dict)

One scale of a NeuroglancerVolume.

property affine
property res_mm
color_warning_issued = False
__lt__(other)

Sort scales by resolution.

__repr__()

Return repr(self).

__str__()

Return str(self).

fetch(voi: siibra.locations.boundingbox.BoundingBox = None, **kwargs)
next()

Returns the next scale in this volume, of None if this is the last.

prev()

Returns the previous scale in this volume, or None if this is the first.

resolves(resolution_mm)

Test wether the resolution of this scale is sufficient to provide the given resolution.

class siibra.volumes.providers.neuroglancer.NeuroglancerSurfaceMesh(spec: str, **kwargs)
Inheritance diagram of siibra.volumes.providers.neuroglancer.NeuroglancerSurfaceMesh

Only shadows NeuroglancerMesh for the special surface srctype, which provides a mesh urls plus a mesh index for identifying the surface. Behaves like NeuroglancerMesh otherwise.

TODO this class might be replaced by implementing a default label index for the parent class.

property fragments

Returns the set of fragment names available for the mesh with the given index.

fetch(**kwargs)

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

class siibra.volumes.providers.neuroglancer.NeuroglancerVolume(url: str)
property affine
property dtype
property io
property map_type
property scales
property shape
property transform_nm
MAX_BYTES
USE_CACHE = False
fetch(resolution_mm: float = None, voi: siibra.locations.boundingbox.BoundingBox = None, max_bytes: float = MAX_BYTES, **kwargs)
get_shape(resolution_mm=None, max_bytes: float = MAX_BYTES)
is_float()