Skip to content

Read

Source

Functions relating to reading image files of different formats.

ReadFunc

Bases: Protocol

Protocol for type hinting read functions.

get_read_func(data_type)

Get the read function for the data type.

Parameters:

Name Type Description Default
data_type SupportedData

Data type.

required

Returns:

Type Description
callable

Read function.

read_tiff(file_path, *args, **kwargs)

Read a tiff file and return a numpy array.

Parameters:

Name Type Description Default
file_path Path

Path to a file.

required
*args list

Additional arguments.

()
**kwargs dict

Additional keyword arguments.

{}

Returns:

Type Description
ndarray

Resulting array.

Raises:

Type Description
ValueError

If the file failed to open.

OSError

If the file failed to open.

ValueError

If the file is not a valid tiff.

ValueError

If the data dimensions are incorrect.

ValueError

If the axes length is incorrect.