Spectral Cube object. More...
#include <cvb/spectral/cube.hpp>
Inherited by WrappedCube.
Public Member Functions | |
std::unique_ptr< Cube > | Clone () |
Copies the memory to a new instance of a cube. More... | |
CubeType | Type () const |
Retrieves the type of this cube object. More... | |
class DataType | DataType () const |
Retrieves the data type of this cube object. More... | |
std::unique_ptr< Cube > | Transpose (CubeEncoding targetView) const |
Creates a transposed cube. More... | |
std::unique_ptr< Cube > | Map (CubeRange spectralCubeoid) |
Creates a cropped cube. More... | |
Cvb::ImagePtr | BufferView () const |
Retrieves the buffer view of the cube. More... | |
MetaDataPtr | MetaData () const |
Retrieves the meta data object of the cube. More... | |
bool | TryLinearAccess (LinearAccessData &linearAccessOut) const noexcept |
Retrieve linear access of cube data without throwing an exception. More... | |
LinearAccessData | LinearAccess () const |
Retrieve linear access of cube data. More... | |
template<typename T > | |
std::vector< T > | SpectralDensity (int sampleIndex, int lineIndex) const |
Retrieves spectral density at given pixel. More... | |
void | Save (Cvb::String EnviHeader, Cvb::String EnviBinary) const |
Writes this cube object to ENVI-format. More... | |
std::unique_ptr< Cube > | SwapSamplesAndLines () const |
Swaps the dimensions for samples and lines and returns a deep copy. More... | |
void * | Handle () const noexcept |
Returns C-API style handle to the Cube. More... | |
Static Public Member Functions | |
static std::unique_ptr< Cube > | Create (int numSamples, int numLines, int numBands, DataType dataType, CubeEncoding bufferLayout=CubeEncoding::BandInterleavedByLine) |
Creates a Continuous Cube object. More... | |
static std::unique_ptr< Cube > | FromImages (const std::vector< ImagePtr > &images, CubeEncoding bufferLayout) |
Initializes a stacked cube using an array of images. More... | |
static std::unique_ptr< Cube > | Load (Cvb::String EnviHeader, Cvb::String EnviBinary) |
Static function Loads a cube from ENVI. More... | |
static std::unique_ptr< Cube > | FromHandle (HandleGuard< Cube > &&guard) |
Creates cube from a classic API handle. More... | |
Protected Member Functions | |
bool | TryBufferView (ImagePtr &bufferViewOut) const noexcept |
Retrieves the buffer view of the cube without throwing an exception. More... | |
bool | TryMetaData (MetaDataPtr &metaDataOut) const noexcept |
Retrieves the meta data object of the cube without throwing an exception. More... | |
Spectral Cube object.
An Image Cube (or Cube) is a representation of a hyper spectral image. 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
In the CVB++ wrapper the Cube object covers the following cube types: Continuous Image Cubes, Mapped Image Cubes, Stacked Image Cubes The Linear Non-Owning Cube is covered by the WrappedCube as this Cube holds potential dangers.
|
inline |
Retrieves the buffer view of the cube.
Any | exception derived from std::exception including CvbException. |
The buffer view is the shared pointer to object containing the image. This image encapsulates the buffer of the cube. This image is of size width x height x dimensions. These dimensions can be mapped to samples, lines and bands depending on the Cvb::Spectral::CubeEncoding of this cube.
|
inline |
Copies the memory to a new instance of a cube.
Any | exception derived from std::exception including CvbException. |
In cases the source cube has a mapped view only this particular view is copied
|
inlinestatic |
Creates a Continuous Cube object.
[in] | numSamples | Number of Samples |
[in] | numLines | Number of Lines |
[in] | numBands | Number of Bands |
[in] | dataType | Data type of each pixel value |
[in] | bufferLayout | View perspective on the buffer |
Any | exception derived from std::exception including CvbException. |
Retrieves the data type of this cube object.
Any | exception derived from std::exception including CvbException. |
This function can be called with any type of cube
|
inlinestatic |
Creates cube from a classic API handle.
[in] | guard | Life time guard for C-API handle. |
Any | exception derived from std::exception including CvbException. |
The Cube takes ownership of the handle, so you must share it before using this function.
|
inlinestatic |
Initializes a stacked cube using an array of images.
[in] | images | Single planed image array of equal size and datatype |
[in] | bufferLayout | Interleaved type of input images |
Any | exception derived from std::exception including CvbException. |
Creates a stacked ImageCube using the given image arrays without copying any buffer.
|
inlinenoexcept |
Returns C-API style handle to the Cube.
|
inline |
Retrieve linear access of cube data.
Throws | an exception if linear access is not possible |
|
inlinestatic |
Static function Loads a cube from ENVI.
[in] | EnviHeader | Header file of the ENVI-format data (.hdr). |
[in] | EnviBinary | Binary file of the ENVI-format data (.bin). |
Any | exception derived from std::exception including CvbException. |
|
inline |
Creates a cropped cube.
[in] | spectralCubeoid | Crop the source cube by this cuboid. |
Any | exception derived from std::exception including CvbException. |
The returned cube type depends on the source cube type.
Input CubeType | Output CubeType |
---|---|
#ContinuousCube | #MappedCube |
#MappedCube | #MappedCube |
#StackedCube | #ContinuousCube |
#LinearNonOwningCube | #LinearNonOwningCube |
|
inline |
Retrieves the meta data object of the cube.
Any | exception derived from std::exception including CvbException. |
This method returns a shared pointer to the meta data object
|
inline |
Writes this cube object to ENVI-format.
[in] | EnviHeader | Header file of the ENVI-format data (.hdr) |
[in] | EnviBinary | Binary file of the ENVI-format data (.bin) |
Any | exception derived from std::exception including CvbException. |
|
inline |
Retrieves spectral density at given pixel.
[in] | sampleIndex | Index of the sample to inspect. |
[in] | lineIndex | Index of the line to inspect. |
Any | exception derived from std::exception including CvbException. |
|
inline |
Swaps the dimensions for samples and lines and returns a deep copy.
Any | exception derived from std::exception including CvbException. |
The output Spectral Cube contains a swapped bufferView of the same type. In the meta data the definition for interleave stays the same, but changes from lower to capital letters and vice versa. 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 lLines in the ENVI-format.
|
inline |
Creates a transposed cube.
[in] | targetView | View perspective of the returned cube |
Any | exception derived from std::exception including CvbException. |
The returned cube type depends on the source cube type.
Input CubeType | Output CubeType |
---|---|
#ContinuousCube | #MappedCube |
#MappedCube | #MappedCube |
#StackedCube | #ContinuousCube |
#LinearNonOwningCube | #LinearNonOwningCube |
|
inlineprotectednoexcept |
Retrieves the buffer view of the cube without throwing an exception.
[out] | bufferViewOut | Output meta data |
Does | not throw an exception |
The buffer view is a pointer to the image which contains the buffer of the cube. This image is of size Width x Height x Dimensions. These dimensions can mapped to samples, lines and bands depending on the CubeEncoding of this cube.
|
inlinenoexcept |
Retrieve linear access of cube data without throwing an exception.
[out] | linearAccessOut | Output of spectral linear access |
Does | not throw an exception |
|
inlineprotectednoexcept |
Retrieves the meta data object of the cube without throwing an exception.
[out] | metaDataOut | Output meta data |
Does | not throw an exception |
|
inline |
Retrieves the type of this cube object.
Any | exception derived from std::exception including CvbException. |