siibra.volumes.neuroglancer

Handles reading and preparing neuroglancer files.

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

Module Contents

class siibra.volumes.neuroglancer.NeuroglancerMesh(resource: str | dict, volume=None)
Inheritance diagram of siibra.volumes.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

property boundingbox: siibra.locations.boundingbox.BoundingBox
Abstractmethod:

volume = None
class siibra.volumes.neuroglancer.NeuroglancerProvider(url: str | Dict[str, str])
Inheritance diagram of siibra.volumes.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) – Specify the resolution

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

property boundingbox

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

class siibra.volumes.neuroglancer.NeuroglancerScale(volume: NeuroglancerProvider, scaleinfo: dict)

One scale of a NeuroglancerVolume.

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.

property affine
chunk_sizes
color_warning_issued = False
encoding
key
property res_mm
res_nm
size
volume
voxel_offset
class siibra.volumes.neuroglancer.NeuroglancerSurfaceMesh(spec: str, **kwargs)
Inheritance diagram of siibra.volumes.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.

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

property fragments

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

label
class siibra.volumes.neuroglancer.NeuroglancerVolume(url: str)
fetch(resolution_mm: float = None, voi: siibra.locations.boundingbox.BoundingBox = None, **kwargs)
get_shape(resolution_mm=None)
is_float()
property MAX_BYTES

Number of bytes at which an image array is considered to large to fetch

USE_CACHE = False
property affine
property dtype
property map_type
property scales
property shape
property transform_nm
url