37 QString method_description,
39 QList<QSharedPointer<VespucciDataset> > parent_datasets)
42 parent_datasets_ = parent_datasets;
45 throw std::runtime_error(
"Improper input to MetaDataset constructor");
46 cerr <<
"Improper input to MetaDataset constructor\n";
50 method_description_ = method_description;
52 vec
wavelength = parent_datasets_[0]->wavelength();
58 spectra = ProcessAverage(x, y);
60 catch(std::exception e){
61 throw std::runtime_error(
"MetaDataset::ProcessAverage");
67 spectra = Concatenate(x, y);
69 catch(std::exception e){
70 throw std::runtime_error(
"MetaDataset::Concatenate");
74 throw std::runtime_error(
"Improper input to MetaDataset");
78 SetData(spectra, wavelength, x, y);
81 catch(std::exception e){
82 throw std::runtime_error(
"Failure to set data in MetaDataset constructor");
84 vec indices_temp(spectra.n_cols);
85 for (uword i = 0; i < indices_temp.n_elem; ++i){
95 mat MetaDataset::ProcessAverage(vec &
x, vec &
y)
99 mat indices_buf(1, 3);
100 for (
int i = 0; i < parent_datasets_.size(); ++i){
101 spectra.insert_cols(spectra.n_cols, parent_datasets_[i]->AverageSpectrum(
false));
103 indices_buf(0, 0) = i + 1;
104 indices_buf(0, 1) = 0;
105 indices_buf(0, 2) = 0;
106 x.insert_rows(
x.n_rows, parent);
107 y.insert_rows(y.n_rows, parent);
108 parent_coordinates_.insert_rows(parent_coordinates_.n_rows, indices_buf);
117 mat MetaDataset::Concatenate(vec &
x, vec &
y)
121 indices_buf.set_size(1, 3);
122 cout <<
"Concatenate()\n";
124 for (
int i = 0; i < parent_datasets_.size(); ++i){
125 spectra.insert_cols(spectra.n_cols, parent_datasets_[i]->spectra());
126 indices_buf.set_size(parent_datasets_[i]->
x().n_rows, 3);
127 indices_buf.col(0) = (i+1)*ones(indices_buf.n_rows);
128 indices_buf.col(1) = parent_datasets_[i]->x();
129 indices_buf.col(2) = parent_datasets_[i]->y();
130 parent_coordinates_.insert_rows(parent_coordinates_.n_rows, indices_buf);
131 x.insert_rows(
x.n_rows, indices_buf.col(1));
132 y.insert_rows(y.n_rows, indices_buf.col(2));
142 bool MetaDataset::ParentsValid()
144 uword size = parent_datasets_[0]->wavelength_ptr()->n_elem;
145 for (
int i = 0; i<parent_datasets_.size(); ++i)
void SetData(const mat &spectra, const vec &wavelength, const vec &x, const vec &y)
VespucciDataset::SetData.
vec wavelength() const
VespucciDataset::wavelength.
The VespucciDataset class This is the main class for dealing with hyperspectral data. This handles the import and export of spectra, and the creation of maps. Images are handled by the MapData class. This class is intended to be allocated on the heap inside of a smart pointer, there is no copy constructor.
mat spectra() const
VespucciDataset::spectra.
void SetParentDatasetIndices(mat parent_dataset_indices)
VespucciDataset::SetParentDatasetIndices.
vec y() const
VespucciDataset::y.
void SetIndices(vec indices)
VespucciDataset::SetIndices.
vec x() const
VespucciDataset::x.
The MainWindow class The main window of the program, this is where the user performs most operations...