Basics#

IO#

hsi.open(path, /)#

Open a hyper-spectral image file.

The format is auto-detected using the path extension. Currently, PAM (.pam), ENVI (.hdr/.raw), and Custom (.yml) are supported.

Parameters:

path (str) – Path to the hyper-spectral image.

Returns:

The opened file.

Return type:

DynamicHSImage

hsi.write(image, path)#

Write an image to a file.

The format is auto-detected using the path extension. Currently, PAM (.pam), ENVI (.hdr/.raw), and Custom (.yml) are supported.

Parameters:
  • image (HSImage) – Image to write.

  • path (str) – File output path. The extension determines the output file type.

Useful global definitions#

class hsi.Shape(bands, samples, lines)#

Describes the shape of a hyper-spectral image.

Parameters:
  • bands (int) –

  • samples (int) –

  • lines (int) –

bands#

The spectral bands of the image.

lines#

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

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.

class hsi.ButeoPamType#

Special PAM-formats for Buteo machine output

New = ButeoPamType.New#
Old = ButeoPamType.Old#

Axes#

To make operations independent of memory ordering, the library uses the a type to specify axes:

class hsi.Axis#
Bands = Axis.Bands#
Lines = Axis.Lines#
Samples = Axis.Samples#

For convenience, the following shorthands are included:

hsi.lines = hsi.Axis.Lines#
hsi.samples = hsi.Axis.Samples#
hsi.bands = hsi.Axis.Bands#

Data types#

The library currently uses its own internal types that are analogous to NumPy’s datatypes (no complex numbers for now). This might change in the future. The types are marked with the following tag type:

class hsi.DType#

Supported pixel value datatypes. Represents each of the supported underlying types of a dynamic array.

F16 = hsi.float16#
F32 = hsi.float32#
F64 = hsi.float64#
S16 = hsi.int16#
S32 = hsi.int32#
S64 = hsi.int64#
S8 = hsi.int8#
U16 = hsi.uint16#
U32 = hsi.uint32#
U64 = hsi.uint64#
U8 = hsi.uint8#

For convenience, the following shorthands are included:

hsi.uint8 = hsi.DType.U8#
hsi.int8 = hsi.DType.S8#
hsi.uint16 = hsi.DType.U16#
hsi.int16 = hsi.DType.S16#
hsi.uint32 = hsi.DType.U32#
hsi.int32 = hsi.DType.S32#
hsi.uint64 = hsi.DType.U64#
hsi.int64 = hsi.DType.S64#
hsi.float32 = hsi.DType.F32#
hsi.float64 = hsi.DType.F64#