mymesh.image.write#

mymesh.image.write(impath, I, filetype=None, verbose=True, dtype=<class 'numpy.int16'>)[source]#

Write an image array to an image file or stack of image files

Note

When writing a jpg, png, or tiff, if the input image data has a maximum value greater than 255 or less than or equal to 1, the data will be automatically scaled to be in the range from, 0-255

Parameters:
  • impath (str) – File path to image directory or file name to save the images. If given as a filename with an extension, writing of a single image file will be attempted. For certain data type and file types (e.g. 3D multichannel data), this may not be supported and a stack of images prefixed with the filename will be written instead.

  • I (array_like or tuple) – 2D or 3D array_like containing image data, or 3 or 4 element tuple of 2D or 3D array_like of image data for rgb or rgba multichannel image data.

  • filetype (str, optional) –

    file specification, by default None. If impath is a filename with an extension, the extension will override the filetype input if given. If impath is a directory and no filetype is specified, tiff will be used by default.

    Options are:

    • ’dicom’

    • ’tiff’

    • ’png’

    • ’jpeg’