Orfeo Toolbox  4.2
otbSatelliteRSR.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17  =========================================================================*/
18 #ifndef __otbSatelliteRSR_h
19 #define __otbSatelliteRSR_h
20 
21 #include "itkDataObject.h"
22 #include <itkObjectFactory.h>
23 #include <vector>
24 #include <utility>
25 #include <fstream>
26 #include <limits>
27 
28 #include "otbSpectralResponse.h"
29 
30 namespace otb
31 {
45 template<class TPrecision = double, class TValuePrecision = double>
47 {
48 public:
50  typedef SatelliteRSR Self;
54 
56  itkNewMacro(Self)
57 ; itkTypeMacro(SatelliteRSR, DataObject)
58 ;
59 
62  itkGetConstMacro(NbBands, unsigned int)
63 ; itkSetMacro(NbBands, unsigned int)
64 ;
65 
66  itkSetMacro(SortBands, bool)
67 ;
68 
70  typedef TPrecision PrecisionType;
71  typedef TValuePrecision ValuePrecisionType;
72 
75  typedef std::vector<SpectralResponsePointerType> RSRVectorType;
77 
79  virtual bool Clear();
80 
82  virtual int Size() const;
83 
85  void Load(const std::string & filename, ValuePrecisionType coefNormalization = 1.0);
86 
88  void Load(PrecisionType lambdaMin, PrecisionType lambdaMax, PrecisionType sampling,
89  ValuePrecisionType coefNormalization = 1.0);
90 
92  struct sort_band
93  {
95  {
96  PrecisionType aFirstNotNull;
97  PrecisionType bFirstNotNull;
98 
99  typename VectorPairType::const_iterator it = a->GetResponse().begin();
100 
101  while ((*it).second == 0)
102  {
103  ++it;
104  }
105  aFirstNotNull = (*it).first;
106 
107  typename VectorPairType::const_iterator it2 = b->GetResponse().begin();
108 
109  while ((*it2).second == 0)
110  {
111  ++it2;
112  }
113  bFirstNotNull = (*it2).first;
114 
115  return aFirstNotNull < bFirstNotNull;
116  }
117  };
118 
124  inline ValuePrecisionType operator()(const PrecisionType & lambda, const unsigned int numBand);
125 
127  void PrintSelf(std::ostream& os, itk::Indent indent) const;
128 
131  {
132  return m_RSR;
133  }
134 
137  {
138  return m_SolarIrradiance;
139  }
140 
141 protected:
143  SatelliteRSR();
145  //SatelliteRSR( const std::string & filename );
147  virtual ~SatelliteRSR()
148  {
149  }
150 ;
151 
152  bool m_SortBands;
153 
154 private:
155  SatelliteRSR(const Self&); //purposely not implemented
156  void operator=(const Self&); //purposely not implemented
157 
160 
164  unsigned int m_NbBands;
165 };
166 
167 }// end namespace otb
168 
169 
170 #ifndef OTB_MANUAL_INSTANTIATION
171 #include "otbSatelliteRSR.txx"
172 #endif
173 
174 #endif
175 

Generated at Sat Aug 30 2014 16:23:39 for Orfeo Toolbox with doxygen 1.8.3.1