Vespucci  1.0.0
vcadata.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright (C) 2014-2016 Wright State University - All Rights Reserved
3  Daniel P. Foose - Maintainer/Lead Developer
4 
5  This file is part of Vespucci.
6 
7  Vespucci is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  Vespucci is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with Vespucci. If not, see <http://www.gnu.org/licenses/>.
19 *******************************************************************************/
20 #include "Data/Analysis/vcadata.h"
21 
22 VCAData::VCAData(QString name):
23  AnalysisResults(name, "VCA Results")
24 {
25 
26 }
27 
34 void VCAData::Apply(const mat &spectra, int endmembers)
35 {
36  uvec indices;
37  mat projected_data, fractional_abundances, endmember_spectra, indices_mat;
39  endmembers,
40  indices,
41  endmember_spectra,
42  projected_data,
43  fractional_abundances);
44  indices_mat.set_size(indices.n_elem, 1);
45 
46  for (uword i = 0; i < indices.n_elem; ++i)
47  indices_mat(i, 0) = indices(i);
48 
49  QStringList em_col_headings;
50  for (uword i = 1; i <= uword(endmembers); ++i)
51  em_col_headings << "Endmember " + QString::number(i);
52 
53  AddMetadata("Endmembers calculated", QString::number(endmembers));
54  AddMatrix("Endmembers", endmember_spectra, em_col_headings);
55  AddMatrix("Fractional Abundances", fractional_abundances, em_col_headings);
56  AddMatrix("Pure Pixel Indices", indices_mat, QStringList());
57  AddMatrix("Projected Data", projected_data, QStringList());
58 }
59 
60 
void AddMetadata(QString key, QString value)
VESPUCCI_EXPORT bool VCA(const arma::mat &R, arma::uword p, arma::uvec &indices, arma::mat &endmember_spectra, arma::mat &projected_data, arma::mat &fractional_abundances)
Vespucci::Math::DimensionReduction::VCA Vertex Component Analysis.
Definition: VCA.cpp:36
VCAData(QString name)
Definition: vcadata.cpp:22
void AddMatrix(const QString &key, const mat &value, QStringList column_headings=QStringList())
void Apply(const mat &spectra, int endmembers)
VCAData::Apply Performs vertex component analysis on this object.
Definition: vcadata.cpp:34
The AnalysisResults class A container for a mat object that allows a mat to be copied to a heap-alloc...