Skip to content

datasources

ngtools.local.datasources

Objects that represent local multidimensional arrays.

BabelVolumeInfo

BabelVolumeInfo(fileobj)

Bases: VolumeInfo

Generic NiBabel metadata.

getDataType

getDataType()

TODO.

getShape

getShape(level=0)

TODO.

getInputNames

getInputNames()

TODO.

getOutputNames

getOutputNames()

TODO.

getInputScales

getInputScales()

TODO.

getOutputScales

getOutputScales()

TODO.

getUnits

getUnits()

TODO.

getMatrix

getMatrix()

TODO.

getNbLevels

getNbLevels()

Compute number of dimensions.

getRank

getRank()

Compute number of dimensions.

getSlopeInter

getSlopeInter()

Affine intensity scaling.

getInputDimensions

getInputDimensions()

Compute input dimensions.

getOutputDimensions

getOutputDimensions()

Compute output dimensions.

getTransform

getTransform()

Compute neuroglancer transform.

BabelDataSource

BabelDataSource(*args, **kwargs)

Bases: LocalVolumeDataSource

A local volume read using nibabel.

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.

local_volume property

local_volume

Points to the underlying LocalVolume, if any.

LocalVolume

Bases: LocalVolume

LocalVolume that knows it is in a BabelDataSource.

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.

MGHDataSource

MGHDataSource(*args, **kwargs)

Bases: BabelDataSource

Wrapper for MGH/MGZ volume 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.

local_volume property

local_volume

Points to the underlying LocalVolume, if any.

LocalVolume

Bases: LocalVolume

LocalVolume that knows it is in a MGHDataSource.

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.

TiffVolumeInfo

TiffVolumeInfo(url, fileobj=None)

Bases: VolumeInfo

Wrapper for local tiff volumes.

getShape

getShape(level=0)

TODO.

getDataType

getDataType()

TODO.

getScales

getScales()

TODO.

getUnits

getUnits()

TODO.

getNames

getNames()

TODO.

getDimensions

getDimensions()

TODO.

getTransform

getTransform()

TODO.

getZoomsOME staticmethod

getZoomsOME(omexml, series=None)

Extract zoom factors (i.e., voxel size) from OME metadata.

This function returns the zoom levels at the highest resolution. Zooms at subsequent resolution (in the in-plane direction only) can be obtained by multiplying the zooms at the previous resolution by 2. (This assumes that pyramid levels are built using a sliding window).

If more than one series is requested, the returned variables are wrapped in a tuple E.g.:

>>> zooms, units, axes = ome_zooms(omexml)
>>> zooms_series1 = zooms[1]
>>> zooms_series1
(10., 10., 5.)
>>> units_series1 = units[1]
>>> units_series1
('mm', 'mm', 'mm')

Parameters:

Name Type Description Default
omexml str or bytes

OME-XML metadata

required
series int or list[int] or None

Series ID(s)

all

Returns:

Name Type Description
zooms tuple[float]
units tuple[str]
axes str

getNbLevels

getNbLevels()

Compute number of dimensions.

getRank

getRank()

Compute number of dimensions.

getSlopeInter

getSlopeInter()

Affine intensity scaling.

getMatrix

getMatrix()

Compute transformation matrix.

TiffDataSource

TiffDataSource(*args, **kwargs)

Bases: LocalVolumeDataSource

A local tiff volume, read with tifffile.

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.

local_volume property

local_volume

Points to the underlying LocalVolume, if any.

LocalVolume

Bases: LocalVolume

LocalVolume that knows it is in a TiffDataSource.

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.