neuroglancer_n5
This module contains Pydantic models for Neuroglancer-compatible multiscale images stored in N5 groups. See Neuroglancer's N5-specific documentation for details on what Neuroglancer expects when it reads N5 data.
PixelResolution #
Bases: BaseModel
This attribute is used by N5-fluent tools like Neuroglancer to convey the spacing between points on a N-dimensional coordinate grid, and the unit of measure for the coordinate grid, for data stored in the N5 format. Conventionally, it is used to express the resolution and unit of measure for the axes of an image.
-
If this metadata is stored in the
attributes.json
file of an N5 dataset, then the visualization tool Neuroglancer can use this metadata to infer coordinates for the data in the array. -
If this metadata is stored in the
attributes.json
file of an N5 group that contains a collection of N5 datasets, then Neuroglancer will use this metadata to infer coordinates for that collection of datasets, assuming that they represent a multiscale pyramid, and provided that other required metadata is present (seeGroupMetadata
).
See the Neuroglancer N5-specific documentation for details.
Indexing note:
The pixelResolution.dimensions
attribute maps on to the dimensions of the array described by this
metadata in colexicographic order, i.e., the first array index corresponds to the
smallest stride of the stored representation of the array, and subsequent array
indices are ordered by increasing stride size. This is the array indexing order used
by Neuroglancer, and by the N5 ecosystem of tools.
Be advised that Numpy uses lexicographic order for array indexing -- the first
array index in Numpy corresponds to the largest stride of the stored representation
of the array, and subsequent array indices are ordered by decreasing stride size.
So Numpy users must reverse the order of the dimensions
attribute when
mapping it to the axes of a Numpy-like array.
See the external documentation for this metadata for more information.
Attributes:
Name | Type | Description |
---|---|---|
dimensions |
Sequence[float]
|
The distance, in units given by the |
unit |
str
|
The physical unit for the |
GroupMetadata #
Bases: BaseModel
Metadata to enable displaying an N5 group containing several datasets as a multiresolution image in neuroglancer, based on this comment.
Indexing note:
The attributes axes
, units
, and the elements of scales
should be indexed
colexicographically, i.e. the opposite order from Numpy-standard order,
which is lexicographic.
Attributes:
Name | Type | Description |
---|---|---|
axes |
Sequence[str]
|
The names of the axes of the data |
units |
Sequence[str]
|
The units for the axes of the data |
scales |
Sequence[Sequence[PositiveInt]]
|
The relative scales of each axis. E.g., if this metadata describes a 3D dataset
that was downsampled isotropically by 2 along each axis over two iterations,
resulting in 3 total arrays, then |
pixelResolution |
PixelResolution
|
An instance of |
Group #
Bases: N5GroupSpec
A GroupSpec
representing the structure of a N5 group with
neuroglancer-compatible structure and metadata.
Attributes:
Name | Type | Description |
---|---|---|
attributes |
GroupMetadata
|
The metadata required to convey to neuroglancer that this group represents a multiscale image. |
members |
Dict[str, Union[GroupSpec, ArraySpec]]
|
The members of this group. Arrays must be consistent with the |
check_scale_level_name #
Check if the input follows the pattern s$INT
, i.e., check if the input is
a string that starts with "s", followed by a string representation of an integer,
and nothing else.
If validation passes, this function returns True
.
If validation fails, it returns False
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
|
required |
Returns:
Type | Description |
---|---|
`True` if `name` is valid, `False` otherwise.
|
|