scitiff.io.save_scitiff#

scitiff.io.save_scitiff(dg, file_path, *, concat_stdevs_and_mask=False, mask_name=None)[source]#

Save an image in scipp data structure to a SCITIFF format including metadata.

The image is transposed to the default HyperStack order before saving the image, which is x, y, c, z, t. (From the innermost dimension to the outermost dimension)

Note

Before the image is saved, it is broadcasted to match the HyperStack even if part of dimensions are not present. For example, if the image has only x and y dimensions, the image will be broadcasted to x, y, c, z, t dimensions with size of 1 for each dimension that is not present.

Warning

load_scitiff() function will squeeze the dimensions with size 1 by default. Other image tools also may squeeze the image and drop the dimensions with size 1 by default.

Note

Dimensions of the image stack#

Name

Description

x

x-axis (width)

y

y-axis (height)

c

channel-axis

z

z-axis

t

time-axis(time-of-flight or other time-like dimension)

Warning

For neutron imaging, c dimension may not represent color channels.

Parameters:
  • dg (DataGroup | DataArray) – The image data to save.

  • file_path (str | Path) – The path to save the image data.

  • concat_stdevs_and_mask (bool, default: False) – If True, stdevs and a mask will be concatenated into channel dimension. The default is False.

  • mask_name (Optional[str], default: None) – The name of the mask to be concatenated as a separate channel. It will be ignored if the concat_stdevs_and_mask is False. If None while concat_stdevs_and_mask is True, it will try to find a single mask with the same size as the image. If there are multiple masks with the same size, masks will be ignored.

Raises:
  • ValueError – If the image data has unexpected dimensions. The function does not understand any other names for the dimensions except x, y, c, z, t.

  • scipp.DTypeError – If the image data has unexpected dtype. ImageJ only supports float32, int8, and int16 dtypes.

Return type:

None