Scyllarus: C++ Hyperspectral Processing Library
Hyperspectral Image Processing Pipeline
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
spectral_library.h
Go to the documentation of this file.
1 /****************************************************************************************
2  * SCYLLARUS : C++ HYPERSPECTRAL PROCESSING LIBRARY
3  * spectral_library.h - Hyperspectral Signature IO Helper Object
4  *
5  * This computer code is subject to copyright:
6  * (c) National ICT Australia Limited (NICTA) 2013-2014 All Rights Reserved.
7  *
8  * Jeremy Oorloff, National ICT Australia (NICTA)
9  *
10  ***************************************************************************************/
11 
12 #ifndef SPECTRAL_LIBRARY_H_
13 #define SPECTRAL_LIBRARY_H_
14 
15 #include <armadillo>
16 #include <iso646.h>
17 #include <tuple>
18 #include <map>
19 
20 #include "iotools/slz.h"
21 #include "logger.h"
22 #include "utility.h"
23 
24 namespace scyl
25 {
26 
42 {
43 public:
44 
45  spectral_library(); // Spectral Library with blank fields (Insert data for saving)
46 
47  spectral_library(std::string filename); // Spectral Library populated by a slz file
48 
49  spectral_library(arma::fvec wavelengths, // Spectral Library populated at time of construction.
50  std::vector<std::string> labels,
51  arma::fmat endmembers);
52 
53  virtual ~spectral_library();
54 
55  // IO operations
56 
57  void load(std::string filename);
58 
59  void save(std::string filename);
60 
61  // Setters and Getters
62 
63  void set_wavelengths(const arma::fvec & in);
64  arma::fvec wavelengths() const;
65 
66  void set_metadata(const std::string & in);
67  std::string metadata() const;
68 
69  std::vector<std::string> labels(std::string filename="") const;
70 
71  std::vector<std::string> loaded_files() const;
72  std::vector<std::string> loaded_file_list() const;
73 
74 
75  void set_endmembers(const arma::fmat & in_endmembers,
76  const std::vector<std::string> & in_labels);
77 
78  arma::fmat endmembers(std::string label="", std::string filename="") const;
79 
80  arma::fmat endmembers_mean() const;
81  std::vector<std::string> labels_mean() const;
82 
83  void add_endmembers(const arma::fmat & in_endmembers,
84  const std::vector<std::string> & in_labels,
85  std::string filename="");
86 
87  void delete_endmembers(std::string label="",
88  std::string filename="");
89 
90  void add_library(std::string filename,
91  bool re_evaluate=false);
92 
94  std::string name="nofile",
95  bool re_evaluate=false);
96 
97  unsigned int bands();
98  unsigned int num_endmembers();
99  void print();
100 
101 private:
102 
103  arma::fvec m_wavelengths;
104 
105  std::vector<std::tuple<std::string, std::string, arma::fvec>> m_endmember_list;
106 
107  scyl::iotools::slz m_slz;
108 
109  unsigned int m_bands;
110 
111  std::string m_metadata;
112 };
113 
114 }
115 
116 #endif /* SPECTRAL_LIBRARY_H_ */
arma::fvec wavelengths() const
Definition: spectral_library.cpp:230
spectral_library()
Definition: spectral_library.cpp:19
arma::fvec m_wavelengths
Definition: spectral_library.h:103
void delete_endmembers(std::string label="", std::string filename="")
Delete endmembers from the list currently held by the object by label name and or filename...
Definition: spectral_library.cpp:584
void add_library(std::string filename, bool re_evaluate=false)
Append the contents of a SLZ file to the current contents of the object.
Definition: spectral_library.cpp:644
void save(std::string filename)
save() saves the contents of the spectral_library to the specified SLZ file
Definition: spectral_library.cpp:160
std::vector< std::string > labels(std::string filename="") const
Definition: spectral_library.cpp:270
std::string m_metadata
Definition: spectral_library.h:111
arma::fmat endmembers_mean() const
Definition: spectral_library.cpp:460
void set_metadata(const std::string &in)
Definition: spectral_library.cpp:246
std::vector< std::string > labels_mean() const
Definition: spectral_library.cpp:493
void set_wavelengths(const arma::fvec &in)
Definition: spectral_library.cpp:208
unsigned int num_endmembers()
Definition: spectral_library.cpp:732
unsigned int m_bands
Definition: spectral_library.h:109
std::vector< std::tuple< std::string, std::string, arma::fvec > > m_endmember_list
Definition: spectral_library.h:105
void set_endmembers(const arma::fmat &in_endmembers, const std::vector< std::string > &in_labels)
Definition: spectral_library.cpp:359
virtual ~spectral_library()
Definition: spectral_library.cpp:89
std::string metadata() const
Definition: spectral_library.cpp:255
unsigned int bands()
Definition: spectral_library.cpp:722
void add_endmembers(const arma::fmat &in_endmembers, const std::vector< std::string > &in_labels, std::string filename="")
Append endmembers onto the list currently held by the object.
Definition: spectral_library.cpp:528
arma::fmat endmembers(std::string label="", std::string filename="") const
Definition: spectral_library.cpp:396
std::vector< std::string > loaded_files() const
Definition: spectral_library.cpp:309
Spectral Library is a class that loads and saves SLZ files and holds information from them for use wi...
Definition: spectral_library.h:41
void print()
Definition: spectral_library.cpp:737
std::vector< std::string > loaded_file_list() const
Definition: spectral_library.cpp:339
scyl::iotools::slz m_slz
Definition: spectral_library.h:107
void load(std::string filename)
load() initialises the spectral library object that it is called on with the data in the specified fi...
Definition: spectral_library.cpp:109