httomolib.misc.images#

Module for loading/saving images

httomolib.misc.images.save_to_images(data: <np.ndarray>, out_dir: typing.Union[str, os.PathLike], subfolder_name: str = 'images', axis: int = 1, file_format: str = 'tif', jpeg_quality: int = 95, offset: int = 0, watermark_vals: typing.Optional[tuple] = None, asynchronous: bool = False)[source]#

Saves data as 2D images. Rescaling of input isn’t performed, so if rescaling is needed please rescale the input data first (such as with the rescale_to_int function from the httomolibgpu package).

Parameters
  • data (np.ndarray) – Required input NumPy ndarray.

  • out_dir (str) – The main output directory for images.

  • subfolder_name (str, optional) – Subfolder name within the main output directory. Defaults to ‘images’.

  • axis (int, optional) – Specify the axis to use to slice the data (if data is a 3D array).

  • file_format (str, optional) – Specify the file format to use, e.g. “png”, “jpeg”, or “tif”. Defaults to “tif”.

  • jpeg_quality (int, optional) – Specify the quality of the jpeg image.

  • offset (int, optional) – The offset to start file indexing from, e.g. if offset is 100, images will start at 00100.tif. This is used when executed in parallel context and only partial data is passed in this run.

  • watermark_vals (tuple, optional) – A tuple with the values that will be written in the image as watermarks. The tuple length must be of the same size as len(data[axis]).

  • asynchronous (bool, optional) – Perform write operations synchronously or asynchronously.