ai4med.libs.readers package
-
class
ColorImageReader(dtype=) Bases:
ai4med.libs.readers.image_reader.ImageReaderBase 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.
-
static
-
class
ImageReader(dtype=) Bases:
objectBase class for Image Loader.
-
static
list_file_names(file_name_spec)
-
static
-
class
JpgReader(dtype=) Bases:
ai4med.libs.readers.color_image_reader.ColorImageReaderRead 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:
ai4med.libs.readers.image_reader.ImageReaderReads 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:
objectReads Numpy files.
- 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.ColorImageReaderReads 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:
ai4med.libs.readers.image_reader.ImageReaderReads 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