Measurements (HSI Cubes, etc.)
MeasurementList
- class LuxFlux.fluxEngineNET.MeasurementList : IDisposable
A measurement list
This contains a list of measurements.
Public Functions
- ValueType? GetValueType (int index)
Get the value type of a measurement
Get the value type of the data in a given measurement. This indicates a measurement was made in intensities or reflectances.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Return:
The value type of the measurement, if it is one of the supported types in the ValueType enumeration, or
null
if the value type could not be determined or it is a non-supported type.
- string GetName (int index)
Get the name of the measurement
Many file formats allow the user to specify a name for a given measurement. If such a name is present it will be returned.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Return:
The name of the measurement, if set,
null
otherwise
- string GetDescription (int index)
Get the description of the measurement
Many file formats allow the user to specify a description for a given measurement. If such a description is present it will be returned.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Return:
The description of the measurement, if set,
null
otherwise
- Structure GetStructure (int index)
Get the tensor structure of a measurement.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Return:
The tensor structure of a measurement
- unsafe IntPtr GetRawData (int index)
Get the raw data of the measurement
This unsafe method returns the raw pointer to the memory region that contains the data of the measurement
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Return:
A pointer to the raw data of the measurement
- UIntPtr GetRawDataSize (int index)
Get the size of the memory area storing the raw data of the measurement (in bytes)
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Return:
The size of the memory area containing the raw data of the measurement, in bytes
- ReadOnlyTensorView GetTensorView (int index)
Get a tensor view of the raw data of the measurement
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Return:
A tensor view of the raw data of the measurement
- unsafe void CopyInto (int index, IntPtr targetPointer, DataType dataType, Int64[] dimensions, Int64[] strides = null)
Copy the data of the measurement into a user-provided memory region
This unsafe method copies the raw data of the measurement into a memory region provided by the user.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Param targetPointer:
The raw pointer of the target memory region to copy the data into
- Param dataType:
The data type of the target memory region. This must be provided by the user so that a check can be performed that the data type matches.
- Param dimensions:
The dimensions of the target memory region. This must be provided by the user so that a check can be performed that the data type matches.
- Param strides:
The strides of the target memory region. If
null
trivial strides are assumed.
- void CopyInto (int index, GenericTensor tensor)
Copy the data of the measurement into a user-supplied tensor
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Param tensor:
The tensor to copy the data into. It must have the correct structure to fit the measurement data.
- CalibrationInfo GetCalibrationInfo (int index)
Get the calibration info of the measurement.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Return:
The calibration info for the given measurement
- bool IsIlluminationCorrected (int index)
Get whether the measurement was already illumination corrected.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Return:
Whether the measurement as already illumination corrected
- bool HasReference (int index, string referenceName)
Does a given measurement have a specific reference?
Sometimes the file format loaders are able to automatically load reference data that was stored in conjunction with the actual measurement. This method returns whether such reference data for a given measurement exists.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Param referenceName:
The name of the reference. This must be
"WhiteReference"
,"DarkReference"
, or"IlluminationReference"
at the moment. (This is case-sensitive.)- Return:
Whether a specific reference measurement is present in the measurement
- Structure GetReferenceStructure (int index, string referenceName)
Get the tensor structure of a reference measurement
Sometimes the file format loaders are able to automatically load reference data that was stored in conjunction with the actual measurement. This method returns whether such reference data for a given measurement exists.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Param referenceName:
The name of the reference. This must be
"WhiteReference"
,"DarkReference"
, or"IlluminationReference"
at the moment. (This is case-sensitive.)
- unsafe IntPtr GetReferenceRawData (int index, string referenceName)
Get the raw data of a reference measurement
This unsafe method copies the raw data of the measurement’s reference into a memory region provided by the user.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Param referenceName:
The name of the reference. This must be
"WhiteReference"
,"DarkReference"
, or"IlluminationReference"
at the moment. (This is case-sensitive.)- Return:
A pointer to the raw data of the measurement’s reference
- UIntPtr GetReferenceRawDataSize (int index, string referenceName)
Get the size of the memory area storing the raw data of the measurement’s reference (in bytes)
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Param referenceName:
The name of the reference. This must be
"WhiteReference"
,"DarkReference"
, or"IlluminationReference"
at the moment. (This is case-sensitive.)- Return:
The size of the memory area containing the raw data of the measurement’s reference, in bytes
- ReadOnlyTensorView GetReferenceTensorView (int index, string referenceName)
Get a tensor view of the raw data of the measurement’s reference
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Param referenceName:
The name of the reference. This must be
"WhiteReference"
,"DarkReference"
, or"IlluminationReference"
at the moment. (This is case-sensitive.)- Return:
A tensor view of the raw data of the measurement’s reference
- unsafe void CopyReferenceInto (int index, string referenceName, IntPtr targetPointer, DataType dataType, Int64[] dimensions, Int64[] strides)
Copy the data of the measurement’s reference into a user-provided memory region
This unsafe method copies the raw data of the measurement into a memory region provided by the user.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Param referenceName:
The name of the reference. This must be
"WhiteReference"
,"DarkReference"
, or"IlluminationReference"
at the moment. (This is case-sensitive.)- Param targetPointer:
The raw pointer of the target memory region to copy the data into
- Param dataType:
The data type of the target memory region. This must be provided by the user so that a check can be performed that the data type matches.
- Param dimensions:
The dimensions of the target memory region. This must be provided by the user so that a check can be performed that the data type matches.
- Param strides:
The strides of the target memory region. If
null
trivial strides are assumed.
- void CopyReferenceInto (int index, string referenceName, GenericTensor tensor)
Copy the data of the measurement’s reference into a user-supplied tensor
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Param referenceName:
The name of the reference. This must be
"WhiteReference"
,"DarkReference"
, or"IlluminationReference"
at the moment. (This is case-sensitive.)- Param tensor:
The tensor to copy the data into. It must have the correct structure to fit the measurement’s reference’s data.
- bool IsHSICube (int index)
Is a given measurement a HSI cube?
While the only format supported as of now is ENVI, future versions of fluxEngine will support other types of measurements. For this reason this function exists to check whether a measurement that was loaded from disk is actually a HSI cube.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Return:
Whether a specific measurement is a HSI cube
- double[] GetWavelengths (int index)
Obtain the wavelengths of a given measurement
Formats that store spectral data, such as ENVI for hyperspectral data cubes, come with information about which wavelengths are assigned to the spectral dimension of the data.
- Param index:
The index of the measurement, starting at
0
for the first measurement in the list- Return:
The list of wavelengths associated with the spectral dimension of the measurement
- 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
- int Count { get; set; }
The number of measurements in the measurement list.
Public Static Functions
- MeasurementList CreateForHSICube (Handle handle, MeasurementHSICubeMemoryInput input)
Create a new HSI cube measurement from raw data
Creates a measurement list that contains a single HSI cube measurement from raw data that the user must supply. Please see the
MeasurementHSICubeMemoryInput
structure for further details on the data that must be provided for this to succeed.The resulting measurement list may then be saved via one of the overloads of the
IO.SaveMeasurementList()
functions.A copy of the data provided by the user will be created in this function. The user should ensure that there is enough RAM available to store such a copy.
- Param handle:
The fluxEngine handle
- Param input:
The input parameters required to create the measurement
- Return:
The newly created measurement list
- MeasurementList CreateForHSICube (Handle handle, ProcessingQueueSet queueSet, MeasurementHSICubeMemoryInput input)
Create a new HSI cube measurement from raw data
Creates a measurement list that contains a single HSI cube measurement from raw data that the user must supply. Please see the
MeasurementHSICubeMemoryInput
structure for further details on the data that must be provided for this to succeed.The resulting measurement list may then be saved via one of the overloads of the
IO.SaveMeasurementList()
functions.A copy of the data provided by the user will be created in this function. The user should ensure that there is enough RAM available to store such a copy.
This overload allows the user to specify a processing queue set to perform any data processing that may be required when creating the cube. If an invalid processing queue set is specified the default processing queue set of the handle will be used, instead, which is equivalent to calling the overload without the queueSet parameter.
- Param handle:
The fluxEngine handle
- Param queueSet:
The processing queue set to use for processing
- Param input:
The input parameters required to create the measurement
- Return:
The newly created measurement list
- MeasurementList CreateForHSICube (Handle handle, ProcessingQueueSet queueSet, MeasurementHSICubeBufferInput input)
Create a new HSI cube measurement from PushBroom buffers
This will create a new HSI cube measurement from a set of PushBroom buffer containers the user must provide. This is useful if the user created one or more buffer containers via the
Util.CreateBufferContainer()
overload that accepts a recording context, and added data to them viaBufferContainer.AddLastResult()
to record data from a device. In that case the recording can be combined to a HSI cube that the user may then save to disk.The list of buffers should be provided via the input parameter in form of a
MeasurementHSICubeBufferInput
structure. See the documentation of that structure for details on what is required to be specified.The resulting measurement list may then be saved via one of the overloads of the
IO.SaveMeasurementList()
functions.A copy of the data provided by the user will be created in this function. The user should ensure that there is enough RAM available to store such a copy.
This overload allows the user to specify a processing queue set to perform any data processing that may be required when creating the cube. If an invalid processing queue set is specified the default processing queue set of the handle will be used, instead, which is equivalent to calling the overload without the queueSet parameter.
- Param handle:
The fluxEngine handle
- Param queueSet:
The processing queue set to use for processing
- Param input:
The input parameters required to create the measurement
- Return:
The newly created measurement list
- class Structure
Measurement structure
This describes the tensor structure of a measurement. It is returned by either
MeasurementList.GetStructure()
orMeasurementList.GetReferenceStructure()
and describes the tensor that contains the measurement data.Properties
- int Order { get; set; }
The tensor order of the measurement
For HSI cubes this will be 3.
- Int64[] Dimensions { get; set; }
The dimensions of the measurement
- Int64[] Strides { get; set; }
The strides of the measurement
The strides are only relevant when accessing the internal data directly without making a copy, via the
MeasurementList.GetRawData()
orMeasurementList.GetReferenceRawData
methods.
MeasurementHSICubeMemoryInput
- class LuxFlux.fluxEngineNET.MeasurementHSICubeMemoryInput
Input data for creating a HSI cube measurement
This structure may be used when creating a measurement from data that is stored in user memory.
Public Members
- string Name
The name of the measurement (this may be
null
)
- ValueType ValueType = ValueType.Intensity
The value type of the measurement
This indicates if the measurement was made in intensities or reflectances.
- HSICube_StorageOrder StorageOrder = HSICube_StorageOrder.BIP
The storage order of the user-supplied data
Note that internally the storage order will always be converted to BIP storage order. This here indicates only the order in which the user has stored the data.
- ReadOnlyTensorView Data
A tensor view of the data the user wants to provide
It is up to the user to construct this tensor view object correctly for the data they provide.
- double[] Wavelengths
A vector of the wavelengths of the cube
The number of wavelengths must match the corresponding dimension of the supplied cube data.
- MeasurementHSICubeMemoryInput WhiteReference = null
Optional: the white reference measurement
If not
null
this should point to a structure of the same type that contains the data of the white reference.
- MeasurementHSICubeMemoryInput DarkReference = null
Optional: the dark reference measurement
If not
null
this should point to a structure of the same type that contains the data of the dark reference.
- MeasurementHSICubeMemoryInput IlluminationReference = null
Optional: the illumination reference measurement
If not
null
this should point to a structure of the same type that contains the data of the illumination reference.
- CalibrationInfo CalibrationInfo = null
Optional: calibration info of the cube
- bool IsIlluminationCorrected = false
Optional: indicate that the measurement has already been illumination corrected
If the measurement is in intensities (or radiances), if this is
true
it indicates that the illumination correction has already been performed for this measurement.
MeasurementHSICubeBufferInput
- class LuxFlux.fluxEngineNET.MeasurementHSICubeBufferInput
Input data for creating a HSI cube measurement from buffer containers
This structure describes the information required to create a HSI cube measurement a list of
BufferContainer
objects that the user has used to record data via a recording processing context.Public Members
- string Name
The name of the measurement (this may be
null
)
- ValueType ValueType = ValueType.Intensity
The value type of the measurement
This indicates if the measurement was made in intensities or reflectances.
- BufferContainer[] BufferContainers
The buffer containers to concatenate
The structure of the buffer containers is verified to be compatible with a HSI cube structure. It is assumed that the data in the containers is in BIP storage order, as that is the storage order returned by all recording processing contexts.
All buffer containers must match in structure, but may contain a varying number of lines. They will all be concatenated.
- double[] Wavelengths
A vector of the wavelengths of the cube
The number of wavelengths must match the corresponding dimension of the supplied buffer containers.
- ReferenceMeasurement WhiteReference = null
Optional: the white reference
The user may provide the same structure that is also returned by the context creation functions to indicate that the white reference should be saved together with the measurement.
- ReferenceMeasurement DarkReference = null
Optional: the dark reference
The user may provide the same structure that is also returned by the context creation functions to indicate that the dark reference should be saved together with the measurement.
- ReferenceMeasurement IlluminationReference = null
Optional: the illumination reference
The user may provide the same structure that is also returned by the context creation functions to indicate that the illumination reference should be saved together with the measurement.
- CalibrationInfo CalibrationInfo = null
Optional: calibration info of the cube
- bool IsIlluminationCorrected = false
Optional: indicate that the measurement has already been illumination corrected
If the measurement is in intensities (or radiances), if this is
true
it indicates that the illumination correction has already been performed for this measurement.