Skip to content

datasources

ngtools.datasources

Wrappers around neuroglancer classes that can compute metadata and optional attributes that neuroglancer typically delegates to the frontend.

Dependencies
  • nifti:// -> nibabel
  • zarr:// -> zarr
  • precomputed:// -> cloudvolume

LayerDataSources

LayerDataSources(*args, **kwargs)

Bases: Wraps(LayerDataSources)

List of data sources.

DataSourceInfo

Base class for source-specific metadata.

LayerDataSource

LayerDataSource(*args, **kwargs)

Bases: Wraps(LayerDataSource)

A wrapper around ng.LayerDataSource that computes metadata.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

VolumeInfo

VolumeInfo(url)

Bases: DataSourceInfo

Base class for volume metadata.

Parameters:

Name Type Description Default
url str

URL to the file

required

getNbLevels

getNbLevels()

Compute number of dimensions.

getShape

getShape(level=0)

Compute array shape.

getRank

getRank()

Compute number of dimensions.

getSlopeInter

getSlopeInter()

Affine intensity scaling.

getInputNames

getInputNames()

Compute names of input axes.

getOutputNames

getOutputNames()

Compute names of output axes.

getInputUnits

getInputUnits()

Compute all units.

getOutputUnits

getOutputUnits()

Compute all units.

getInputScales

getInputScales()

Compute input scales.

getOutputScales

getOutputScales()

Compute output scales.

getDataType

getDataType()

Compute numpy data type.

getInputDimensions

getInputDimensions()

Compute input dimensions.

getOutputDimensions

getOutputDimensions()

Compute output dimensions.

getMatrix

getMatrix()

Compute transformation matrix.

getTransform

getTransform()

Compute neuroglancer transform.

VolumeDataSource

VolumeDataSource(*args, **kwargs)

Bases: LayerDataSource

Wrapper for volume source.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

SkeletonDataSource

SkeletonDataSource(*args, **kwargs)

Bases: LayerDataSource

Wrapper for skeleton source.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

MeshDataSource

MeshDataSource(*args, **kwargs)

Bases: LayerDataSource

Wrapper for mesh source.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

AnnotationDataSource

AnnotationDataSource(*args, **kwargs)

Bases: LayerDataSource

Wrapper for annotation source.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

LocalDataSource

LocalDataSource(*args, **kwargs)

Bases: LayerDataSource

Wrapper for local data sources.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

LocalAnnotationDataSource

LocalAnnotationDataSource(*args, **kwargs)

Bases: AnnotationDataSource, LocalDataSource

Wrapper for local annotation sources.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

LocalSkeletonDataSource

LocalSkeletonDataSource(*args, **kwargs)

Bases: SkeletonDataSource, LocalDataSource

Wrapper for data source that wraps a SkeletonSource.

local_skeleton property

local_skeleton

Points to the underlying SkeletonSource, if any.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

LocalVolumeDataSource

LocalVolumeDataSource(*args, **kwargs)

Bases: VolumeDataSource, LocalDataSource

Wrapper for data source that wraps a LocalVolume.

local_volume property

local_volume

Points to the underlying LocalVolume, if any.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

NiftiVolumeInfo

NiftiVolumeInfo(url, align_corner=False, affine='best')

Bases: VolumeInfo

Metadata of a NIfTI volume.

Parameters:

Name Type Description Default
url str

URL to the file

required
align_corner bool

If True, use neuroglancer's native behavior when computing the transform, which is to assume that (0, 0, 0) points to the corner of the first voxel. If False, use NIfTI's spec, which is to assume the (0, 0, 0) points to the center of the first voxel.

False
affine (qform, sform, best, base)

Which orientation matrix to use. Neuroglancer uses the qform by default.

"qform"

getShape

getShape()

Compute array shape.

getInputNames

getInputNames()

Compute names of input axes.

getOutputNames

getOutputNames()

Compute names of output axes.

getSpaceUnit

getSpaceUnit()

Compute spatial unit.

getTimeUnit

getTimeUnit()

Compute time unit.

getUnits

getUnits()

Compute all units.

getInputScales

getInputScales()

Compute input scales.

getOutputScales

getOutputScales()

Compute output scales.

getDescription

getDescription()

Compute description string.

getDataType

getDataType()

Compute numpy data type.

getSlopeInter

getSlopeInter()

Compute intensity transform.

getMatrix

getMatrix()

Compute transformation matrix.

getNbLevels

getNbLevels()

Compute number of dimensions.

getRank

getRank()

Compute number of dimensions.

getInputDimensions

getInputDimensions()

Compute input dimensions.

getOutputDimensions

getOutputDimensions()

Compute output dimensions.

getTransform

getTransform()

Compute neuroglancer transform.

NiftiDataSource

NiftiDataSource(*args, **kwargs)

Bases: VolumeDataSource

Wrapper for nifti sources.

Note that by default, neuroglancer assumes that the coordinate (0, 0, 0) in voxel space corresponds to the corner of the first voxel, whereas the nifti spec is that it corresponds to the center of the first voxel. This wrapper follows the nifti convention by default. The neuroglancer default behavior can be recovered with the option align_corner=True.

Also, by default, neuroglancer uses the qform orientation matrix, whereas the intent code must be used to choose between the sform and qform according to the spec (as implemented in e.g. nibabel). This wrapper follows the specification, unless the affine to use is explicitly specified with the option affine="sform", affine="qform", or affine="base".

Parameters:

Name Type Description Default
json_data dict | NiftiDataSource | str

URL to the file

required

Other Parameters:

Name Type Description
url str

URL to the file

align_corner bool

If True, use neuroglancer's native behavior when computing the transform, which is to assume that (0, 0, 0) points to the corner of the first voxel. If False, use NIfTI's spec, which is to assume the (0, 0, 0) points to the center of the first voxel.

affine (qform, sform, best, base)

Which orientation matrix to use. Neuroglancer uses the qform by default.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

ZarrVolumeInfo

ZarrVolumeInfo(url)

Bases: VolumeInfo

Base class + common methods for Zarr metadata.

Parameters:

Name Type Description Default
url str

URL to the file

required

getShape

getShape(level=0)

Array shape at a given level.

getNbLevels

getNbLevels()

Return the number of levels in the pyramid.

hasOME

hasOME()

Return True if Zarr has OME metadata.

hasNIfTI

hasNIfTI()

Return True if Zarr has NIfTI metadata.

getMultiscalesOME

getMultiscalesOME()

Return content of OME metadata (JSON).

getAxesOME

getAxesOME()

Return OME axes (JSON).

getDatasetOME

getDatasetOME(level=0)

Return OME dataset (JSON).

getNames

getNames()

Return axis names.

getAxisTypes

getAxisTypes()

Return axis type (space, time, channel).

getUnits

getUnits()

Return units.

getScales

getScales()

Return scales.

getTranslations

getTranslations()

Return translations (in spatial units).

Although OME-NGFF v0.4 requires translations to appear after scales so that translations are expressed in world units, neuroglancer accepts transformations that have the opposite order, i.e., where translations are expressed in voxels. We also handle this case and rescale translations to world units.

getMatrix

getMatrix()

Return transformation matrix.

getZarrTransform

getZarrTransform()

Return the pure zarr transform.

getNiftiInputDimensions

getNiftiInputDimensions()

Return nifti dimensions, but using OME axis names.

getNiftiOutputDimensions

getNiftiOutputDimensions()

Return nifti output dimensions.

getNiftiMatrix

getNiftiMatrix()

Return nifti transformation matrix.

getNiftiTransform

getNiftiTransform()

Return nifti transform.

getNiftiZarrTransform

getNiftiZarrTransform()

Return the transform to apply to a Zarr layer so that it's oriented according to the nifti metadata.

getTransform

getTransform()

Return the nifti-zarr transform if it exists, else the ome-zarr transform.

getRank

getRank()

Compute number of dimensions.

getSlopeInter

getSlopeInter()

Affine intensity scaling.

getDataType

getDataType()

Compute numpy data type.

getInputDimensions

getInputDimensions()

Compute input dimensions.

getOutputDimensions

getOutputDimensions()

Compute output dimensions.

Zarr2VolumeInfo

Zarr2VolumeInfo(url, nifti=None)

Bases: ZarrVolumeInfo

Volume info for Zarr v2.

getDataType

getDataType()

Array shape at a given level.

getNbLevels

getNbLevels()

Return the number of levels in the pyramid.

getShape

getShape(level=0)

Array shape at a given level.

getRank

getRank()

Compute number of dimensions.

getSlopeInter

getSlopeInter()

Affine intensity scaling.

getInputDimensions

getInputDimensions()

Compute input dimensions.

getOutputDimensions

getOutputDimensions()

Compute output dimensions.

getMatrix

getMatrix()

Return transformation matrix.

getTransform

getTransform()

Return the nifti-zarr transform if it exists, else the ome-zarr transform.

hasOME

hasOME()

Return True if Zarr has OME metadata.

hasNIfTI

hasNIfTI()

Return True if Zarr has NIfTI metadata.

getMultiscalesOME

getMultiscalesOME()

Return content of OME metadata (JSON).

getAxesOME

getAxesOME()

Return OME axes (JSON).

getDatasetOME

getDatasetOME(level=0)

Return OME dataset (JSON).

getNames

getNames()

Return axis names.

getAxisTypes

getAxisTypes()

Return axis type (space, time, channel).

getUnits

getUnits()

Return units.

getScales

getScales()

Return scales.

getTranslations

getTranslations()

Return translations (in spatial units).

Although OME-NGFF v0.4 requires translations to appear after scales so that translations are expressed in world units, neuroglancer accepts transformations that have the opposite order, i.e., where translations are expressed in voxels. We also handle this case and rescale translations to world units.

getZarrTransform

getZarrTransform()

Return the pure zarr transform.

getNiftiInputDimensions

getNiftiInputDimensions()

Return nifti dimensions, but using OME axis names.

getNiftiOutputDimensions

getNiftiOutputDimensions()

Return nifti output dimensions.

getNiftiMatrix

getNiftiMatrix()

Return nifti transformation matrix.

getNiftiTransform

getNiftiTransform()

Return nifti transform.

getNiftiZarrTransform

getNiftiZarrTransform()

Return the transform to apply to a Zarr layer so that it's oriented according to the nifti metadata.

Zarr3VolumeInfo

Zarr3VolumeInfo(url, nifti=None)

Bases: ZarrVolumeInfo

Volume info for Zarr v3.

getDataType

getDataType()

Array shape at a given level.

getNbLevels

getNbLevels()

Return the number of levels in the pyramid.

getShape

getShape(level=0)

Array shape at a given level.

getRank

getRank()

Compute number of dimensions.

getSlopeInter

getSlopeInter()

Affine intensity scaling.

getInputDimensions

getInputDimensions()

Compute input dimensions.

getOutputDimensions

getOutputDimensions()

Compute output dimensions.

getMatrix

getMatrix()

Return transformation matrix.

getTransform

getTransform()

Return the nifti-zarr transform if it exists, else the ome-zarr transform.

hasOME

hasOME()

Return True if Zarr has OME metadata.

hasNIfTI

hasNIfTI()

Return True if Zarr has NIfTI metadata.

getMultiscalesOME

getMultiscalesOME()

Return content of OME metadata (JSON).

getAxesOME

getAxesOME()

Return OME axes (JSON).

getDatasetOME

getDatasetOME(level=0)

Return OME dataset (JSON).

getNames

getNames()

Return axis names.

getAxisTypes

getAxisTypes()

Return axis type (space, time, channel).

getUnits

getUnits()

Return units.

getScales

getScales()

Return scales.

getTranslations

getTranslations()

Return translations (in spatial units).

Although OME-NGFF v0.4 requires translations to appear after scales so that translations are expressed in world units, neuroglancer accepts transformations that have the opposite order, i.e., where translations are expressed in voxels. We also handle this case and rescale translations to world units.

getZarrTransform

getZarrTransform()

Return the pure zarr transform.

getNiftiInputDimensions

getNiftiInputDimensions()

Return nifti dimensions, but using OME axis names.

getNiftiOutputDimensions

getNiftiOutputDimensions()

Return nifti output dimensions.

getNiftiMatrix

getNiftiMatrix()

Return nifti transformation matrix.

getNiftiTransform

getNiftiTransform()

Return nifti transform.

getNiftiZarrTransform

getNiftiZarrTransform()

Return the transform to apply to a Zarr layer so that it's oriented according to the nifti metadata.

ZarrDataSource

ZarrDataSource(*args, **kwargs)

Bases: VolumeDataSource

Wrapper for Zarr data sources.

This wrapper will automatically check for the presence of a nifti group in the zarr object, which indicates that the file really has the nifti-zarr format.

This behavior can be changed by setting the option nifti=False (to load the file as a pure OME-Zarr) or nifti=True (which raises an error if the nifti group is not found).

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

guess_version classmethod

guess_version(url)

Guess zarr version.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

Zarr2DataSource

Zarr2DataSource(*args, **kwargs)

Bases: ZarrDataSource

Wrapper for Zarr v2 data sources.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

guess_version classmethod

guess_version(url)

Guess zarr version.

Zarr3DataSource

Zarr3DataSource(*args, **kwargs)

Bases: ZarrDataSource

Wrapper for Zarr v3 data sources.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

guess_version classmethod

guess_version(url)

Guess zarr version.

N5VolumeInfo

N5VolumeInfo(url)

Bases: VolumeInfo

Base class + common methods for N5 metadata.

getDataType

getDataType()

Array data type.

getShape

getShape(level=0)

Array shape at a given level.

getNbLevels

getNbLevels()

Return the number of levels in the pyramid.

getNames

getNames()

Return axis names.

getUnits

getUnits()

Return units.

getScales

getScales()

Return scales.

getTranslations

getTranslations()

Return translations (in spatial units).

getRank

getRank()

Compute number of dimensions.

getSlopeInter

getSlopeInter()

Affine intensity scaling.

getInputDimensions

getInputDimensions()

Compute input dimensions.

getOutputDimensions

getOutputDimensions()

Compute output dimensions.

getMatrix

getMatrix()

Compute transformation matrix.

getTransform

getTransform()

Compute neuroglancer transform.

N5DataSource

N5DataSource(*args, **kwargs)

Bases: VolumeDataSource

Wrapper for N5 data sources.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

PrecomputedInfo

PrecomputedInfo(url)

Base class for metadate about precomputed objects.

PrecomputedMeshInfo

PrecomputedMeshInfo(url)

Bases: PrecomputedInfo

Metadata of a precomputed mesh.

PrecomputedLegacyMeshInfo

PrecomputedLegacyMeshInfo(url)

Bases: PrecomputedInfo

Metadata of a precomputed mesh (legacy).

PrecomputedSkeletonInfo

PrecomputedSkeletonInfo(url)

Bases: PrecomputedInfo

Metadata of a precomputed skeleton.

PrecomputedAnnotationInfo

PrecomputedAnnotationInfo(url)

Bases: PrecomputedInfo

Metadata of a precomputed annotation.

PrecomputedVolumeInfo

PrecomputedVolumeInfo(url)

Bases: PrecomputedInfo

Metadata of a precomputed volume.

getDataType

getDataType()

TODO.

getShape

getShape(level=0)

TODO.

getRank

getRank()

TODO.

getScales

getScales()

TODO.

getUnits

getUnits()

TODO.

getNames

getNames()

TODO.

getDimensions

getDimensions()

TODO.

getTransform

getTransform()

TODO.

getNbLevels

getNbLevels()

TODO.

getVoxelOffset

getVoxelOffset()

TODO.

getChunkSize

getChunkSize(level=0, choice=0)

TODO.

PrecomputedDataSource

PrecomputedDataSource(*args, **kwargs)

Bases: LayerDataSource

Base wrapper for precomputed data sources.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

PrecomputedMeshDataSource

PrecomputedMeshDataSource(*args, **kwargs)

Bases: MeshDataSource, PrecomputedDataSource

Base wrapper for precomputed mesh sources.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

PrecomputedLegacyMeshDataSource

PrecomputedLegacyMeshDataSource(*args, **kwargs)

Bases: MeshDataSource, PrecomputedDataSource

Base wrapper for precomputed mesh (legacy) sources.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

PrecomputedSkeletonDataSource

PrecomputedSkeletonDataSource(*args, **kwargs)

Bases: SkeletonDataSource, PrecomputedDataSource

Base wrapper for precomputed skeleton sources.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

PrecomputedAnnotationDataSource

PrecomputedAnnotationDataSource(*args, **kwargs)

Bases: AnnotationDataSource, PrecomputedDataSource

Base wrapper for precomputed annotations sources.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

PrecomputedTractsDataSource

PrecomputedTractsDataSource(*args, **kwargs)

Bases: PrecomputedAnnotationDataSource

Base wrapper for track precomputed annotations sources.

info property

info

Lazy access to format-specific metadata.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

PrecomputedVolumeDataSource

PrecomputedVolumeDataSource(*args, **kwargs)

Bases: VolumeDataSource, PrecomputedDataSource

Wrapper for precomputed volumes.

local_url property

local_url

Path to url, even if file is local.

shape property

shape

Return the shape of the array (spatial dimensions first).

rank property

rank

Return the number of dimensions in the array.

dtype property

dtype

Return the data type of the array.

slope_inter property

slope_inter

Affine scaling to apply to the stored intensity.

dataobj property

dataobj

Return an array-like object pointing to the data.

nb_levels property

nb_levels

Number of pyramid levels.

input_dimensions property

input_dimensions

Input dimensions.

output_dimensions property

output_dimensions

Output dimensions.

input_bbox property

input_bbox

Bounding box, in input_dimensions space and units.

output_bbox property

output_bbox

Bounding box, in output_dimensions space and units.

input_center property

input_center

Center of the field of view in input dimensions space and units.

output_center property

output_center

Center of the field of view in output dimensions space and units.

input_bbox_size property

input_bbox_size

Center of the field of view in input dimensions space and units.

output_bbox_size property

output_bbox_size

Center of the field of view in output dimensions space and units.

output_voxel_size property

output_voxel_size

Voxel size in model space.

get_dataobj

get_dataobj(level=0, mode='r')

Return an array-like object pointing to a pyramid level.

quantiles

quantiles(q)

Compute data quantiles.

apply_transform

apply_transform(*args)

Apply an additional transform in model space.

datasource

datasource(formats)

Register a format-specific datasource class.

Parameters:

Name Type Description Default
formats str | list[str]

Formats that should fallback to the decorated class.

required