Image

Scalar Images

class huira.Image_f32
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: huira._huira.Image_f32) -> None

  2. __init__(self: huira._huira.Image_f32, width: int, height: int) -> None

  3. __init__(self: huira._huira.Image_f32, width: int, height: int, fill_value: float) -> None

  4. __init__(self: huira._huira.Image_f32, array: numpy.ndarray[numpy.float32]) -> None

Construct from a numpy array. Single-channel: (H, W). Multi-channel: (H, W, C).

property channels
clear(self: huira._huira.Image_f32) → None
property empty
fill(self: huira._huira.Image_f32, value: float) → None
get_channel(self: huira._huira.Image_f32, channel: int) → huira._huira.Image_f32

Extract a single channel as an Image_f32 (0-indexed).

property height
property resolution
property sensor_bit_depth
property shape
to_numpy(self: huira._huira.Image_f32) → numpy.ndarray[numpy.float32]

Return image data as a numpy array (always copies).

property width
class huira.Image_f64
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: huira._huira.Image_f64) -> None

  2. __init__(self: huira._huira.Image_f64, width: int, height: int) -> None

  3. __init__(self: huira._huira.Image_f64, width: int, height: int, fill_value: float) -> None

  4. __init__(self: huira._huira.Image_f64, array: numpy.ndarray[numpy.float64]) -> None

Construct from a numpy array. Single-channel: (H, W). Multi-channel: (H, W, C).

property channels
clear(self: huira._huira.Image_f64) → None
property empty
fill(self: huira._huira.Image_f64, value: float) → None
get_channel(self: huira._huira.Image_f64, channel: int) → huira._huira.Image_f32

Extract a single channel as an Image_f32 (0-indexed).

property height
property resolution
property sensor_bit_depth
property shape
to_numpy(self: huira._huira.Image_f64) → numpy.ndarray[numpy.float64]

Return image data as a numpy array (always copies).

property width
class huira.Image_u8
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: huira._huira.Image_u8) -> None

  2. __init__(self: huira._huira.Image_u8, width: int, height: int) -> None

  3. __init__(self: huira._huira.Image_u8, width: int, height: int, fill_value: int) -> None

  4. __init__(self: huira._huira.Image_u8, array: numpy.ndarray[numpy.uint8]) -> None

Construct from a numpy array. Single-channel: (H, W). Multi-channel: (H, W, C).

property channels
clear(self: huira._huira.Image_u8) → None
property empty
fill(self: huira._huira.Image_u8, value: int) → None
get_channel(self: huira._huira.Image_u8, channel: int) → huira._huira.Image_f32

Extract a single channel as an Image_f32 (0-indexed).

property height
property resolution
property sensor_bit_depth
property shape
to_numpy(self: huira._huira.Image_u8) → numpy.ndarray[numpy.uint8]

Return image data as a numpy array (always copies).

property width
class huira.Image_u16
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: huira._huira.Image_u16) -> None

  2. __init__(self: huira._huira.Image_u16, width: int, height: int) -> None

  3. __init__(self: huira._huira.Image_u16, width: int, height: int, fill_value: int) -> None

  4. __init__(self: huira._huira.Image_u16, array: numpy.ndarray[numpy.uint16]) -> None

Construct from a numpy array. Single-channel: (H, W). Multi-channel: (H, W, C).

property channels
clear(self: huira._huira.Image_u16) → None
property empty
fill(self: huira._huira.Image_u16, value: int) → None
get_channel(self: huira._huira.Image_u16, channel: int) → huira._huira.Image_f32

Extract a single channel as an Image_f32 (0-indexed).

property height
property resolution
property sensor_bit_depth
property shape
to_numpy(self: huira._huira.Image_u16) → numpy.ndarray[numpy.uint16]

Return image data as a numpy array (always copies).

property width
class huira.Image_u32
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: huira._huira.Image_u32) -> None

  2. __init__(self: huira._huira.Image_u32, width: int, height: int) -> None

  3. __init__(self: huira._huira.Image_u32, width: int, height: int, fill_value: int) -> None

  4. __init__(self: huira._huira.Image_u32, array: numpy.ndarray[numpy.uint32]) -> None

Construct from a numpy array. Single-channel: (H, W). Multi-channel: (H, W, C).

property channels
clear(self: huira._huira.Image_u32) → None
property empty
fill(self: huira._huira.Image_u32, value: int) → None
get_channel(self: huira._huira.Image_u32, channel: int) → huira._huira.Image_f32

Extract a single channel as an Image_f32 (0-indexed).

property height
property resolution
property sensor_bit_depth
property shape
to_numpy(self: huira._huira.Image_u32) → numpy.ndarray[numpy.uint32]

Return image data as a numpy array (always copies).

property width
class huira.Image_u64
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: huira._huira.Image_u64) -> None

  2. __init__(self: huira._huira.Image_u64, width: int, height: int) -> None

  3. __init__(self: huira._huira.Image_u64, width: int, height: int, fill_value: int) -> None

  4. __init__(self: huira._huira.Image_u64, array: numpy.ndarray[numpy.uint64]) -> None

Construct from a numpy array. Single-channel: (H, W). Multi-channel: (H, W, C).

property channels
clear(self: huira._huira.Image_u64) → None
property empty
fill(self: huira._huira.Image_u64, value: int) → None
get_channel(self: huira._huira.Image_u64, channel: int) → huira._huira.Image_f32

Extract a single channel as an Image_f32 (0-indexed).

property height
property resolution
property sensor_bit_depth
property shape
to_numpy(self: huira._huira.Image_u64) → numpy.ndarray[numpy.uint64]

Return image data as a numpy array (always copies).

property width

Image Bundles

class huira.ImageBundle_f32
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: huira._huira.ImageBundle_f32, image: huira._huira.Image_f32) -> None

  2. __init__(self: huira._huira.ImageBundle_f32, image: huira._huira.Image_f32, alpha: huira._huira.Image_f32) -> None

property alpha
property bit_depth
property color_space
property gamma_value
property image
property scaling
class huira.ColorSpaceHint

Members:

Linear

sRGB

Gamma

Unknown

Gamma = <ColorSpaceHint.Gamma: 2>
Linear = <ColorSpaceHint.Linear: 0>
Unknown = <ColorSpaceHint.Unknown: 3>
__init__(self: huira._huira.ColorSpaceHint, value: int) → None
property name
sRGB = <ColorSpaceHint.sRGB: 1>
property value
class huira.PixelScaling

How an image with a sensor bit depth (a sensor response) is written: Counts, as the sensor’s digital numbers (the default), or FullRange, stretched over the file’s range for display.

Members:

Counts

FullRange

Counts = <PixelScaling.Counts: 0>
FullRange = <PixelScaling.FullRange: 1>
__init__(self: huira._huira.PixelScaling, value: int) → None
property name
property value

Image I/O

See Saving Images for how a sensor response is written to each format.

huira.read_png(filepath: os.PathLike, read_alpha: bool = True) → huira::ImageBundle<huira::SpectralBins<3ul, 600, 750, 500, 600, 380, 500> >

Read a PNG into an RGB Bundle

huira.read_png_mono(filepath: os.PathLike, read_alpha: bool = True) → huira._huira.ImageBundle_f32

Read a PNG into a Float Bundle

huira.write_png(*args, **kwargs)

Overloaded function.

  1. write_png(filepath: os.PathLike, bundle: huira._huira.ImageBundle_f32) -> None

Write a PNG of bundle.bit_depth (8 or 16) bits. Values are written as they are, labelled with bundle.color_space (convert with linear_to_srgb for a picture). A sensor response is written as its DN (scaled by left-bit replication, with an sBIT chunk) unless bundle.scaling is FullRange. Values that are not finite are written as 0.

  1. write_png(filepath: os.PathLike, bundle: huira::ImageBundle<huira::SpectralBins<3ul, 600, 750, 500, 600, 380, 500> >) -> None

Write a PNG of bundle.bit_depth (8 or 16) bits. Values are written as they are, labelled with bundle.color_space (convert with linear_to_srgb for a picture). A sensor response is written as its DN (scaled by left-bit replication, with an sBIT chunk) unless bundle.scaling is FullRange. Values that are not finite are written as 0.

huira.read_jpeg(filepath: os.PathLike) → huira::ImageBundle<huira::SpectralBins<3ul, 600, 750, 500, 600, 380, 500> >

Read a JPEG into an RGB Bundle

huira.read_jpeg_mono(filepath: os.PathLike) → huira._huira.ImageBundle_f32

Read a JPEG into a Float Bundle

huira.write_jpeg(*args, **kwargs)

Overloaded function.

  1. write_jpeg(filepath: os.PathLike, bundle: huira._huira.ImageBundle_f32, quality: int = 95) -> None

  2. write_jpeg(filepath: os.PathLike, bundle: huira::ImageBundle<huira::SpectralBins<3ul, 600, 750, 500, 600, 380, 500> >, quality: int = 95) -> None

huira.read_tiff(filepath: os.PathLike, read_alpha: bool = True) → huira::ImageBundle<huira::SpectralBins<3ul, 600, 750, 500, 600, 380, 500> >

Read a TIFF into an RGB Bundle

huira.read_tiff_mono(filepath: os.PathLike, read_alpha: bool = True) → huira._huira.ImageBundle_f32

Read a TIFF into a Float Bundle

huira.write_tiff(*args, **kwargs)

Overloaded function.

  1. write_tiff(filepath: os.PathLike, bundle: huira._huira.ImageBundle_f32, description: str = ‘’, artist: str = ‘’) -> None

Write a Float Bundle to a TIFF file of bundle.bit_depth (8 or 16) bits. A sensor response is written as its raw DN (0-4095 for 12 bits), with MaxSampleValue, unless bundle.scaling is FullRange. Values that are not finite are written as 0.

  1. write_tiff(filepath: os.PathLike, bundle: huira::ImageBundle<huira::SpectralBins<3ul, 600, 750, 500, 600, 380, 500> >, description: str = ‘’, artist: str = ‘’) -> None

Write an RGB Bundle to a TIFF file. See the Float Bundle overload.

huira.read_fits(filepath: os.PathLike) → tuple

Read a single-plane FITS image: returns (Image_f32, FitsMetadata). A sensor response written by write_fits (with ADCBITS) comes back as it was, DN / (2^bits - 1), with its sensor_bit_depth; other integer images are normalized by SATURATE or their type’s range; other float images are returned as they are. Undefined pixels are NaN.

huira.write_fits(filepath: os.PathLike, image: huira._huira.Image_f32, bit_depth: int = -32, metadata: huira._huira.FitsMetadata = FitsMetadata(custom_keywords=0), scaling: huira._huira.PixelScaling = <PixelScaling.Counts: 0>) → None

Write an Image_f32 to FITS, with BITPIX 8, 16 or 32 (unsigned integers), -32 or -64 (floats). A sensor response (an image with a sensor_bit_depth) is written as the sensor’s digital numbers at every BITPIX, unless scaling is FullRange; with fewer bits than the sensor, the lowest are dropped and BSCALE scales the stored values back to DN. Undefined pixels are NaN in a float file and BLANK in an integer one.