Previous topic

Loading and saving images

Next topic

Image I/O functionalities (

This Page

Accessing metadataΒΆ

Part of the images metadata can be read from the image data, the remaining from the header object.

>>> from import load
>>> image_data, image_header = load('path/to/')
>>> image_data.shape
(512, 512, 256)
>>> image_data.dtype

Some simple access function provide a common interface to the header, independent of the image type:

>>> from import header
>>> header.get_pixel_spacing(image_header)
(0.5, 0.5, 2)
>>> header.get_offset(image_header)
(10, -23, 123)

More metadata is currently not supported by MedPy, as the different image formats handle them quite differently.