CVB.Net 15.0
Cube Class Reference

Base class for cubes. More...

Inherits INativeHandle, and ICloneable.

Inherited by ContinuousCube, LinearNonOwningCube, MappedCube, and StackedCube.

Public Member Functions

void Dispose ()
 IDisposable implementation.
 
Image Slice (int planeIndex, bool targetMapped)
 Gets an image handle on a certain plane of the image cube. If targetMapped is true, 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: More...
 
Cube Crop (Cuboid spectralCuboid)
 Creates a cropped cube. More...
 
Cube Convert (CubeEncoding targetEncoding)
 Creates a converted cube. More...
 
void Save (string enviHeader, string enviBinary)
 Saves the cube header and data to the specified files. More...
 
T[] GetSpectralDensity< T > (int sampleIndex, int lineIndex)
 Retrieves the spectral density at the given pixel. More...
 
bool TryGetLinearAccess (out LinearAccessData linearAccess)
 Tries to get the linear access data for this cube. More...
 
LinearAccessData GetLinearAccess ()
 Gets the linear access data for this cube. More...
 
ContinuousCube Clone ()
 Copies this cubes memory to a new cube. More...
 

Static Public Member Functions

static ContinuousCube Create (int numSamples, int numLines, int numBands, DataType dataType, CubeEncoding bufferLayout)
 Creates a new continuous cube. More...
 
static ContinuousCube FromFile (string enviHeader, string enviBinary)
 Loads a cube from file. More...
 
static StackedCube FromImages (IEnumerable< Image > images, CubeEncoding bufferLayout)
 Creates a new stacked cube from the given images . More...
 
static Cube FromHandle (IntPtr handle)
 Creates a new cube object from the given handle . More...
 

Protected Member Functions

 Cube (IntPtr handle)
 Constructor. More...
 
 Cube (IntPtr handle, UseMemoryPressure useMemoryPressure)
 Constructor. More...
 
virtual void Dispose (bool disposing)
 IDisposable helper function. More...
 

Properties

IntPtr Handle [get]
 Native handle of the calibrator.
 
bool IsDisposed [get]
 Gets if the native handle has been disposed.
 
DataType DataType [get]
 Gets the data type of this cube. More...
 
Image BufferView [get]
 Gets the buffer view of this cube.
 
MetaData MetaData [get, set]
 Metadata of this cube.
 
- Properties inherited from INativeHandle
IntPtr Handle [get]
 The native handle of the object.
 
bool IsDisposed [get]
 Possibility to check whether the object has already been disposed of.
 

Events

NativeHandleEventDelegate ObjectDisposing
 Raised when this object is about to be disposed via the IDisposable.Dispose method.
More...
 
- Events inherited from INativeHandle
NativeHandleEventDelegate ObjectDisposing
 Raised when this object is about to be disposed via the IDisposable.Dispose method.
More...
 

Detailed Description

Base class for cubes.

Constructor & Destructor Documentation

◆ Cube() [1/2]

Cube ( IntPtr  handle)
protected

Constructor.

Parameters
handleNative handle to the cube object.
Exceptions
ArgumentExceptionWhen handle is IntPtr.Zero.

◆ Cube() [2/2]

Cube ( IntPtr  handle,
UseMemoryPressure  useMemoryPressure 
)
protected

Constructor.

Parameters
handleNative handle to the cube object.
useMemoryPressureGuesses memory pressure if UseMemoryPressure.Yes is set.
Exceptions
ArgumentExceptionWhen handle is IntPtr.Zero.

Member Function Documentation

◆ Clone()

ContinuousCube Clone ( )

Copies this cubes memory to a new cube.

Returns
Copied cube.
Exceptions
CvbExceptionWhen cloning the cube failed.

◆ Convert()

Cube Convert ( CubeEncoding  targetEncoding)

Creates a converted cube.

Parameters
targetEncodingTarget encoding of the resulting cube.
Returns
Converted cube. The output cube type is a continous cube. Data are copied.
Exceptions
CvbExceptionWhen converting the cube failed.

◆ Create()

static ContinuousCube Create ( int  numSamples,
int  numLines,
int  numBands,
DataType  dataType,
CubeEncoding  bufferLayout 
)
static

Creates a new continuous cube.

Parameters
numSamplesAmount of samples.
numLinesAmount of lines.
numBandsAmount of bands.
dataTypeData type of the cube.
bufferLayoutBuffer layout of the cube.
Returns
Newly created continuous cube.
Exceptions
CvbExceptionWhen creating the cube failed.

◆ Crop()

Cube Crop ( Cuboid  spectralCuboid)

Creates a cropped cube.

Parameters
spectralCuboidCuboid with which to crop this cube.
Returns
Cropped cube. The output cube type depends on the input cube type.
Input Type Output Type
Continuous Mapped
Mapped Mapped
Stacked Continuous
LinearNonOwning LinearNonOwning
Exceptions
CvbExceptionWhen cropping the cube failed.

◆ Dispose()

virtual void Dispose ( bool  disposing)
protectedvirtual

IDisposable helper function.

Parameters
disposing

◆ FromFile()

static ContinuousCube FromFile ( string  enviHeader,
string  enviBinary 
)
static

Loads a cube from file.

Parameters
enviHeaderHeader file to load.
enviBinaryBinary file to load.
Returns
Loaded cube.
Exceptions
CvbExceptionWhen loading the cube failed.

◆ FromHandle()

static Cube FromHandle ( IntPtr  handle)
static

Creates a new cube object from the given handle .

Parameters
handleCube handle.
Returns
Newly created cube.
Exceptions
ArgumentExceptionWhen the given handle is not valid.

◆ FromImages()

static StackedCube FromImages ( IEnumerable< Image images,
CubeEncoding  bufferLayout 
)
static

Creates a new stacked cube from the given images .

Parameters
imagesImages to use for creating the cube.
bufferLayoutBuffer layout of the cube.
Returns
Newly created stacked cube.
Exceptions
CvbExceptionWhen creating the cube failed.

◆ GetLinearAccess()

LinearAccessData GetLinearAccess ( )

Gets the linear access data for this cube.

Returns
Linear access data.

◆ GetSpectralDensity< T >()

T[] GetSpectralDensity< T > ( int  sampleIndex,
int  lineIndex 
)

Retrieves the spectral density at the given pixel.

Template Parameters
TType of the spectral density. Can be int or double.
Parameters
sampleIndexIndex of the sample to inspect.
lineIndexIndex of the line do inspect.
Returns
The spectral density at the given pixel.
Exceptions
ArgumentExceptionWhen T is not int or double.
CvbExceptionWhen getting the spectral density failed.
Type Constraints
T :struct 

◆ Save()

void Save ( string  enviHeader,
string  enviBinary 
)

Saves the cube header and data to the specified files.

Parameters
enviHeaderFile to save the header to.
enviBinaryFile to save the binary data to.

◆ Slice()

Image Slice ( int  planeIndex,
bool  targetMapped 
)

Gets an image handle on a certain plane of the image cube. If targetMapped is true, 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:

  • CVSVP_BandInterleavedByLine : Sample-Band slice
  • CVSVP_BandSequential : Sample-Line slice
  • CVSVP_BandInterleavedByPixel : Band-Sample slice
Parameters
planeIndexPlane Index in the range [0, numberOfPlanes[
targetMappedWhen set to true the output image is a mapped view of the original buffer.
Returns
The selected slice.

◆ TryGetLinearAccess()

bool TryGetLinearAccess ( out LinearAccessData  linearAccess)

Tries to get the linear access data for this cube.

Parameters
linearAccessLinear access data.
Returns
True if linear access data was successfully fetched, false if not.

Property Documentation

◆ DataType

Gets the data type of this cube.

Exceptions
CvbExceptionWhen getting the data type failed.

Event Documentation

◆ ObjectDisposing

NativeHandleEventDelegate ObjectDisposing

Raised when this object is about to be disposed via the IDisposable.Dispose method.

This event is raised right before this object is disposed. The dispose itself cannot be canceled.