minerva.data.readers.png_reader

Classes

PNGReader

This class loads a PNG file from a directory. It assumes that the PNG

Module Contents

class minerva.data.readers.png_reader.PNGReader(path)

Bases: minerva.data.readers.reader._Reader

This class loads a PNG file from a directory. It assumes that the PNG files are named with a number as the filename, starting from 0. This is shown below.

` /path/ ├── 0.png ├── 1.png ├── 2.png └── ... `

Thus, the element at index i will be the file i.png.

This class loads a PNG file from a directory.

Parameters

pathUnion[Path, str]

Path to the directory containing the PNG files.

__getitem__(index)

Retrieve the PNG file at the specified index. The index will be used as the filename of the PNG file.

Parameters

indexint

Index of the PNG file to retrieve.

Returns

np.ndarray

The PNG file as a NumPy array.

Raises

ValueError

If the specified file does not exist in the given path.

Parameters:

index (int)

Return type:

numpy.ndarray

__len__()

Return the number of PNG files in the directory.

Returns

int

The number of PNG files in the directory.

Return type:

int

Parameters:

path (Union[pathlib.Path, str])