medpy.io.header.Header#

class medpy.io.header.Header(spacing=None, offset=None, direction=None, sitkimage=None)[source]#

A medpy header object.

Stores spacing, offset/origin, direction, and possibly further meta information. Provide at least one of the parameters. Missing information is extracted from the sitkimage or, if not supplied, set to a default value.

Parameters:
spacingtuple of floats

the image’s voxel spacing defaults to a tuple of 1.0s

offsettuple of floats

the image’s offset/origin defaults to a tuple of 0.0s

directionndarray

the image’s affine transformation matrix must be of square shape default to the identity matrix

sitkimagesitk.Image

the simple itk image as loaded

__init__(spacing=None, offset=None, direction=None, sitkimage=None)[source]#

Methods

__init__([spacing, offset, direction, sitkimage])

copy_to(sitkimage)

Copy all stored meta information info to an sitk Image.

get_direction()

Get image's direction.

get_info_consistent(ndim)

Returns the main meta-data information adapted to the supplied image dimensionality.

get_offset()

Get image's offset.

get_sitkimage()

Get underlying sitk Image object.

get_voxel_spacing()

Get image's spacing.

set_direction(direction)

Set image's direction.

set_offset(offset)

Set image's offset.

set_voxel_spacing(spacing)

Set image's spacing.