Image IO
Functions relating reading and writing image files.
ReadFunc
Bases: Protocol
Protocol that defines the accepted function signature for "read functions".
Read functions take a file path and read image data into a numpy array.
The first argument MUST be named file_path and be type pathlib.Path, any number
of additional arguments of any type are allowed. The return type MUST be
numpy.typing.NDArray[Any]. For example:
WriteFunc
Bases: Protocol
Protocol for type hinting write functions.
__call__(file_path, img, *args, **kwargs)
Type hinted callables must match this function signature (not including self).
Parameters:
-
file_path(Path) –Path to file.
-
img(ndarray) –Image data to save.
-
*args–Other positional arguments.
-
**kwargs–Other keyword arguments.
get_read_func(data_type)
Get the read function for the data type.
Parameters:
-
data_type(SupportedData) –Data type.
Returns:
-
callable–Read function.