pysap.base.image#

class Image(shape=None, spacing=None, data_type='scalar', metadata=None, **kwargs)[source]#

Bases: pysap.base.observable.Observable

Class that defines an image.

An image contains:
  • data: an array of data stored in a numpy.ndarray

  • data_type: whether the data is scalar, vector or matrix.

  • a dictionary of metadata

If data_type is ‘vector’ or ‘matrix’, an array of dimension N will have a spacing of size N-1, respectivelly N-2.

The following event is allowed:
  • modified

show()[source]#

Display the image data.

modified()[source]#

Send a modified signal to the observers.

_get_spacing()[source]#

Get the image spacing.

_set_spacing(spacing)[source]#

Set the image spacing.

Parameters

spacing (uplet) – the image spacing.

_get_shape()[source]#

Get the shape of the image. This function accounts for non-scalar data, i.e. ‘vector’ or ‘matrix’ vs ‘scalar’ data types.

_get_dtype()[source]#

Get the image data type.

_get_ndim()[source]#

Get the image dimension. This function accounts for non-scalar data, i.e. ‘vector’ or ‘matrix’ vs ‘scalar’ data types.

_get_scroll_axis()[source]#

Get the scroll axis.

Returns

scroll_axis – the scroll axis for 3d data.

Return type

int

_set_scroll_axis(scroll_axis)[source]#

Modify the scroll axis.

Parameters

scroll_axis (int) – the scroll axis for 3d data.

property scroll_axis#

Get the scroll axis.

Returns

scroll_axis – the scroll axis for 3d data.

Return type

int

property spacing#

Get the image spacing.

property shape#

Get the shape of the image. This function accounts for non-scalar data, i.e. ‘vector’ or ‘matrix’ vs ‘scalar’ data types.

property dtype#

Get the image data type.

property ndim#

Get the image dimension. This function accounts for non-scalar data, i.e. ‘vector’ or ‘matrix’ vs ‘scalar’ data types.

_default_spacing()[source]#

Return the default image spacing.