IO
eva.vision.utils.io.image
Image I/O related functions.
read_image
Reads and loads the image from a file path as a RGB.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path of the image file. |
required |
Returns:
Type | Description |
---|---|
NDArray[uint8]
|
The RGB image as a numpy array. |
Raises:
Type | Description |
---|---|
FileExistsError
|
If the path does not exist or it is unreachable. |
IOError
|
If the image could not be loaded. |
Source code in src/eva/vision/utils/io/image.py
read_image_as_array
Reads and loads an image file as a numpy array.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path to the image file. |
required |
flags |
int
|
Specifies the way in which the image should be read. |
IMREAD_UNCHANGED
|
Returns:
Type | Description |
---|---|
NDArray[uint8]
|
The image as a numpy array. |
Raises:
Type | Description |
---|---|
FileExistsError
|
If the path does not exist or it is unreachable. |
IOError
|
If the image could not be loaded. |
Source code in src/eva/vision/utils/io/image.py
eva.vision.utils.io.nifti
NIfTI I/O related functions.
read_nifti_slice
Reads and loads a NIfTI image from a file path as uint8
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path to the NIfTI file. |
required |
slice_index |
int
|
The image slice index to return. If |
required |
Returns:
Type | Description |
---|---|
NDArray[Any]
|
The image as a numpy array. |
Raises:
Type | Description |
---|---|
FileExistsError
|
If the path does not exist or it is unreachable. |
ValueError
|
If the input channel is invalid for the image. |
Source code in src/eva/vision/utils/io/nifti.py
fetch_total_nifti_slices
Fetches the total slides of a NIfTI image file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path to the NIfTI file. |
required |
Returns:
Type | Description |
---|---|
int
|
The number of the total available slides. |
Raises:
Type | Description |
---|---|
FileExistsError
|
If the path does not exist or it is unreachable. |
ValueError
|
If the input channel is invalid for the image. |