Streams¶
Caution
The stream API is in early development and may change rapidly.
-
typedef struct hv_stream hv_stream_t¶
Stream type.
-
typedef RefDynFnMut4_int32_size_hv_array_ptr_size_ptr_hv_array_ptr_ptr_t hv_stream_map_cb_t¶
A wrapper for a C-compatible closure used to map over elements in an HSI stream.
This type is used in FFI to pass a user-provided callback function from C to Rust, allowing custom mapping operations on each element of a hyperspectral image stream. The closure receives the following arguments:
c_int: return code (typically 0 for success, negative for error)usize: Index of the element in the stream (plane index)HVBoxed<HVDynArray>: dynamic array representing the image plane*mut usize: Output parameter for the mapped index*mut *mut HVDynArray: Output parameter for the mapped plane
-
void hv_stream_chunk_free(hv_stream_chunk_t **chunk)¶
Frees the memory associated with a boxed HVStreamChunk.
- Parameters:
chunk – Boxed HVStreamChunk to free.
- Returns:
Nothing.
-
size_t hv_stream_chunk_get_index(hv_stream_chunk_t const *chunk)¶
Returns the index of the chunk.
- Parameters:
chunk – Reference to the HVStreamChunk.
- Returns:
The index of the chunk.
-
size_t hv_stream_chunk_get_n_planes(hv_stream_chunk_t const *chunk)¶
Returns the number of planes in the chunk.
- Parameters:
chunk – Reference to the HVStreamChunk.
- Returns:
Number of planes in the chunk.
-
hv_array_t const *hv_stream_chunk_get_plane(hv_stream_chunk_t const *chunk, size_t index)¶
Returns a reference to the plane at the specified index in the chunk.
- Parameters:
chunk – Reference to the HVStreamChunk.
index – Index of the plane to retrieve.
- Returns:
Optionally a reference to the HVDynArray plane, or None if out of bounds.
-
hv_stream_chunks_t hv_stream_chunks_iter(hv_stream_t *stream, size_t chunk_size)¶
Creates a chunk iterator for the stream with the specified chunk size.
- Parameters:
stream – Boxed HSIStream to iterate over.
chunk_size – Number of planes per chunk.
- Returns:
HVStreamChunks iterator.
-
hv_stream_chunk_t *hv_stream_chunks_next(hv_stream_chunks_t *iter)¶
Returns the next chunk from the chunk iterator.
- Parameters:
iter – Mutable reference to HVStreamChunks iterator.
- Returns:
Optionally a boxed HVStreamChunk, or None if iteration is finished.
-
void hv_stream_free(hv_stream_t **stream)¶
Frees the memory associated with a boxed HSIStream.
- Parameters:
stream – Boxed HSIStream to free.
- Returns:
Nothing.
-
hv_stream_t *hv_stream_map(hv_stream_t *stream, hv_hsi_header_t *header, hv_stream_map_cb_t f)¶
Maps each element of the stream using a user-provided callback function.
- Parameters:
stream – Boxed HSIStream to map over.
header – Boxed header to use for the output stream.
f – Callback function to apply to each element.
- Returns:
Boxed HSIStream with mapped elements.