CVBpy 14.0
Cube Class Reference

Spectral Cube object. More...

Inherits object.

Inherited by WrappedCube.

Public Member Functions

cvb.Image buffer_view (self)
 Retrieves the buffer view of the cube. More...
 
cvb.spectral.Cube clone (self)
 Copies the memory to a new instance of a cube. More...
 
cvb.spectral.Cube from_images (List[cvb.Image] images, int cube_encoding)
 Create an image, that is the result of concatenating a series of input planes. More...
 
cvb.spectral.Cube map (self, cvb.spectral.CubeRange spectral_cubeoid)
 Creates a cropped cube. More...
 
cvb.spectral.MetaData meta_data (self)
 Retrieves the metadata object of the cube. More...
 
None save (self, str envi_header_filename, str envi_binary_filename)
 Writes this cube object to ENVI-format. More...
 
List[float] spectral_density (self, int line_index, int sample_index)
 Retrieves spectral density at given pixel. More...
 
cvb.spectral.Cube swap_samples_and_lines (self)
 Swaps the dimensions for samples and lines and returns a deep copy. More...
 
cvb.spectral.Cube transpose (self, int target_view_perspective)
 Creates a transposed cube. More...
 

Properties

 data_type = property
 cvb.DataType: Gets the data type of this cube object.
 
 type = property
 int: Gets the type of this cube object.
 

Detailed Description

Spectral Cube object.

Creates a cube.

To create an empty continuous cube you can provide the parameters (lines, samples, bands, data_type, view_perspective).Alternatively you can provide the file names of an ENVI-formatted cube (envi_header_filename, envi_binary_filename)

Parameters

lines : int Number of lines.

samples : int Number of samples.

bands : int Number of bands.

data_type : cvb.DataType Pixel data type.

cube_encoding : int View perspective on the buffer (see cvb.spectral.CubeEncoding).

Parameters

envi_header_filename : str Header file of the ENVI-format data (.hdr).

envi_binary_filename : str Binary file of the ENVI-format data (.bin).

Member Function Documentation

◆ buffer_view()

cvb.Image buffer_view (   self)

Retrieves the buffer view of the cube.

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 * height * dimensions. These dimensions can be mapped to samples, lines and bands depending on the cvb.spectral.CubeEncoding of this cube.

Returns

cvb.Image The view on the buffer through an image.

◆ clone()

cvb.spectral.Cube clone (   self)

Copies the memory to a new instance of a cube.

Returns

cvb.spectral.Cube New cube of type CubeType.ContinuousCube.

◆ from_images()

cvb.spectral.Cube from_images ( List[cvb.Image images,
int  cube_encoding 
)

Create an image, that is the result of concatenating a series of input planes.

Parameters

images : List[cvb.Image] Selects the relationship between the result image and the input images.

cube_encoding : int View perspective on the buffer (see cvb.spectral.CubeEncoding).

Returns

cvb.spectral.Cube A stacked cube object.

◆ map()

cvb.spectral.Cube map (   self,
cvb.spectral.CubeRange  spectral_cubeoid 
)

Creates a cropped cube.

The returned cube type depends on the source cube type.

Parameters

spectral_cubeoid : cvb.spectral.CubeRange Crop the source cube by this cuboid.

Returns

cvb.spectral.Cube The cropped cube.

◆ meta_data()

cvb.spectral.MetaData meta_data (   self)

Retrieves the metadata object of the cube.

This method returns a shared pointer to the metadata object.

Returns

cvb.spectral.MetaData The metadata of this cube.

◆ save()

None save (   self,
str  envi_header_filename,
str  envi_binary_filename 
)

Writes this cube object to ENVI-format.

Parameters

envi_header_filename : str Header file of the ENVI-format data (.hdr).

envi_binary_filename : str Binary file of the ENVI-format data (.bin).

◆ spectral_density()

List[float] spectral_density (   self,
int  line_index,
int  sample_index 
)

Retrieves spectral density at given pixel.

Parameters

line_index : int Index of the line to inspect.

sample_index : int Index of the sample to inspect.

Returns

List[float] The spectral density at given pixel.

◆ swap_samples_and_lines()

cvb.spectral.Cube swap_samples_and_lines (   self)

Swaps the dimensions for samples and lines and returns a deep copy.

The output spectral cube contains a swapped buffer_view() of the same type. In the metadata 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 lines in the ENVI-format.

Returns

cvb.spectral.Cube A deep copy of the original image cube. Samples and lines are swapped.

◆ transpose()

cvb.spectral.Cube transpose (   self,
int  target_view_perspective 
)

Creates a transposed cube.

The returned cube type depends on the source cube type.

Parameters

target_view_perspective : int View perspective of the returned cube (see cvb.spectral.CubeEncoding).

Returns

cvb.spectral.Cube The transposed cube.