Spectral Cube exports. More...
Data Structures | |
struct | CVSCuboid |
Spectral Cuboid. More... | |
struct | CVSRange |
Index range. More... | |
Enumerations | |
enum | CVSCubeEncoding { CVSVP_BandInterleavedByLine = 0 , CVSVP_BandSequential = 1 , CVSVP_BandInterleavedByPixel = 2 } |
Cube Encoding. More... | |
enum | CVSCubeType { CVSCT_ContinuousCube = 0 , CVSCT_LinearNonOwningCube = 1 , CVSCT_MappedCube = 2 , CVSCT_StackedCube = 3 } |
Cube Type. More... | |
enum | CVSNormalizationMethod { CVSNM_AverageReferences1 = 0 } |
Normalization Method. More... | |
Functions | |
cvbres_t | CVSCreateContinuousCube (cvbdim_t NumberOfSamples, cvbdim_t NumberOfLines, cvbdim_t NumberOfBands, cvbdatatype_t DataType, CVSCubeEncoding BufferLayout, CVCOMPOSITE &ImageCube) |
Initializes a continuous image cube. More... | |
cvbres_t | CVSCreateConvertedCube (CVCOMPOSITE ImageCubeIn, CVSCubeEncoding TargetCubeEncoding, CVCOMPOSITE &ImageCubeOut) |
Converts cube to given TargetCubeEncoding. More... | |
cvbres_t | CVSCreateCroppedCube (CVCOMPOSITE ImageCube, const CVSCuboid &ClipBox, cvbbool_t TargetMapped, CVCOMPOSITE &ImageCubeOut) |
Retrieves a cropped image cube. More... | |
cvbres_t | CVSCreateCubeFromPointer (void *pCubeMemory, cvbdim_t NumbersOfDimensions[], cvbdatatype_t DataType, intptr_t IncrementsOfDimensions[], PFFINALRELEASE ReleaseCallback, void *pPrivate, CVCOMPOSITE &ImageCubeOut) |
Creates a Linear Non-Owning Cube from pointer. More... | |
cvbres_t | CVSCreateDuplicatedContinuousCube (CVCOMPOSITE ImageCubeIn, CVCOMPOSITE &ImageCubeOut) |
Duplicates the image cube as continuous cube. More... | |
cvbres_t | CVSCreateStackedCube (IMG ImageArray[], size_t NumberOfImages, CVSCubeEncoding SourceInterleaveType, CVCOMPOSITE &ImageCube) |
Initializes a Stacked ImageCube using an array of images. More... | |
cvbres_t | CVSCreateTransposedCube (CVCOMPOSITE ImageCubeIn, CVSCubeEncoding TargetCubeEncoding, cvbbool_t TargetMapped, CVCOMPOSITE &ImageCubeOut) |
Transposes an ImageCube. More... | |
cvbres_t | CVSCubeGetBufferView (CVCOMPOSITE ImageCube, IMG &BufferView) |
Retrieves the buffer view of the image cube. More... | |
cvbres_t | CVSCubeGetDatatype (CVCOMPOSITE ImageCube, cvbdatatype_t &DataType) |
Retrieves data type of cube. More... | |
cvbres_t | CVSCubeGetLinearAccess (CVCOMPOSITE ImageCube, void *&pBaseAddress, intptr_t &SampleInc, intptr_t &LineInc, intptr_t &BandInc) |
Retrieves the spectral linear access data from the cube. More... | |
cvbres_t | CVSCubeGetMetaData (CVCOMPOSITE ImageCube, CVSMETADATA &MetaData) |
Get the MetaData of an Image Cube object. More... | |
cvbres_t | CVSCubeGetSlice (CVCOMPOSITE ImageCube, cvbdim_t PlaneIndex, cvbbool_t TargetMapped, IMG &ImageOut) |
Retrieves a slice of an image cube. More... | |
cvbres_t | CVSCubeGetSpectrumAsDouble (CVCOMPOSITE ImageCube, cvbdim_t SampleIndex, cvbdim_t LineIndex, double SpectralPixelValues[], size_t &NumberOfBands) |
Retrieves a vector containing the pixel value of each band as double. More... | |
cvbres_t | CVSCubeGetSpectrumAsInteger (CVCOMPOSITE ImageCube, cvbdim_t SampleIndex, cvbdim_t LineIndex, cvbval_t SpectralPixelValues[], size_t &NumberOfBands) |
Retrieves a vector containing the pixel value of each band as integer. More... | |
cvbres_t | CVSCubeGetType (CVCOMPOSITE ImageCube, CVSCubeType &CubeType) |
Retrieves Cube type. More... | |
cvbres_t | CVSCubeSetMetaData (CVCOMPOSITE ImageCube, CVSMETADATA MetaData) |
Set the MetaData of an Image Cube object. More... | |
cvbres_t | CVSCubeSwapSamplesAndLines (CVCOMPOSITE ImageCubeIn, CVCOMPOSITE &ImageCubeOut) |
Swaps the dimensions for samples and lines and returns a copy. More... | |
cvbres_t | CVSLoadEnviFile (const char *HeaderFileName, const char *BinaryFileName, CVCOMPOSITE &ImageCubeOut) |
Load an ENVI-formated spectral cube. More... | |
cvbres_t | CVSLoadEnviFileW (const wchar_t *HeaderFileName, const wchar_t *BinaryFileName, CVCOMPOSITE &ImageCubeOut) |
Load an ENVI-formated spectral cube. More... | |
cvbres_t | CVSWriteEnviFile (CVCOMPOSITE ImageCubeIn, const char *HeaderFileName, const char *BinaryFileName) |
Write an ImageCube as ENVI. More... | |
cvbres_t | CVSWriteEnviFileW (CVCOMPOSITE ImageCubeIn, const wchar_t *HeaderFileName, const wchar_t *BinaryFileName) |
Write an ImageCube as ENVI. More... | |
Spectral Cube exports.
An Image Cube (or Cube) is a representation of a hyper spectral image. To put it in perspective with conventional images: A gray scale image has one value for each pixel. A RGB image has three values for each pixel. An Image Cube however contain of n values for each pixel. These values are located in the spectral domain which is also referred to as band. The number of bands is equal to the number of wavelengths defined in the Image Cube.
In CVB an Image Cube object consists of a Meta Data and a buffer view.
The dimensions of the Image Cube are referred to as sample in the range [0, Samples[, line in the range [0, Lines[ and band in the range [0, Bands[ . The dimensions of an Image in CVB are referred to as x in the range [0, width[ , y in the range [0, height[ and z in the range [0, dimensions[ The Interleaved value in the Meta Data defines the mapping between these two spaces.
There are four distinct types of Image Cubes: Continuous Image Cubes, Mapped Image Cubes, Stacked Image Cubes and Linear Non-Owning Cubes
For details see function documentation.
enum CVSCubeEncoding |
Cube Encoding.
Defines how the mapping between a typical x-y image and samples-lines-bands is done. When acquiring images the interleaved type depends on the technology the imaging sensor uses to acquire spectral data. A sequence of images is returned by the camera in the following manner: [xSensor ySensor time] Now depending on the spectral imaging sensor the these dimensions are mapped to samples, lines and bands
When viewing a spectral cube the spatial dimensions are mapped in the following manner:
enum CVSCubeType |
Cube Type.
Defines a the type of the cube
Normalization Method.
Defines the method used for normalizing the spectral cube with a white and a black reference.
Default case: CVSNM_AverageReferences1 This means that first white and the black reference are averaged over samples and lines [Samples x Lines x Bands] --> [1 x 1 x Bands]). The forumla used for calculating the normalization is then: (ImgCube - BRef) / (WRef - BRef)
cvbres_t CVSCreateContinuousCube | ( | cvbdim_t | NumberOfSamples, |
cvbdim_t | NumberOfLines, | ||
cvbdim_t | NumberOfBands, | ||
cvbdatatype_t | DataType, | ||
CVSCubeEncoding | BufferLayout, | ||
CVCOMPOSITE & | ImageCube | ||
) |
Initializes a continuous image cube.
The buffer is not initialized with any values
[in] | NumberOfSamples | Number of samples |
[in] | NumberOfLines | Number of lines |
[in] | NumberOfBands | Number of bands |
[in] | DataType | Data type of each element |
[in] | BufferLayout | Buffer interleaved type |
[out] | ImageCube | handle |
cvbres_t CVSCreateConvertedCube | ( | CVCOMPOSITE | ImageCubeIn, |
CVSCubeEncoding | TargetCubeEncoding, | ||
CVCOMPOSITE & | ImageCubeOut | ||
) |
Converts cube to given TargetCubeEncoding.
Creates a continous image cube and copies data. The number of Samples, Lines and Bands are equal, but the order in the buffer is different.
[in] | ImageCubeIn | Input image cube handle |
[in] | TargetCubeEncoding | Target Cube encoding |
[out] | ImageCubeOut | Converted image cube handle |
cvbres_t CVSCreateCroppedCube | ( | CVCOMPOSITE | ImageCube, |
const CVSCuboid & | ClipBox, | ||
cvbbool_t | TargetMapped, | ||
CVCOMPOSITE & | ImageCubeOut | ||
) |
Retrieves a cropped image cube.
There are two options on cropping an image cube: Mapped and by Buffer When cropping an image cube with TargetMapped = true, the buffer is not copied. Instead the target image cube contains a mapped bufferView which references the source bufferView. There reference count of the source image cube is incremented internally. When cropping in image cube with TargetMapped = false, the cropped subset of the buffer is duplicated to the new image cube.
[in] | ImageCube | Handle to the input image cube |
[in] | ClipBox | The borders of the Clipbox (Min and Max) are included in the target |
[in] | TargetMapped | Flag to define if the output image cube shall be cropped by mapping or by creating a new buffer |
[out] | ImageCubeOut | Handle to the output image cube |
cvbres_t CVSCreateCubeFromPointer | ( | void * | pCubeMemory, |
cvbdim_t | NumbersOfDimensions[], | ||
cvbdatatype_t | DataType, | ||
intptr_t | IncrementsOfDimensions[], | ||
PFFINALRELEASE | ReleaseCallback, | ||
void * | pPrivate, | ||
CVCOMPOSITE & | ImageCubeOut | ||
) |
Creates a Linear Non-Owning Cube from pointer.
The resulting image cubes is a Linear Non-Owning Cube.
[in] | pCubeMemory | Base pointer to memory |
[in] | NumbersOfDimensions | An array of size 3 containing {numberOfSamples, numberOfLines, numberOfBands} |
[in] | DataType | cvbdatatype_t of the whole image cube |
[in] | IncrementsOfDimensions | An array of size 3 containing {samplesIncrement, linesIncrement, bandsIncrement}. The interleaved type is deduced by the value of the increments. This results in xInc < yInc < zInc. |
[in] | ReleaseCallback | Release callback function. This callback function is called when the reference count of ImageCubeOut reaches zero. |
[in,out] | pPrivate | Pointer which is passed to the ReleaseCallback to store user state like an object pointer. |
[out] | ImageCubeOut | Variable that receives the handle to the newly created image cube. |
cvbres_t CVSCreateDuplicatedContinuousCube | ( | CVCOMPOSITE | ImageCubeIn, |
CVCOMPOSITE & | ImageCubeOut | ||
) |
Duplicates the image cube as continuous cube.
The resulting image Cube is a deep copy of the input but contains a continuous buffer.
[in] | ImageCubeIn | Any kind of image cube handle |
[out] | ImageCubeOut | Continuous image cube |
cvbres_t CVSCreateStackedCube | ( | IMG | ImageArray[], |
size_t | NumberOfImages, | ||
CVSCubeEncoding | SourceInterleaveType, | ||
CVCOMPOSITE & | ImageCube | ||
) |
Initializes a Stacked ImageCube using an array of images.
Creates a stacked ImageCube using the given image arrays without copying any buffer.
[in] | ImageArray | Single planed image array |
[in] | NumberOfImages | Number of images |
[in] | SourceInterleaveType | Buffer interleaved type of all images |
[out] | ImageCube | handle |
cvbres_t CVSCreateTransposedCube | ( | CVCOMPOSITE | ImageCubeIn, |
CVSCubeEncoding | TargetCubeEncoding, | ||
cvbbool_t | TargetMapped, | ||
CVCOMPOSITE & | ImageCubeOut | ||
) |
Transposes an ImageCube.
Creates a transposed ImageCube. The number of Samples, Lines and Bands are equal but the order in the buffer is different The TargetMapped flag determines the way the ImageCube is transposed:
[in] | ImageCubeIn | Input image cube handle |
[in] | TargetCubeEncoding | Target Cube encoding |
[in] | TargetMapped | Set this flag to false to transpose the buffer (slow). Otherwise to true in order to transpose the view (fast) |
[out] | ImageCubeOut | Transposed image cube handle |
cvbres_t CVSCubeGetBufferView | ( | CVCOMPOSITE | ImageCube, |
IMG & | BufferView | ||
) |
Retrieves the buffer view of the image cube.
The buffer view is an image handle which contains the buffer of the image cube. This image is of size Width x Height x Dimensions. These dimensions can mapped to samples, lines and bands depending on the interleaved type.
[in] | ImageCube | handle |
[out] | BufferView | View on the Buffer as Image handle |
cvbres_t CVSCubeGetDatatype | ( | CVCOMPOSITE | ImageCube, |
cvbdatatype_t & | DataType | ||
) |
Retrieves data type of cube.
[in] | ImageCube | Any kind of image cube handle |
[out] | DataType | Datatype of the cube |
cvbres_t CVSCubeGetLinearAccess | ( | CVCOMPOSITE | ImageCube, |
void *& | pBaseAddress, | ||
intptr_t & | SampleInc, | ||
intptr_t & | LineInc, | ||
intptr_t & | BandInc | ||
) |
Retrieves the spectral linear access data from the cube.
[in] | ImageCube | Only for linear cubes |
[out] | pBaseAddress | Will receive the pointer to the first pixel of the first line if linear access is possible |
[out] | SampleInc | Will receive the increment in the samples direction |
[out] | LineInc | Will receive the increment in the lines direction |
[out] | BandInc | Will receive the increment in the bands direction |
cvbres_t CVSCubeGetMetaData | ( | CVCOMPOSITE | ImageCube, |
CVSMETADATA & | MetaData | ||
) |
Get the MetaData of an Image Cube object.
This function returns the MetaData object of its Image Cube.
[in] | ImageCube | handle |
[out] | MetaData | handle |
cvbres_t CVSCubeGetSlice | ( | CVCOMPOSITE | ImageCube, |
cvbdim_t | PlaneIndex, | ||
cvbbool_t | TargetMapped, | ||
IMG & | ImageOut | ||
) |
Retrieves a slice of an image cube.
Get an image handle on a certain plane of the image cube. The image slice returned is a deep copy of the the actual image plane in the cube The slice axis depends on the cube encoding:
[in] | ImageCube | handle |
[in] | PlaneIndex | Plane Index in the range [0, numberOfPlanes[ |
[in] | TargetMapped | When set to true the output image is a mapped view of the original buffer. |
[out] | ImageOut | Slice as Image handle |
cvbres_t CVSCubeGetSpectrumAsDouble | ( | CVCOMPOSITE | ImageCube, |
cvbdim_t | SampleIndex, | ||
cvbdim_t | LineIndex, | ||
double | SpectralPixelValues[], | ||
size_t & | NumberOfBands | ||
) |
Retrieves a vector containing the pixel value of each band as double.
Retrieves the pixel value of each band at the given position. This function casts each pixel value from the original datatype to double. To get the matching wavelengths call CVSCubeGetMetaData and CVSMetaDataGetAsFloatArray with CVSFI_Wavelength.
[in] | ImageCube | Handle to the input image cube |
[in] | SampleIndex | Index of the Sample to get the Spectral Intensity from |
[in] | LineIndex | Index of the Line to get the Spectral Intensity from |
[in,out] | SpectralPixelValues | Pixel values as double array. To get the array size of field name set SpectralPixelValues to nullptr |
[in,out] | NumberOfBands | Size of the allocated SpectralPixelValues array. To get the array size of SpectralPixelValues set SpectralPixelValues to nullptr |
cvbres_t CVSCubeGetSpectrumAsInteger | ( | CVCOMPOSITE | ImageCube, |
cvbdim_t | SampleIndex, | ||
cvbdim_t | LineIndex, | ||
cvbval_t | SpectralPixelValues[], | ||
size_t & | NumberOfBands | ||
) |
Retrieves a vector containing the pixel value of each band as integer.
Retrieves the pixel value of each band at the given position. This function casts each pixel value from the original datatype to cvbval_t To get the matching wavelengths call CVSCubeGetMetaData and CVSMetaDataGetAsFloatArray with CVSFI_Wavelength.
[in] | ImageCube | Handle to the input image cube |
[in] | SampleIndex | Index of the Sample to get the Spectral Intensity from |
[in] | LineIndex | Index of the Line to get the Spectral Intensity from |
[in,out] | SpectralPixelValues | Pixel values as cvbval_t array. To get the array size of field name set SpectralPixelValues to nullptr |
[in,out] | NumberOfBands | Size of the allocated SpectralPixelValues array. To get the array size of SpectralPixelValues set SpectralPixelValues to nullptr |
cvbres_t CVSCubeGetType | ( | CVCOMPOSITE | ImageCube, |
CVSCubeType & | CubeType | ||
) |
Retrieves Cube type.
[in] | ImageCube | Any kind of image cube handle |
[out] | CubeType | Cube type |
cvbres_t CVSCubeSetMetaData | ( | CVCOMPOSITE | ImageCube, |
CVSMETADATA | MetaData | ||
) |
Set the MetaData of an Image Cube object.
This function changes the MetaData object of the Image Cube. The previous MetaData object is discarded. This function does not check if the given MetaData is suitable to the image cube (eg. same dimensions like buffer).
[in] | ImageCube | handle |
[in] | MetaData | handle needs to match with view and buffer of image cube |
cvbres_t CVSCubeSwapSamplesAndLines | ( | CVCOMPOSITE | ImageCubeIn, |
CVCOMPOSITE & | ImageCubeOut | ||
) |
Swaps the dimensions for samples and lines and returns a copy.
The output Spectral Cube contains a swapped bufferView of the same type. In the meta data the definition for interleave stays the same. The change can be seen in the number of samples and number of lines which are swapped in the output. The function is for interoperability between vendors with different definitions for Samples and Lines in the ENVI-Format
[in] | ImageCubeIn | Handle to the input image cube |
[out] | ImageCubeOut | Contains a deep copy of the original image cube. Samples and Lines are swapped |
cvbres_t CVSLoadEnviFile | ( | const char * | HeaderFileName, |
const char * | BinaryFileName, | ||
CVCOMPOSITE & | ImageCubeOut | ||
) |
Load an ENVI-formated spectral cube.
No validation of mandatory fields is done
[in] | HeaderFileName | Path to header file (*.hdr) |
[in] | BinaryFileName | Path to binary file (*.bin) |
[out] | ImageCubeOut | Cube handle |
cvbres_t CVSLoadEnviFileW | ( | const wchar_t * | HeaderFileName, |
const wchar_t * | BinaryFileName, | ||
CVCOMPOSITE & | ImageCubeOut | ||
) |
Load an ENVI-formated spectral cube.
No validation of mandatory fields is done
[in] | HeaderFileName | Path to header file (*.hdr) |
[in] | BinaryFileName | Path to binary file (*.bin) |
[out] | ImageCubeOut | Cube handle |
cvbres_t CVSWriteEnviFile | ( | CVCOMPOSITE | ImageCubeIn, |
const char * | HeaderFileName, | ||
const char * | BinaryFileName | ||
) |
Write an ImageCube as ENVI.
No validation of mandatory fields is done
[in] | ImageCubeIn | Cube handle |
[in] | HeaderFileName | Path to header file (*.hdr) |
[in] | BinaryFileName | Path to binary file (*.bin) |
cvbres_t CVSWriteEnviFileW | ( | CVCOMPOSITE | ImageCubeIn, |
const wchar_t * | HeaderFileName, | ||
const wchar_t * | BinaryFileName | ||
) |
Write an ImageCube as ENVI.
No validation of mandatory fields is done
[in] | ImageCubeIn | ImageCube Cube handle |
[in] | HeaderFileName | Path to header file (*.hdr) |
[in] | BinaryFileName | Path to binary file (*.bin) |