## Submodules

class ColorImageReader(dtype= )

Bases: ai4med.libs.readers.image_reader.ImageReader

Base class for reading color image formats (png, jpg etc).

static load_color_image(file_name)

Load color images using opencv. This will return a BGR image. Converting to RGB is done by readers as needed.

Parameters

file_name (str) – path of file to be loaded.

Returns

class ImageReader(dtype= )

Bases: object

static list_file_names(file_name_spec)

class JpgReader(dtype= )

Bases: ai4med.libs.readers.color_image_reader.ColorImageReader

Read single or multiple JPEG files.

Parameters

dtype (np) – type for loaded data.

Returns

read(file_name_spec)

Reads a file or a list of jpg files.

If a list of strings is passed, assumes that each file corresponds to channel of an image. Therefore, they must all be same shape.

Parameters

file_name_spec (str, list) – List of strings or string.

Returns

class NiftiReader(dtype= , nii_is_channels_first=False, as_closest_canonical=False)

Bases: ai4med.libs.readers.image_reader.ImageReader

Parameters
• dtype (np) – type for loaded data.

• nii_is_channels_first (bool) – Is nifti channels first. (Default: False)

• as_closest_canonical (bool) – Load in canonical orientation. (Default: False)

Returns

read(file_name_spec)

Reads a file or a list of files.

If a list of strings is passed, assumes that each file corresponds to channel of an image. Therefore, they must all be same shape.

Parameters

file_name_spec (str, list) – List of strings or string.

Returns

MedicalImage

class NumpyReader(dtype= )

Bases: object

Parameters

dtype – Type for data to be loaded.

read(file_name, shape: ai4med.common.shape_format.ShapeFormat)

class PngReader(dtype= )

Bases: ai4med.libs.readers.color_image_reader.ColorImageReader

Parameters

Returns

read(file_name_spec)

Reads a file or a list of png files.

If a list of strings is passed, assumes that each file corresponds to channel of an image. Therefore, they must all be same shape.

Parameters

file_name_spec (str, list) – List of strings or string.

Returns

class SitkReader(dtype= , channels_first=False)

Bases: ai4med.libs.readers.image_reader.ImageReader

Parameters

dtype (np) – type for loaded data.

Returns

MedicalImage containing loaded image (np) data.

read(file_name_spec)

Reads a file or a list of files.

If a list of strings is passed, assumes that each file corresponds to channel of an image. Therefore, they must all be same shape.

Parameters

file_name_spec (str, list) – List of strings or string.

Returns

MedicalImage