Skip to content

Write

Source

Functions relating to writing image files of different formats.

WriteFunc

Bases: Protocol

Protocol for type hinting write functions.

get_write_func(data_type)

Get the write function for the data type.

Parameters:

Name Type Description Default
data_type (tiff, custom)

Data type.

"tiff"

Returns:

Type Description
callable

Write function.

write_tiff(file_path, img, *args, **kwargs)

Write tiff files.

Parameters:

Name Type Description Default
file_path Path

Path to file.

required
img ndarray

Image data to save.

required
*args

Positional arguments passed to tifffile.imwrite.

()
**kwargs

Keyword arguments passed to tifffile.imwrite.

{}

Raises:

Type Description
ValueError

When the file extension of file_path does not match the Unix shell-style pattern '.tif'.