Metadata

enum hv_interleave

Data interleave mode.

Defines the memory layout of the file. To achieve good performance, as suitable interleave mode should be used for a given application.

  • BSQ: The full image for each spectral band is stored consecutively in memory. This format is effective for spatial access.

  • BIP: All spectral bands for each pixel is stored consecutively, followed by a line of pixels. This format is effective for spectral access.

  • BIL: Each line of pixels is stored consecutively for each band. This format achieves improved spatial access along the width of the image while retaining good performance for spectral access as well.

A good default for images is the BIL format which is balanced between spatial and spectral access.

Remark: Has the same ABI as

Values:

enumerator HV_INTERLEAVE_B_S_Q

Band sequential.

Samples fully contiguous.

enumerator HV_INTERLEAVE_B_I_P

Lines sequential.

Bands fully contiguous.

enumerator HV_INTERLEAVE_B_I_L

Lines sequential.

Samples fully contiguous.

enum hv_axis

Named axes, independent of memory ordering.

Remark: Has the same ABI as

Values:

enumerator HV_AXIS_BANDS

<No documentation available>

enumerator HV_AXIS_LINES

<No documentation available>

enumerator HV_AXIS_SAMPLES

<No documentation available>

typedef struct hv_shape_meta hv_shape_meta_t

Shape and memory layout metadata.

typedef struct hv_wavelength_meta hv_wavelength_meta_t

Specification of image wavelengths.

typedef struct hv_measurement_info hv_measurement_info_t

Information about image values.

typedef struct hv_hsi_header hv_hsi_header_t

Header information.

The header type contains a union of the metadata supported by the different HSI file formats. PAM files ignore certain entries, while ENVI and the custom yaml format support the full set of keys.

typedef size_t *hv_dimension_t

Represents a finite integer-numbered dimension or an infinite dimension.

  • NULL values indicate an infinite-sized dimension.

  • Any other value indicates a finite-sized dimension.

typedef struct hv_shape hv_shape_t

Represents the dimensions of an image.

void hv_dimension_free(hv_dimension_t dimension)

Frees the memory associated with a HVDimension.

Parameters:

dimension – HVDimension to free.

hv_hsi_header_t *hv_hsi_header_default(void)

Returns a default header.

Returns:

Boxed HVHeader.

void hv_hsi_header_free(hv_hsi_header_t **header)

Frees the memory associated with a boxed HVHeader.

Parameters:

header – Boxed HVHeader to free.

Vec_uint8_t hv_hsi_header_get(hv_hsi_header_t const *header, slice_ref_uint8_t key)

Get arbitrary metadata from the header.

This function returns the value as a valid json string.

Parameters:
  • header – Reference to HSIHeader.

  • key – Key of the metadata to retrieve.

Returns:

Value of the metadata as a json string.

int32_t hv_hsi_header_set(hv_hsi_header_t *header, slice_ref_uint8_t key, slice_ref_uint8_t value)

Set an arbitrary metadata value on the header.

This function takes a json string as input and sets the metadata value.

Parameters:
  • header – Reference to HSIHeader.

  • key – Key to set the value to.

  • value – Must be a valid json string.

hv_dimension_t hv_shape_meta_bands(hv_shape_meta_t const *meta)

Returns the bands dimension of the ShapeMeta.

Parameters:

meta – Reference to ShapeMeta.

Returns:

Bands as HVDimension.

void hv_shape_meta_free(hv_shape_meta_t **meta)

Frees the memory associated with a boxed ShapeMeta.

Parameters:

meta – Boxed ShapeMeta to free.

hv_shape_meta_t *hv_shape_meta_from_raw_dim(size_t width, size_t height, size_t depth, hv_interleave_t interleave)

Creates a ShapeMeta from raw dimensions and interleave.

Parameters:
  • width – Width dimension.

  • height – Height dimension.

  • depth – Depth dimension.

  • interleave – Interleave mode.

Returns:

Boxed ShapeMeta.

hv_shape_meta_t *hv_shape_meta_from_shape_with_interleave(hv_shape_t shape, hv_interleave_t interleave)

Creates a ShapeMeta from a Shape and interleave.

Parameters:
  • shape – HVShape to use.

  • interleave – Interleave mode.

Returns:

Boxed ShapeMeta.

hv_dimension_t hv_shape_meta_get_axis_dim(hv_shape_meta_t const *meta, hv_axis_t axis)

Returns the dimension for the specified axis.

Parameters:
  • meta – Reference to ShapeMeta.

  • axis – Axis to query.

Returns:

Dimension as HVDimension.

hv_shape_t hv_shape_meta_get_shape(hv_shape_meta_t const *meta)

Returns the canonical shape from the ShapeMeta.

Parameters:

meta – Reference to ShapeMeta.

Returns:

HVShape representing the canonical shape.

hv_interleave_t hv_shape_meta_interleave(hv_shape_meta_t const *meta)

Returns the interleave mode of the ShapeMeta.

Parameters:

meta – Reference to ShapeMeta.

Returns:

Interleave mode.

hv_dimension_t hv_shape_meta_lines(hv_shape_meta_t const *meta)

Returns the lines dimension of the ShapeMeta.

Parameters:

meta – Reference to ShapeMeta.

Returns:

Lines as HVDimension.

hv_shape_meta_t *hv_shape_meta_ratio(hv_shape_meta_t *shape, hv_shape_meta_t *other)

Returns the ratio of two ShapeMeta objects.

Parameters:
  • shape – Boxed ShapeMeta.

  • other – Boxed ShapeMeta to divide by.

Returns:

Boxed ShapeMeta representing the ratio.

hv_dimension_t hv_shape_meta_samples(hv_shape_meta_t const *meta)

Returns the samples dimension of the ShapeMeta.

Parameters:

meta – Reference to ShapeMeta.

Returns:

Samples as HVDimension.

int32_t hv_shape_meta_set_axis_dim(hv_shape_meta_t *meta, hv_axis_t axis, hv_dimension_t value)

Sets the dimension for the specified axis.

Parameters:
  • meta – Mutable reference to ShapeMeta.

  • axis – Axis to set.

  • value – Dimension value as HVDimension.

Return values:
  • 0 – Ok

  • nonzero – Error

int32_t hv_shape_meta_set_bands(hv_shape_meta_t *meta, hv_dimension_t bands)

Sets the bands dimension of the ShapeMeta.

Parameters:
  • meta – Mutable reference to ShapeMeta.

  • bands – Bands as HVDimension.

Return values:
  • 0 – Ok

  • nonzero – Error

void hv_shape_meta_set_interleave(hv_shape_meta_t *meta, hv_interleave_t interleave)

Set the interleave mode of the ShapeMeta.

Parameters:
  • meta – Reference to ShapeMeta.

  • interleave – Interleave mode to set.

int32_t hv_shape_meta_set_lines(hv_shape_meta_t *meta, hv_dimension_t lines)

Sets the lines dimension of the ShapeMeta.

Parameters:
  • meta – Mutable reference to ShapeMeta.

  • lines – Lines as HVDimension.

Return values:
  • 0 – Ok

  • nonzero – Error

int32_t hv_shape_meta_set_samples(hv_shape_meta_t *meta, hv_dimension_t samples)

Sets the samples dimension of the ShapeMeta.

Parameters:
  • meta – Mutable reference to ShapeMeta.

  • samples – Samples as HVDimension.

Return values:
  • 0 – Ok

  • nonzero – Error

int32_t hv_shape_meta_to_array_shape_finite(hv_shape_meta_t const *meta, Vec_size_t *_out)

Converts the ShapeMeta to a finite array shape.

Parameters:
  • meta – Reference to ShapeMeta.

  • _out – Output parameter for the resulting shape vector.

Return values:
  • 0 – Ok

  • nonzero – Error

hv_shape_meta_t *hv_shape_meta_with_slice(hv_shape_meta_t const *shape, hv_slice_desc_t desc)

Returns a sliced ShapeMeta using the provided descriptor.

Parameters:
  • shape – Reference to ShapeMeta.

  • desc – Slice descriptor.

Returns:

Boxed ShapeMeta representing the sliced shape.

struct hv_wavelength_meta
#include <hv-sdk.h>

Specification of image wavelengths.

Public Members

hv_wavelength_unit_t unit

Unit of the wavelength values.

Vec_double_t band_data

List of wavelength values.

The value at index i corresponds to the wavelength at output band index i.

struct hv_measurement_info
#include <hv-sdk.h>

Information about image values.

Public Members

hv_measurement_unit_t unit

What the measurement represents.

hv_measurement_limits_t *limits

Value limits after scaling.

double *scaling

Optional scaling.

Applied as 1/scaling multiplied by the stored values

struct hv_hsi_header
#include <hv-sdk.h>

Header information.

The header type contains a union of the metadata supported by the different HSI file formats. PAM files ignore certain entries, while ENVI and the custom yaml format support the full set of keys.

Public Members

hv_shape_meta_t *shape

Raw shape information.

hv_dtype_t dtype

Image data type.

char *description

Optional image description.

Vec_size_t *default_bands

Optional default band selection (mainly used for visualization).

hv_endianness_t byte_order

Data byte order (little-endian or big-endian).

hv_wavelength_meta_t *wavelength_info

Optional wavelength specification.

hv_measurement_info_t *measurement_info

Optional information about the image values.

hv_capture_meta_t *capture

Optional information about the capture conditions.

char *time

Optional time stamp.

size_t *data_offset

Optional data offset (only used for PAM/ENVI).

hv_hsi_header_private_t *_priv

<No documentation available>

struct hv_shape
#include <hv-sdk.h>

Represents the dimensions of an image.

Public Members

hv_dimension_t bands

The spectral bands of the image.

hv_dimension_t samples

This is usually the height of the image.

If the image was captured using a line-scan hyper-spectral camera, this is also the number of line images captured.

hv_dimension_t lines

This is the width of the image.

For line-scan cameras, it is the length of a single line.