Scyllarus: C++ Hyperspectral Processing Library
Hyperspectral Image Processing Pipeline
|
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>
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_input * | m_hdr_I |
scyl::hdr_input * | m_hdr_illuminant |
scyl::hdr_input * | m_hdr_k |
scyl::hdr_input * | m_hdr_s |
scyl::hdr_input * | m_hdr_elements |
scyl::hdr_input * | m_hdr_abundances |
scyl::hdr_input * | m_hdr_indexes |
scyl::hdr_input * | m_hdr_g |
scyl::hdr_input * | m_hdr_endabundances |
scyl::hdr_input * | m_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 |
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.
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.
filename | the string path to the file to be loaded. |
flags | Flags for which image components to load (default is all). Set by bitor ( | ) ing scyl::COMPONENTS together. |
Exception | Invalid files, dimension mismatches |
|
virtual |
component_input Destructor.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
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.
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. |
|
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.
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. |
|
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)
|
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
|
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.
Reimplemented from scyl::input.
|
virtual |
|
virtual |
|
virtual |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |