Previous topic

Supported medical image formats

Next topic

Accessing metadata

This Page

Loading and saving imagesΒΆ

The image loading/saving facilities can be found in Loading an image is straightforward with load:

>>> from import load
>>> image_data, image_header = load('path/to/')

image_data is a numpy ndarray with the image data and image_header is a header object holding the associated metadata.

Now, to save the image, use save:

>>> from import load, save
>>> save(image_data, 'path/to/', image_header)

The image format is automatically deducted from the file ending.