giatools.metadata

Copyright 2017-2025 Leonid Kostrykin, Biomedical Computer Vision Group, Heidelberg University.

Distributed under the MIT license. See file LICENSE for detail or copy at https://opensource.org/licenses/MIT

class giatools.metadata.Metadata(resolution: Tuple[float, float] | None = None, z_spacing: float | None = None, z_position: float | None = None, unit: Literal['inch', 'nm', 'um', 'mm', 'cm', 'm', 'km'] | None = None)

Bases: object

Image metadata.

__str__() str

Returns string representation of the metadata.

Example

>>> from giatools.metadata import Metadata
>>> metadata = Metadata()
>>> print('"{}"'.format(str(metadata)))
""
>>> metadata.resolution = (512.0, 256.0)
>>> metadata.unit = 'cm'
>>> print('"{}"'.format(str(metadata)))
"resolution=(512.0, 256.0), unit='cm'"
property pixel_size: Tuple[float, float] | None

The pixel size in X and Y dimensions (units per pixel). This is identical to the pixel spacing in X and Y dimensions.

resolution: Tuple[float, float] | None

Pixel resolution (pixels per unit in X and Y dimensions).

unit: Literal['inch', 'nm', 'um', 'mm', 'cm', 'm', 'km'] | None

The unit of measurement.

z_position: float | None

The position of the image in the Z dimension.

z_spacing: float | None

The pixel spacing in the Z dimension.

giatools.metadata.Unit

Valid units for metadata

alias of Literal[‘inch’, ‘nm’, ‘um’, ‘mm’, ‘cm’, ‘m’, ‘km’]