Vespucci  1.0.0
vespucciworkspace.h
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 
21 #ifndef VESPUCCIWORKSPACE_H
22 
23 #define VESPUCCIWORKSPACE_H
24 
26 
27 #include "Math/VespucciMath.h"
28 #include "Global/vespucci.h"
29 #include <qcustomplot.h>
30 #include "GUI/mainwindow.h"
32 #include "Global/enums.h"
33 #include "Global/datamodel.h"
34 #include "Global/global.h"
36 class VespucciDataset;
37 class MainWindow;
38 class DatasetTreeModel;
39 class AnalysisResults;
40 
45 {
46 public:
47  VespucciWorkspace(QString settings_file);
49  QStringList dataset_names() const;
50  //QStringList map_names();
51 
52  //adds or removes dataset or map to relevant lists
53  void AddDataset(QSharedPointer<VespucciDataset> dataset);
54  void RemoveDataset(QString name);
55  void UpdateModel();
56 
57  void RemoveDatasetAt(const QModelIndex &parent);
58  //void RemoveMapAt(int i);
59  QSharedPointer<VespucciDataset> DatasetAt(const QModelIndex &parent);
60 
61  int dataset_loading_count() const;
62  //int map_loading_count();
63 
64  void set_directory(QString directory);
65  QString directory() const;
66  QString *directory_ptr();
67 
69 
71  double GetWavelengthMin(const QString &key) const;
72  double GetWavelengthMax(const QString &key) const;
73 
74  QSharedPointer<VespucciDataset> GetDataset(const QString &key) const;
75  QSharedPointer<AnalysisResults> GetAnalysisResults(const QString &dataset_key, const QString &results_key) const;
76  QSharedPointer<MapData> GetMap(const QString &dataset_key, const QString &map_key) const;
77  QSharedPointer<MapData> GetMap(const QStringList &map_keys);
78  const mat & GetAuxiliaryMatrix(const QString &dataset_key, const QString &matrix_key) const;
79  const mat & GetResultsMatrix(const QString &dataset_key, const QString &results_key, const QString &matrix_key) const;
80  const mat &GetCoreMatrix(const QString &dataset_key, const QString &matrix_key) const;
81 
82 
83 
86 
87  void AddGlobalGradient(QString name, QString gradient_key, double lower, double upper);
88  void RecalculateGlobalGradient(QString name);
89  void RemoveColorRange(QString name);
90  QStringList GlobalGradientKeys();
91  QMap<QString, Vespucci::GlobalGradient> global_gradients();
92  QCPColorGradient GetGradient(QString key, int count = 0);
94  QStringList GradientNames(bool include_cluster = false);
95 
96 
97  void ClearDatasets();
98 
99  QList<QSharedPointer<VespucciDataset> > *datasets();
100  unsigned int UpdateCount();
102 
103  void ResetSettings();
104  void CheckSettings();
105  QSettings *settings();
106 
107 
109 
110  const mat & GetMatrix(const QStringList &keys) const;
111  bool HasMatrix(const QStringList &keys) const;
112 
113  bool Mappable(const QStringList &keys) const;
114  bool Plottable(const QStringList &keys) const;
115 
116 private:
117 
118  void UpdateTreeModel();
119 
120  //pointers to main window and necessary widgets
121 
125  MainWindow *main_window_;
126 
130  DatasetTreeModel *dataset_tree_model_;
131 
135  QString directory_; //= QDir::homePath();
136 
137 
141  unsigned int dataset_loading_count_;
142 
146  QCPRange global_data_range_;
147 
151  QCPColorGradient global_color_gradient_;
152 
156  QSettings settings_;
157 
161  DataModel *data_model_;
162 
163  QMap<QString, QCPColorGradient> gradients_;
164  QMap<QString, Vespucci::GlobalGradient> global_gradients_;
165 };
166 
167 #endif // VESPUCCIWORKSPACE_H
void RemoveDatasetAt(const QModelIndex &parent)
VespucciWorkspace::RemoveDatasetAt.
bool Plottable(const QStringList &keys) const
void set_directory(QString directory)
VespucciWorkspace::set_directory.
QSharedPointer< VespucciDataset > GetDataset(const QString &key) const
VespucciWorkspace::GetDataset.
QStringList dataset_names() const
void ClearDatasets()
VespucciWorkspace::ClearDatasets Clears the internal container for datasets in the list model...
unsigned int UpdateCount()
VespucciWorkspace::UpdateCount.
DataModel * data_model()
void AddDataset(QSharedPointer< VespucciDataset > dataset)
VespucciWorkspace::AddDataset.
Vespucci::GlobalGradient GetGlobalGradient(QString key)
bool Mappable(const QStringList &keys) const
const mat & GetCoreMatrix(const QString &dataset_key, const QString &matrix_key) const
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.
const mat & GetMatrix(const QStringList &keys) const
VespucciWorkspace::GetMatrix.
MainWindow * main_window()
VespucciWorkspace::main_window.
QSharedPointer< VespucciDataset > DatasetAt(const QModelIndex &parent)
void RemoveDataset(QString name)
VespucciWorkspace::RemoveDataset.
The VespucciWorkspace class A class which contains all "global variables" (that aren&#39;t held in MainWi...
QStringList GlobalGradientKeys()
QString * directory_ptr()
VespucciWorkspace::directory_ptr.
QCPRange * global_data_range()
VespucciWorkspace::global_data_range.
QMap< QString, Vespucci::GlobalGradient > global_gradients()
int dataset_loading_count() const
VespucciWorkspace::dataset_loading_count.
QStringList GradientNames(bool include_cluster=false)
void SetPointers(MainWindow *main_window, DatasetTreeModel *tree_model)
VespucciWorkspace::SetPointers.
QList< QSharedPointer< VespucciDataset > > * datasets()
void AddGlobalGradient(QString name, QString gradient_key, double lower, double upper)
VespucciWorkspace::AddGlobalGradient.
const mat & GetResultsMatrix(const QString &dataset_key, const QString &results_key, const QString &matrix_key) const
double GetWavelengthMax(const QString &key) const
VespucciWorkspace::GetWavelengthMax.
void RemoveColorRange(QString name)
VespucciWorkspace::RemoveColorRange.
QSharedPointer< AnalysisResults > GetAnalysisResults(const QString &dataset_key, const QString &results_key) const
VespucciWorkspace::GetAnalysisResults.
QCPColorGradient * global_gradient()
VespucciWorkspace::global_gradient.
double GetWavelengthMin(const QString &key) const
VespucciWorkspace::GetWavelengthMin.
bool HasMatrix(const QStringList &keys) const
VespucciWorkspace(QString settings_file)
VespucciWorkspace::VespucciWorkspace Constructor.
QCPColorGradient GetGradient(QString key, int count=0)
QSharedPointer< MapData > GetMap(const QString &dataset_key, const QString &map_key) const
void UpdateModel()
VespucciWorkspace::UpdateModel Call when a VespucciDataset adds or removes a new object.
Defines a color gradient for use with e.g. QCPColorMap.
Definition: qcustomplot.h:1905
QString directory() const
VespucciWorkspace::directory.
Represents the range an axis is encompassing.
Definition: qcustomplot.h:481
The MainWindow class The main window of the program, this is where the user performs most operations...
Definition: mainwindow.h:58
The AnalysisResults class A container for a mat object that allows a mat to be copied to a heap-alloc...
~VespucciWorkspace()
VespucciWorkspace::~VespucciWorkspace Destructor.
void RecalculateGlobalGradient(QString name)
DatasetTreeModel * dataset_tree_model() const
dataset_list_model
const mat & GetAuxiliaryMatrix(const QString &dataset_key, const QString &matrix_key) const