Scyllarus: C++ Hyperspectral Processing Library
Hyperspectral Image Processing Pipeline
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
scyl::component_input Class Reference

component_input is an object that facilitates reading in of files saved by component_output (or assembled in the correct way manually). More...

#include <component_input.h>

Inheritance diagram for scyl::component_input:
scyl::input

Public Member Functions

 component_input (std::string filename, unsigned int flags=scyl::ALL)
 
virtual ~component_input ()
 
arma::fcube I () const
 Gets I. More...
 
const arma::fcube * I_ptr () const
 Gets a pointer to I. More...
 
arma::fvec illuminant () const
 Gets illuminant. More...
 
arma::fmat k () const
 Gets k. More...
 
arma::fcube s () const
 Gets s. More...
 
const arma::fcube * s_ptr () const
 Gets a pointer to s. More...
 
arma::fmat elements () const
 Gets elements. More...
 
arma::fcube element_abundances () const
 Gets abundances. More...
 
arma::ucube element_abundance_indexes () const
 Gets indexes. More...
 
arma::fmat endmembers () const
 Gets endmembers. More...
 
std::vector< std::string > endmember_labels () const
 Gets labels. More...
 
arma::fmat endmember_abundances () const
 Gets endabundances. More...
 
arma::umat endmember_abundance_indexes () const
 Gets endindexes. More...
 
arma::fmat g () const
 Gets g. More...
 
arma::fvec wavelengths () const
 Gets wavelengths. More...
 
scyl::INPUT_TYPE type ()
 Tells you what an object is. More...
 
- Public Member Functions inherited from scyl::input
 input ()
 
virtual ~input ()
 
virtual arma::fcube I (const arma::uvec bands) const
 Gets I (subset of bands) More...
 
virtual arma::fcube I (int r0, int c0, int r1, int c1) const
 Gets I (cropped) More...
 
virtual arma::fcube I (const arma::uvec bands, int r0, int c0, int r1, int c1) const
 Gets I (subset of bands) More...
 
virtual GDALDataset * gdal_dataset_ptr () const
 Gets gdal_dataset_ptr. More...
 
int height () const
 Get height. More...
 
int width () const
 Get width. More...
 
int bands () const
 Get bands. More...
 

Static Public Member Functions

static void load_I (scyl::component_input &in, std::string filename, bool check=true)
 
static void load_s (scyl::component_input &in, std::string filename, bool check=true)
 

Private Member Functions

void reconstruct_I () const
 reconstruct_I() will attempt to reconstruct I based on the loaded components in the object. If it can't reconstruct I it will do nothing. More...
 
void reconstruct_s () const
 reconstruct_s() will attempt to reconstruct s based on the loaded components in the object. If it can't reconstruct s it will do nothing. More...
 

Private Attributes

unsigned int m_flags
 
arma::fvec m_wavelengths
 
arma::fcube m_s
 
arma::fcube m_I
 
scyl::hdr_inputm_hdr_I
 
scyl::hdr_inputm_hdr_illuminant
 
scyl::hdr_inputm_hdr_k
 
scyl::hdr_inputm_hdr_s
 
scyl::hdr_inputm_hdr_elements
 
scyl::hdr_inputm_hdr_abundances
 
scyl::hdr_inputm_hdr_indexes
 
scyl::hdr_inputm_hdr_g
 
scyl::hdr_inputm_hdr_endabundances
 
scyl::hdr_inputm_hdr_endindexes
 
scyl::spectral_library m_spectral_library
 
bool m_loaded_I
 
bool m_loaded_illuminant
 
bool m_loaded_k
 
bool m_loaded_s
 
bool m_loaded_elements
 
bool m_loaded_abundances
 
bool m_loaded_indexes
 
bool m_loaded_g
 
bool m_loaded_endabundances
 
bool m_loaded_endindexes
 
bool m_loaded_spectral_library
 

Additional Inherited Members

- Protected Attributes inherited from scyl::input
unsigned int m_height
 
unsigned int m_width
 
unsigned int m_bands
 

Detailed Description

component_input is an object that facilitates reading in of files saved by component_output (or assembled in the correct way manually).

It could technically also be used in place of hdr_input.

At the most basic level, the input can be used as follows:

scyl::input * input = scyl::component_input("/path/to/files/prefix");

component_input will look in the given directory (/path/to/files in this case) for files, with name 'prefix_suffix'. Names are listed here (Component, suffix, description):

I                    :  _I,          HDR/data pair size height x width x bands
Illuminant           :  _illuminant, HDR/data pair size 1 x 1 x bands
k                    : _k,           HDR/data pair size height x width x 1
g                    : _g,           HDR/data pair size height x width x 1
s                    : _s,           HDR/data pair size height x width x bands
Material Elements    : _elements,    HDR/data pair size num_materials x bands
Material Abundances  : _abundances,  HDR/data pair size height x width x num_materials
Material Indexes     : _indexes,     HDR/data pair size height x width x num_materials
Endmember Abundances : _endabundances    as HDR/data pair size num_materials x abund_mat_per_pixel
Endmember Indexes    : _endindexes       as HDR/data pair size num_materials x abund_mat_per_pixel
Endmembers + Labels  : _spectral_library as an slz file.

If an image component is not present then a message will be output to the logger and loading will continue with the next component. Once all components are loaded, if there are sufficient items present to reconstruct I or S this will be done as needed.

component_input can also be constructed with flags to signify it should only attempt to load certain image components e.g.:

scyl::input * input = scyl::component_input("/path/to/files/prefix", scyl::I bitor scyl::ILLUMINANT);

The static function 'load_I' can be used to set an arbitrary image for the class, in the event the user wants to specify this, for example, if you have saved processed image components but didn't want to replicate I, you could use this function to manually specify the location of the original image.

Constructor & Destructor Documentation

scyl::component_input::component_input ( std::string  filename,
unsigned int  flags = scyl::ALL 
)

component_input Constructor Creates a component_input object. See class comment for more information.

Parameters
filenamethe string path to the file to be loaded.
flagsFlags for which image components to load (default is all). Set by bitor ( | ) ing scyl::COMPONENTS together.
Exceptions
ExceptionInvalid files, dimension mismatches
scyl::component_input::~component_input ( )
virtual

component_input Destructor.

Member Function Documentation

arma::ucube scyl::component_input::element_abundance_indexes ( ) const
virtual

Gets indexes.

Returns
indexes

Reimplemented from scyl::input.

arma::fcube scyl::component_input::element_abundances ( ) const
virtual

Gets abundances.

Returns
abundances

Reimplemented from scyl::input.

arma::fmat scyl::component_input::elements ( ) const
virtual

Gets elements.

Returns
elements

Reimplemented from scyl::input.

arma::umat scyl::component_input::endmember_abundance_indexes ( ) const
virtual

Gets endindexes.

Returns
endindexes

Reimplemented from scyl::input.

arma::fmat scyl::component_input::endmember_abundances ( ) const
virtual

Gets endabundances.

Returns
endabundances

Reimplemented from scyl::input.

std::vector< std::string > scyl::component_input::endmember_labels ( ) const
virtual

Gets labels.

Returns
labels

Reimplemented from scyl::input.

arma::fmat scyl::component_input::endmembers ( ) const
virtual

Gets endmembers.

Returns
endmembers

Reimplemented from scyl::input.

arma::fmat scyl::component_input::g ( ) const
virtual

Gets g.

Returns
g

Reimplemented from scyl::input.

arma::fcube scyl::component_input::I ( ) const
virtual

Gets I.

Returns
I

Reimplemented from scyl::input.

const arma::fcube * scyl::component_input::I_ptr ( ) const
virtual

Gets a pointer to I.

Returns
a pointer to I

Reimplemented from scyl::input.

arma::fvec scyl::component_input::illuminant ( ) const
virtual

Gets illuminant.

Returns
illuminant

Reimplemented from scyl::input.

arma::fmat scyl::component_input::k ( ) const
virtual

Gets k.

Returns
k

Reimplemented from scyl::input.

void scyl::component_input::load_I ( scyl::component_input in,
std::string  filename,
bool  check = true 
)
static

load_I takes a component_input object and loads the I member of that object to contain the contents of the specified file. The file needs to have the same data dimensions as the files that were already loaded in the construction of the component_input object. (The intention is that this function is used to pair the processed files (loaded upon construction) with the original image, when it is not resaved by component_output.

Parameters
in- The input object to be manipulated
filename- path to and filename of the image that I is to be set to.
check- check the dimensions of the data after loading.
void scyl::component_input::load_s ( scyl::component_input in,
std::string  filename,
bool  check = true 
)
static

load_s takes a component_input object and loads the s member of that object to contain the contents of the specified file. The file needs to have the same data dimensions as the files that were already loaded in the construction of the component_input object. (The intention is that this function is used to pair the processed files (loaded upon construction) with the original image, when it is not resaved by component_output.

Parameters
in- The input object to be manipulated
filename- path to and filename of the image that s is to be set to.
check- check the dimensions of the data after loading.
void scyl::component_input::reconstruct_I ( ) const
private

reconstruct_I() will attempt to reconstruct I based on the loaded components in the object. If it can't reconstruct I it will do nothing.

There are two possibilities for reconstruction: g, k, s, Illuminant -> I Elements, Abundance, Indexes, g, k, Illuminant -> I (Assumes S was reconstructed on load)

void scyl::component_input::reconstruct_s ( ) const
private

reconstruct_s() will attempt to reconstruct s based on the loaded components in the object. If it can't reconstruct s it will do nothing.

There are two possibilities for reconstruction: I, Illuminant, g, k -> S Elements, Abundance, Indexes -> S

arma::fcube scyl::component_input::s ( ) const
virtual

Gets s.

This function will also attempt to reconstruct s if either a) I, illuminant, k and g are present, or from b) elements, abundances and indexes.

Returns
s

Reimplemented from scyl::input.

const arma::fcube * scyl::component_input::s_ptr ( ) const
virtual

Gets a pointer to s.

Returns
pointer to s

Reimplemented from scyl::input.

scyl::INPUT_TYPE scyl::component_input::type ( )
virtual

Tells you what an object is.

Returns
The type enum of this object.

Reimplemented from scyl::input.

arma::fvec scyl::component_input::wavelengths ( ) const
virtual

Gets wavelengths.

Returns
wavelengths

Reimplemented from scyl::input.

Member Data Documentation

unsigned int scyl::component_input::m_flags
private
scyl::hdr_input* scyl::component_input::m_hdr_abundances
private
scyl::hdr_input* scyl::component_input::m_hdr_elements
private
scyl::hdr_input* scyl::component_input::m_hdr_endabundances
private
scyl::hdr_input* scyl::component_input::m_hdr_endindexes
private
scyl::hdr_input* scyl::component_input::m_hdr_g
private
scyl::hdr_input* scyl::component_input::m_hdr_I
private
scyl::hdr_input* scyl::component_input::m_hdr_illuminant
private
scyl::hdr_input* scyl::component_input::m_hdr_indexes
private
scyl::hdr_input* scyl::component_input::m_hdr_k
private
scyl::hdr_input* scyl::component_input::m_hdr_s
private
arma::fcube scyl::component_input::m_I
mutableprivate
bool scyl::component_input::m_loaded_abundances
private
bool scyl::component_input::m_loaded_elements
private
bool scyl::component_input::m_loaded_endabundances
private
bool scyl::component_input::m_loaded_endindexes
private
bool scyl::component_input::m_loaded_g
private
bool scyl::component_input::m_loaded_I
private
bool scyl::component_input::m_loaded_illuminant
private
bool scyl::component_input::m_loaded_indexes
private
bool scyl::component_input::m_loaded_k
private
bool scyl::component_input::m_loaded_s
private
bool scyl::component_input::m_loaded_spectral_library
private
arma::fcube scyl::component_input::m_s
mutableprivate
scyl::spectral_library scyl::component_input::m_spectral_library
private
arma::fvec scyl::component_input::m_wavelengths
private

The documentation for this class was generated from the following files: