You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A `SpectralImage` is the primary container for spectral image data. It's a generic class that can wrap different image backends, allowing you to work with various file formats through a unified interface.
The `Pixels` class represents spatial coordinates within spectral image, providing a container for *(x, y)* coordinate pairs. It uses pandas DataFrame internally for storage, enabling high-performance operations. The class provides multiple initialization methods and conversion functions to work with different data representations (i.e. DataFrames, list, arrays)
32
33
33
-
#### 1. Load from ENVI format (using spectral python)
34
+
```python
35
+
--8<--"docs/concepts/src/pixels_01.py"
36
+
```
34
37
35
-
This is commonly used for hyperspectral imagery from airborne or satellite sensors.
The `Signals` class stores spectral data for each pixel in a pandas DataFrame, allowing you to use any column names you choose (e.g. "band_1", "nir", "red_edge"). You can initialize it from a DataFrame, lists, dicts or NumPy arrays.
36
44
37
45
```python
38
-
--8<--"docs/concepts/src/spectral_image_01.py"
46
+
--8<--"docs/concepts/src/signals_01.py"
39
47
```
40
48
41
-
#### 2. Load from GeoTIFF or other geospatial formats (using rasterio)
49
+
However, direct initialization of `Signals` is typically not necessary in practice. When you create a `Signatures` instance, the underlying `Signals` object is automatically generated and managed for you. This section demonstrates the `Signals` class primarily to illustrate how the `Signatures` class (discussed next) is composed internally and to provide insight into the data structure that powers spectral analysis.
42
50
43
-
Perfect for georeferenced data with spatial information.
The `Signatures` class represents spectral data collections by combining spatial coordinates (`Pixels`) with their corresponding spectral values (`Signals`). It provides a unified container that maintains the spatial-spectral relationship, allowing for analysis of spectral information at specific image locations. Internally, the data is stored as pandas DataFrames for efficient operations and indexing.
57
+
58
+
`Signatures` can be initialized in multiple ways. The explicit approach creates each component separately before combining them, providing clarity about the composition:
44
59
45
60
```python
46
-
--8<--"docs/concepts/src/spectral_image_02.py"
61
+
--8<--"docs/concepts/src/signatures_01.py:long"
47
62
```
48
63
49
-
#### 3. Create from numpy array
64
+
For more concise code, you can initialize a `Signatures` object directly from coordinate and signal values:
50
65
51
-
Useful for testing or when you already have image data in memory.
66
+
```python
67
+
--8<--"docs/concepts/src/signatures_01.py:short"
68
+
```
69
+
70
+
Both approaches yield equivalent results when initialized with the same data. You can access and work with the data using various DataFrame operations and conversion methods:
52
71
53
72
```python
54
-
--8<--"docs/concepts/src/spectral_image_03.py"
73
+
--8<--"docs/concepts/src/signatures_01.py:assert"
55
74
```
56
75
57
-
#### 4. Create your own custom image class
76
+
##Shape
58
77
59
-
For specialized file formats or custom processing needs, you can extend the ImageBase class.
The `Shape` class represents geometric shapes that can be associated with images, such as points, lines, and polygons.
60
82
61
83
```python
62
-
--8<--"docs/concepts/src/spectral_image_04.py"
84
+
--8<--"docs/concepts/src/shapes_01.py"
63
85
```
64
86
65
-
## Pixels
87
+
## Spectral Image
66
88
67
-
The `Pixels` class represents spatial coordinates within spectral image, providing a container for *(x, y)* coordinate pairs. It uses pandas DataFrame internally for storage, enabling high-performance operations. The class provides multiple initialization methods and conversion functions to work with different data representations (i.e. DataFrames, list, arrays)
A `SpectralImage` is the primary container for spectral image data. It's a generic class that can wrap different image backends, allowing you to work with various file formats through a unified interface.
93
+
94
+
### Image Initialization Options
95
+
96
+
#### 1. Load from ENVI format (using spectral python)
97
+
98
+
This is commonly used for hyperspectral imagery from airborne or satellite sensors.
68
99
69
100
```python
70
-
--8<--"docs/concepts/src/pixels_01.py"
101
+
--8<--"docs/concepts/src/spectral_image_01.py"
71
102
```
72
103
73
-
##Signals
104
+
#### 2. Load from GeoTIFF or other geospatial formats (using rasterio)
74
105
75
-
The `Signals` class stores spectral data for each pixel in a pandas DataFrame, allowing you to use any column names you choose (e.g. "band_1", "nir", "red_edge"). You can initialize it from a DataFrame, lists, dicts or NumPy arrays.
106
+
Perfect for georeferenced data with spatial information.
76
107
77
108
```python
78
-
--8<--"docs/concepts/src/signals_01.py"
109
+
--8<--"docs/concepts/src/spectral_image_02.py"
79
110
```
80
111
81
-
##Signatures
112
+
#### 3. Create from numpy array
82
113
83
-
The `Signatures` class represents spectral data collections by combining spatial coordinates (`Pixels`) with their corresponding spectral values (`Signals`). It provides a unified container that maintains the spatial-spectral relationship, allowing for analysis of spectral information at specific image locations. Internally, the data is stored as pandas DataFrames for efficient operations and indexing.
114
+
Useful for testing or when you already have image data in memory.
84
115
85
116
```python
86
-
--8<--"docs/concepts/src/signatures_01.py"
117
+
--8<--"docs/concepts/src/spectral_image_03.py"
87
118
```
88
119
89
-
##Shape
120
+
#### 4. Create your own custom image class
90
121
91
-
The `Shape` class represents geometric shapes that can be associated with images, such as points, lines, and polygons.
122
+
For specialized file formats or custom processing needs, you can extend the ImageBase class.
Copy file name to clipboardExpand all lines: docs/concepts/overview.md
+28-7Lines changed: 28 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,10 @@
4
4
5
5
SiaPy follows a modular architecture organized around key components that work together to provide a comprehensive toolkit for spectral image analysis.
6
6
7
-
### Core (`siapy.core`)
7
+
### Core
8
+
9
+
??? note "API Documentation"
10
+
`siapy.core`
8
11
9
12
The foundation of the library providing essential functionality:
10
13
@@ -13,7 +16,10 @@ The foundation of the library providing essential functionality:
13
16
-**Type definitions**: Common types used throughout the library
14
17
-**Configuration**: System paths and global configuration settings
15
18
16
-
### Entities (`siapy.entities`)
19
+
### Entities
20
+
21
+
??? note "API Documentation"
22
+
`siapy.entities`
17
23
18
24
Fundamental data structures that represent spectral imaging data:
19
25
@@ -23,34 +29,49 @@ Fundamental data structures that represent spectral imaging data:
23
29
-**Shapes**: Geometric shapes for images' regions selection and masking
24
30
-**Signatures**: Spectral signatures extracted from images
25
31
26
-
### Datasets (`siapy.datasets`)
32
+
### Datasets
33
+
34
+
??? note "API Documentation"
35
+
`siapy.datasets`
27
36
28
37
Tools for managing and working with datasets:
29
38
30
39
-**Tabular datasets**: Handling tabular data with spectral information
31
40
32
-
### Features (`siapy.features`)
41
+
### Features
42
+
43
+
??? note "API Documentation"
44
+
`siapy.features`
33
45
34
46
Functionality for working with spectral features:
35
47
36
48
-**Features**: Abstractions for feature extraction and selection
37
49
-**Spectral indices**: Calculation of various spectral indices
38
50
39
-
### Transformations (`siapy.transformations`)
51
+
### Transformations
52
+
53
+
??? note "API Documentation"
54
+
`siapy.transformations`
40
55
41
56
Transformation capabilities:
42
57
43
58
-**Co-registration**: Aligning images from different sources
44
59
-**Image processing**: Functions for image manipulation
45
60
46
-
### Optimizers (`siapy.optimizers`)
61
+
### Optimizers
62
+
63
+
??? note "API Documentation"
64
+
`siapy.optimizers`
47
65
48
66
Optimization, hyperparameter tuning and evaluation:
49
67
50
68
-**Optimization**: Machine learning training and optimization of hyperparameters
51
69
-**Evaluation metrics and scoring mechanisms**: Tools for assessing model performance
Copy file name to clipboardExpand all lines: docs/examples/case_study.md
+26-14Lines changed: 26 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
This section offers an overview of a case study based on real-world data.
2
2
3
+
/// Note
3
4
> 💡 **All code snippets** used in this case study are available in the [GitHub repository](https://github.com/siapy/siapy-lib/tree/main/docs/examples/src).
5
+
///
4
6
5
7
To follow along:
6
8
@@ -16,7 +18,9 @@ The hyperspectral dataset used in this case study was acquired using Hyspex push
> **Note**: All hyperspectral data is provided as calibrated reflectance values, ensuring accuracy and reliability for your analysis.
21
+
/// Note
22
+
All hyperspectral data is provided as calibrated reflectance values, ensuring accuracy and reliability for your analysis.
23
+
///
20
24
21
25
### 📁 File Naming Convention
22
26
@@ -47,12 +51,12 @@ Before diving into the examples, verify that your SiaPy installation and data ar
47
51
```
48
52
49
53
/// Warning
54
+
If you encounter issues:
50
55
51
-
If you encounter issues:
52
-
- Check that SiaPy is properly installed and your environment is activated
53
-
- Verify that you've downloaded the example data
54
-
- Ensure the `data_dir` variable points to the correct location of your dataset
55
-
- Make sure both `.img` and `.hdr` files are present in your data directory
56
+
- Check that SiaPy is properly installed and your environment is activated
57
+
- Verify that you've downloaded the example data
58
+
- Ensure the `data_dir` variable points to the correct location of your dataset
59
+
- Make sure both `.img` and `.hdr` files are present in your data directory
56
60
///
57
61
58
62
## 🧪 Source Code Examples
@@ -78,7 +82,8 @@ Before diving into the examples, verify that your SiaPy installation and data ar
78
82
- File metadata and path information
79
83
- Camera identification and associated geometric data
80
84
81
-
> 💡 **Implementation Note**: This script uses SiaPy's property decorators for read-only access to image attributes, following the library's design pattern for consistent data access.
85
+
??? note "Implementation Details"
86
+
This script uses decorators for read-only access to image attributes, following the library's design pattern for consistent data access.
82
87
83
88
**Example:**
84
89
@@ -96,7 +101,8 @@ Before diving into the examples, verify that your SiaPy installation and data ar
96
101
-**Data Extraction**: Methods for extracting spectral signatures and subarrays from specific image regions
97
102
-**Visualization**: Converting hyperspectral data to displayable RGB images with optional histogram equalization
98
103
99
-
> 💡 **Implementation Note**: Notice how methods follow SiaPy's naming convention: converters use `to_` prefix (e.g., `to_numpy()`, `to_signatures()`, `to_display()`), while calculation methods use descriptive verbs.
104
+
??? note "Implementation Details"
105
+
Notice how methods follow SiaPy's naming convention: converters use `to_` prefix (e.g., `to_numpy()`, `to_signatures()`, `to_display()`), while calculation methods use descriptive verbs.
100
106
101
107
### Managing Image Collections
102
108
@@ -116,7 +122,8 @@ Before diving into the examples, verify that your SiaPy installation and data ar
116
122
-**Iteration Patterns**: Iterating through the image collection with standard Python iteration
117
123
-**Filtering and Selection**: Selecting images by specific criteria (e.g., camera ID)
118
124
119
-
> 💡 **Implementation Note**: SpectralImageSet implements standard Python container interfaces, making it behave like a familiar collection type with additional hyperspectral-specific functionality.
125
+
??? note "Implementation Details"
126
+
`SpectralImageSet` implements standard Python container interfaces, making it behave like a familiar collection type with additional hyperspectral-specific functionality.
120
127
121
128
### Interactive Pixel and Area Selection
122
129
@@ -139,7 +146,8 @@ The selected pixels are highlighted in the image below.
139
146
-**User Interaction**: Simple keyboard-based interaction model (press Enter to finish selection)
140
147
-**Results Access**: Accessing the resulting Pixels object and its DataFrame representation
141
148
142
-
> 💡 **Implementation Note**: The `pixels_select_click` function handles the display, interaction, and collection of pixel coordinates in a single operation, simplifying user interaction code.
149
+
??? note "Implementation Details"
150
+
The `pixels_select_click` function handles the display, interaction, and collection of pixel coordinates in a single operation, simplifying user interaction code.
143
151
144
152
**Example:**
145
153
@@ -160,7 +168,8 @@ The selected areas are highlighted in the image below.
160
168
-**Polygon-Based Selection**: Defining complex shapes for region-based analysis
161
169
-**Selection Management**: Organized representation of selected areas for further processing
162
170
163
-
> 💡 **Implementation Note**: Selected areas are returned as a list of Pixels objects, each representing a distinct region that can be separately analyzed or processed.
171
+
??? note "Implementation Details"
172
+
Selected areas are returned as a list of `Pixels` objects, each representing a distinct region that can be separately analyzed or processed.
164
173
165
174
### Image Transformation and Processing
166
175
@@ -179,7 +188,8 @@ The selected areas are highlighted in the image below.
179
188
-**Transformation Calculation**: Computing the mathematical transformation between coordinate systems
180
189
-**Spatial Alignment**: Creating a foundation for aligning multi-sensor hyperspectral data
181
190
182
-
> 💡 **Implementation Note**: The `corregistrator.align()` function computes a transformation matrix that can transform coordinates from one image space to another, essential for multi-sensor data fusion.
191
+
??? note "Implementation Details"
192
+
The `corregistrator.align()` function computes a transformation matrix that can transform coordinates from one image space to another, essential for multi-sensor data fusion.
183
193
184
194
**Example:**
185
195
@@ -196,7 +206,8 @@ The selected areas are highlighted in the image below.
196
206
-**Cross-Spectral Analysis**: Enabling analysis of the same physical regions across different spectral data
197
207
-**Visual Verification**: Displaying both images with highlighted areas to verify correct transformation
198
208
199
-
> 💡 **Implementation Note**: The transformation is applied to the Pixels objects directly, allowing selected regions to be mapped between different spectral ranges while preserving their shape relationships.
209
+
??? note "Implementation Details"
210
+
The transformation is applied to the `Pixels` objects directly, allowing selected regions to be mapped between different spectral ranges while preserving their shape relationships.
200
211
201
212
**Example:**
202
213
@@ -213,7 +224,8 @@ The selected areas are highlighted in the image below.
213
224
-**Normalization**: Area-based normalization for standardizing image intensity distributions
214
225
-**Data Augmentation**: Creating modified versions of images for machine learning training
215
226
216
-
> 💡 **Implementation Note**: All transformation functions follow a consistent input/output pattern, taking NumPy arrays as input and returning the transformed arrays, making them easily composable for complex processing pipelines.
227
+
??? note "Implementation Details"
228
+
All transformation functions follow a consistent input/output pattern, taking NumPy arrays as input and returning the transformed arrays, making them easily composable for complex processing pipelines.
0 commit comments