NVIDIA Clara Train 3.1
3.1

ai4med.libs.readers package

class ColorImageReader(dtype= )

Bases: <a href="#ai4med.libs.readers.image_reader.ImageReader">ai4med.libs.readers.image_reader.ImageReader</a>

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

numpy array for loaded image.

class ImageReader(dtype= )

Bases: object

Base class for Image Loader.

static list_file_names(file_name_spec)
class JpgReader(dtype= )

Bases: <a href="#ai4med.libs.readers.color_image_reader.ColorImageReader">ai4med.libs.readers.color_image_reader.ColorImageReader</a>

Read single or multiple JPEG files.

Parameters

dtype (np) – type for loaded data.

Returns

MedicalImage containing loaded image data.

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

MedicalImage containing loaded jpg data.

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

Bases: <a href="#ai4med.libs.readers.image_reader.ImageReader">ai4med.libs.readers.image_reader.ImageReader</a>

Reads nifti files.

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

MedicalImage containing loaded nifti 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

class NumpyReader(dtype= )

Bases: object

Reads Numpy files.

Parameters

dtype – Type for data to be loaded.

read(file_name, shape: ai4med.common.shape_format.ShapeFormat)
class PngReader(dtype= )

Bases: <a href="#ai4med.libs.readers.color_image_reader.ColorImageReader">ai4med.libs.readers.color_image_reader.ColorImageReader</a>

Reads PNG files.

Parameters

dtype (np) – Type for loading data.

Returns

MedicalImage containing loaded images.

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

MedicalImage containing loaded png data.

class SitkReader(dtype= , channels_first=False)

Bases: <a href="#ai4med.libs.readers.image_reader.ImageReader">ai4med.libs.readers.image_reader.ImageReader</a>

Reads Files supported by: https://simpleitk.readthedocs.io/en/master/IO.html

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

© Copyright 2020, NVIDIA. Last updated on Feb 2, 2023.