Manual Access of Calibration Files

Note

Support for parsing calibration files is only available with special licenses for fluxEngine.

CalibrationFile

class LuxFlux.fluxEngineNET.CalibrationFile : IDisposable

A parsed calibration file

Public Types

enum CameraType

The type of camera the calibration file describes

Currently only PushBroom cameras are supported.

Values:

Unknown

The camera type is unknown

PushBroom

The file describes a PushBroom camera

enum WavelengthAxis

Which axis is the wavelength axis

For PushBroom cameras this determines which axis is the wavelength axis. (The other axis will then be the spatial axis.)

Values:

X

Wavelengths are along the X direction

Y

Wavelengths are along the Y direction

enum MapFlag

Flags that influence obtaining smile/keystone maps

Values:

AbsoluteCoordinates

Get absolute coordinates instead of shifts

Smile/keystone maps typically only contain the relative shifts to the pixel coordinate. By activating this flag, absolute source pixel coordinates will be returned in the map instead.

enum SelectedCorrection

Selected corrections to apply

Values:

Smile

Enable Smile correction

Keystone

Enable Keystone correction

Public Functions

CameraType GetCameraType ()

Get the camera type the calibration file was created for

Return:

The camera type the calibration file was created for

WavelengthAxis GetWavelengthAxis ()

Get the wavelength axis

If the calibration file is not for a PushBroom camera any attempt to call this method will result in an exception.

Return:

The axis along which the wavelengths are represented in the raw sensor image

double[] GetEffectiveWavelengths (Handle handle, ROIInput roi)

Get the effective wavelengths of a raw image for a given ROI/binning setting

If the calibration file is not for a PushBroom camera any attempt to call this method will result in an exception.

Param handle:

The fluxEngine handle

Param roi:

The selected ROI for which to obtain this information

Return:

The list of effective wavelengths for that chosen ROI for each pixel along the spectral axis

double[] GetEffectiveFWHM (Handle handle, ROIInput roi)

Get the effective FWHM of a raw image for a given ROI/binning setting

If the calibration file is not for a PushBroom camera any attempt to call this method will result in an exception.

Param handle:

The fluxEngine handle

Param roi:

The selected ROI for which to obtain this information

Return:

The list of effective FWHM for that chosen ROI for each pixel along the spectral axis

double[] GetEffectiveNominalWavelengths (Handle handle, ROIInput roi)

Get the nominal wavelength list of a raw image for a given ROI/binning setting

If the calibration file is not for a PushBroom camera any attempt to call this method will result in an exception.

Param handle:

The fluxEngine handle

Param roi:

The selected ROI for which to obtain this information

Return:

The list of effective nominal wavelengths for that chosen ROI. The list will in general not have the same size as the size of the spectral axis; but ROI will have an effect on which parts of the nominal wavelength list will be selected.

GenericTensor GetSmileMap (Handle handle, ROIInput roi, MapFlag flags)

Obtain a map of the smile shifts / absolute source coordinates for a given ROI/binning setting

For each pixel in the target image, the smile correction map determines the offset along the wavelength axis required to reach the coordinates this pixel has in the source image.

Depending on flags the resulting map will either contain relative offsets, or it will contain absolute coordinates. See the MapFlag enumeration for details on the possible flags.

If the calibration file is not for a PushBroom camera any attempt to call this method will result in an exception.

Param handle:

The fluxEngine handle

Param roi:

The selected ROI for which to obtain this information

Param flags:

Flags that influence the behavior of this method; see the MapFlag enumeration for a list of possible flags. (This may be 0 to indicate that the default behavior is to be used.)

Return:

A newly allocated tensor that contains the requested map. It will be of double data type, order 2. The first dimension will be the ROI height, the second dimension the ROI width.

GenericTensor GetKeystoneMap (Handle handle, ROIInput roi, MapFlag flags)

Obtain a map of the keystone shifts / absolute source coordinates for a given ROI/binning setting

For each pixel in the target image, the keystone correction map determines the offset along the spatial axis required to reach the coordinates this pixel has in the source image.

Depending on flags the resulting map will either contain relative offsets, or it will contain absolute coordinates. See the MapFlag enumeration for details on the possible flags.

If the calibration file is not for a PushBroom camera any attempt to call this method will result in an exception.

Param handle:

The fluxEngine handle

Param roi:

The selected ROI for which to obtain this information

Param flags:

Flags that influence the behavior of this method; see the MapFlag enumeration for a list of possible flags. (This may be 0 to indicate that the default behavior is to be used.)

Return:

A newly allocated tensor that contains the requested map. It will be of double data type, order 2. The first dimension will be the ROI height, the second dimension the ROI width.

GenericTensor GetXMap (Handle handle, ROIInput roi, MapFlag flags)

Obtain a map of the shifts / absolute source coordinates along the X axis for a given ROI/binning setting

For each pixel in the target image, the X correction map determines the offset along the X axis required to reach the coordinates this pixel has in the source image.

Depending on flags the resulting map will either contain relative offsets, or it will contain absolute coordinates. See the MapFlag enumeration for details on the possible flags.

This will be identical to either GetSmileMap() or GetKeystoneMap(), depending on whether the wavelength axis is in X or Y direction.

If the calibration file is not for a PushBroom camera any attempt to call this method will result in an exception.

Param handle:

The fluxEngine handle

Param roi:

The selected ROI for which to obtain this information

Param flags:

Flags that influence the behavior of this method; see the MapFlag enumeration for a list of possible flags. (This may be 0 to indicate that the default behavior is to be used.)

Return:

A newly allocated tensor that contains the requested map. It will be of double data type, order 2. The first dimension will be the ROI height, the second dimension the ROI width.

GenericTensor GetYMap (Handle handle, ROIInput roi, MapFlag flags)

Obtain a map of the shifts / absolute source coordinates along the Y axis for a given ROI/binning setting

For each pixel in the target image, the Y correction map determines the offset along the Y axis required to reach the coordinates this pixel has in the source image.

Depending on flags the resulting map will either contain relative offsets, or it will contain absolute coordinates. See the MapFlag enumeration for details on the possible flags.

This will be identical to either GetSmileMap() or GetKeystoneMap(), depending on whether the wavelength axis is in X or Y direction.

If the calibration file is not for a PushBroom camera any attempt to call this method will result in an exception.

Param handle:

The fluxEngine handle

Param roi:

The selected ROI for which to obtain this information

Param flags:

Flags that influence the behavior of this method; see the MapFlag enumeration for a list of possible flags. (This may be 0 to indicate that the default behavior is to be used.)

Return:

A newly allocated tensor that contains the requested map. It will be of double data type, order 2. The first dimension will be the ROI height, the second dimension the ROI width.

GenericTensor ApplyCorrections (Handle handle, ROIInput roi, SelectedCorrection selectedCorrections, ReadOnlyTensorView inputImage)

Apply camera corrections to a source image

Apply all camera corrections selected in selectedCorrections to the provided source image. The corrected image will be returned.

If the calibration file is not for a PushBroom camera any attempt to call this method will result in an exception.

Param handle:

The fluxEngine handle

Param roi:

The selected ROI for which to obtain this information

Param selectedCorrections:

Which corrections to apply to the input image. If 0 is supplied the input image is copied into the output image. Otherwise any bitwise OR combination of the SelectedCorrection enumeration may be specified here.

Param inputImage:

The input image to correct. This may be of any data type supported by fluxEngine (it will automatically be converted internally if necessary), but it must be a tensor of order 2 with dimensions [ROI height, ROI width].

Return:

A newly allocated tensor that contains the corrected image. It will be of double data type, order 2. The first dimension will be the ROI height, the second dimension the ROI width.

void Dispose ()

Dispose of this object

This will free all resources associated with this object. The object should not be used anymore after a call to this method.

Properties

string[] Warnings { get; set; }

The warnings (if any) that occurred during parsing

Some calibration files may be parseable but contain information that can be unintuitive when applied. In that case the Parse() method will still be successful, but the resulting object will have a couple of warning messages, which can be retrieved by this method.

string CameraModel { get; set; }

The camera model specified in the calibration file

This may be null if this was not specified in the calibration file.

string CameraSerial { get; set; }

The camera serial number specified in the calibration file

This may be null if this was not specified in the calibration file.

string OpticsSerial { get; set; }

The optics serial number specified in the calibration file

This may be null if this was not specified in the calibration file.

string CalibrationProcessVersion { get; set; }

The calibration process version specified in the calibration file

This may be null if this was not specified in the calibration file.

string CalibrationDataVersion { get; set; }

The calibration data version specified in the calibration file

This may be null if this was not specified in the calibration file.

EffectiveActiveArea ActiveArea { get; set; }

The active area

If the calibration file is not for a PushBroom camera any attempt to access this property will result in an exception.

ListOrCoefficients > WavelengthCalibrations { get; set; }

All wavelength calibration information specified in the calibration file

If the calibration file is not for a PushBroom camera any attempt to access this property will result in an exception.

ListOrCoefficients > FWHMCalibrations { get; set; }

All FWHM calibration information specified in the calibration file

If the calibration file is not for a PushBroom camera any attempt to access this property will result in an exception.

ListOrCoefficients > NominalWavelengthLists { get; set; }

All nominal wavelength lists specified in the calibration file

If the calibration file is not for a PushBroom camera any attempt to access this property will result in an exception.

Coefficients2D > SmileCorrections { get; set; }

All smile corrections specified in the calibration file

If the calibration file is not for a PushBroom camera any attempt to access this property will result in an exception.

Coefficients2D > KeystoneCorrections { get; set; }

All keystone corrections specified in the calibration file

If the calibration file is not for a PushBroom camera any attempt to access this property will result in an exception.

Public Static Functions

CalibrationFile Parse (Handle handle, byte[] fileContents, ParserOptions options)

Parse a calibration file

Param handle:

The fluxEngine handle

Param fileContents:

The contents of the calibration file to parse

Param options:

Options that influence the parsing and validation process

Return:

The parsed calibration file

class Coefficients2D

2D Coefficients for Smile/Keystone Correction

This structure is returned when querying the smile/keystone correction coefficients specified in the calibration file.

Public Members

double[] Coefficients

The coefficients

A set of coefficients for a 2D polyonmial describing the relative coordinate shift in the direction for which these coefficients were returned

Int64 BinningSpectral = 1

The spectral binning for which these coefficients are valid

Int64 BinningSpatial = 1

The spatial binning for which these coefficients are valid

class EffectiveActiveArea

The active area on the sensor

This structure describes the active area of the sensor that is used to actually capture data. This may be less than the total size of the sensor, because the optics may not project onto the full sensor.

Public Members

Int64 OffsetX = 0

The X offset (on the unbinned sensor image)

Int64 OffsetY = 0

The Y offset (on the unbinned sensor image)

Int64 Width = 0

The width (on the unbinned sensor image)

Int64 Height = 0

The height (on the unbinned sensor image)

bool ExplicitlySpecified = false

Whether the active area was explicitly specified

If this is true the calibration file contained an explicit mention of the active area.

If this is false, OffsetX and OffsetY will be 0, and the Width and Height will correspond to the entire size of the sensor. (Implicit active area that covers the full sensor.)

(Note that an explicitly specified active area may still cover the entire sensor.)

class ListOrCoefficients

1D List or Coefficients

This structure describes a 1D list of values, or a set of coefficients that may be used to generate a list of values.

The primary usage of this data structure is for the wavelength calibration of a PushBroom camera. Either this contains a list of values (the size of the active area of the sensor), or it contains a set of polyonmial coefficients that can be used to reconstruct this list.

Public Members

double[] List

Either the list of values, or the set of polynomial coefficients

Int64 Binning = 1

The binning factor (in spectral direction) for which this information is provided

bool AreCoefficients = false

Whether the values in list are coefficients (true) or just individual values (false)

class ParserOptions

Options that influence the calibration file parser

These options must be specified to allow the calibration file parser to provide the appropriate diagnostics. The options are mostly information that describes properties of the underlying sensor, so that it can be verified that the calibration file can be used in conjunction with the sensor.

Public Members

Int64 SensorWidth = 0

The width of the entire sensor in pixels.

Int64 SensorHeight = 0

The height of the entire sensor in pixels.

Int64[] BinningHorizontalValues

The supported horizontal binning values

If this is null, it is assumed that there is only one horizontal binning that is supported, which is 1.

If this is non-null, an element with the value 1 must be present.

Int64[] BinningVerticalValues

The supported vertical binning values

If this is null, it is assumed that there is only one horizontal binning that is supported, which is 1.

If this is non-null, an element with the value 1 must be present.

class ROIInput

Calibration File ROI Input

There are two types of query functions for the calibration file: those that query the exact information that was stored, and those that query effective information.

When querying effective information this structure must be passed so that the user-specified information about binning and ROI can be considered before returning effective data.

Public Members

Int64 BinningHorizontal = 1

The horizontal binning factor

This must be a value supported by the sensor.

Int64 BinningVertical = 1

The vertical binning factor

This must be a value supported by the sensor.

Int64 OffsetX = 0

The offset X value of the ROI (applied to the binned active area) in pixels

Int64 OffsetY = 0

The offset Y value of the ROI (applied to the binned active area) in pixels

Int64 Width = 0

The width of the ROI (applied to the binned active area) in pixels

Int64 Height = 0

The height of the ROI (applied to the binned active area) in pixels