Interfaces
siapy.entities.images.interfaces
¶
ImageBase
¶
Bases: ABC
Abstract base class defining the interface for spectral image implementations.
This class defines the common interface that all image backend implementations must implement, including methods for opening files, accessing metadata and properties, and converting to different formats.
All concrete implementations (SpectralLibImage, RasterioLibImage, MockImage) must inherit from this class and implement all abstract methods.
filepath
abstractmethod
property
¶
filepath: Path
Get the file path of the image.
RETURNS | DESCRIPTION |
---|---|
Path
|
A Path object representing the location of the image file. For in-memory images, this may return an empty Path. |
metadata
abstractmethod
property
¶
shape
abstractmethod
property
¶
bands
abstractmethod
property
¶
bands: int
Get the number of spectral bands in the image.
RETURNS | DESCRIPTION |
---|---|
int
|
The number of spectral bands (channels) in the image. |
default_bands
abstractmethod
property
¶
wavelengths
abstractmethod
property
¶
camera_id
abstractmethod
property
¶
camera_id: str
Get the camera or sensor identifier.
RETURNS | DESCRIPTION |
---|---|
str
|
A string identifying the camera or sensor used to capture the image. May return an empty string if no camera information is available. |
open
abstractmethod
classmethod
¶
Open and load an image from a source.
PARAMETER | DESCRIPTION |
---|---|
*args
|
Positional arguments specific to the implementation.
TYPE:
|
**kwargs
|
Keyword arguments specific to the implementation.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ImageBase
|
An instance of the concrete image implementation. |
Note
Each implementation defines its own signature for this method based on the specific requirements of the underlying library.
Source code in siapy/entities/images/interfaces.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
to_display
abstractmethod
¶
to_display(equalize: bool = True) -> Image
Convert the image to a PIL Image for display purposes.
PARAMETER | DESCRIPTION |
---|---|
equalize
|
Whether to apply histogram equalization to enhance contrast.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Image
|
A PIL Image object suitable for display, typically as an RGB composite created from the default bands with appropriate scaling and normalization. |
Source code in siapy/entities/images/interfaces.py
116 117 118 119 120 121 122 123 124 125 126 |
|
to_numpy
abstractmethod
¶
Convert the image to a numpy array.
PARAMETER | DESCRIPTION |
---|---|
nan_value
|
Optional value to replace NaN values with. If None, NaN values are preserved.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
NDArray[floating[Any]]
|
A 3D numpy array with shape (height, width, bands) containing the image data. The array dtype should be a floating-point type. |
Source code in siapy/entities/images/interfaces.py
128 129 130 131 132 133 134 135 136 137 138 |
|
to_xarray
abstractmethod
¶
to_xarray() -> XarrayType
Convert the image to an xarray DataArray.
RETURNS | DESCRIPTION |
---|---|
XarrayType
|
An xarray DataArray with labeled dimensions and coordinates, suitable for advanced analysis and visualization. The array should include appropriate coordinate information and metadata attributes. |
Source code in siapy/entities/images/interfaces.py
140 141 142 143 144 145 146 147 |
|