OTB  5.0.0
Orfeo Toolbox
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 <vector>
22 #include <utility>
23 #include <fstream>
24 #include <limits>
25 
26 #include "otbSpectralResponse.h"
27 
28 namespace otb
29 {
45 template<class TPrecision = double, class TValuePrecision = double>
47 {
48 public:
50  typedef SatelliteRSR Self;
54 
56  itkNewMacro(Self)
57 ; itkTypeMacro(SatelliteRSR, DataObject)
58 ;
60 
63  itkGetConstMacro(NbBands, unsigned int)
64 ; itkSetMacro(NbBands, unsigned int)
65 ;
67 
68  itkSetMacro(SortBands, bool)
69 ;
70 
72  typedef TPrecision PrecisionType;
73  typedef TValuePrecision ValuePrecisionType;
74 
77  typedef std::vector<SpectralResponsePointerType> RSRVectorType;
79 
81  virtual bool Clear();
82 
84  virtual int Size() const;
85 
87  void Load(const std::string & filename, ValuePrecisionType coefNormalization = 1.0);
88 
90  void Load(PrecisionType lambdaMin, PrecisionType lambdaMax, PrecisionType sampling,
91  ValuePrecisionType coefNormalization = 1.0);
92 
94  struct sort_band
95  {
97  {
98  PrecisionType aFirstNotNull;
99  PrecisionType bFirstNotNull;
101 
102  typename VectorPairType::const_iterator it = a->GetResponse().begin();
103 
104  while ((*it).second == 0)
105  {
106  ++it;
107  }
108  aFirstNotNull = (*it).first;
109 
110  typename VectorPairType::const_iterator it2 = b->GetResponse().begin();
111 
112  while ((*it2).second == 0)
113  {
114  ++it2;
115  }
116  bFirstNotNull = (*it2).first;
117 
118  return aFirstNotNull < bFirstNotNull;
119  }
120  };
121 
127  inline ValuePrecisionType operator()(const PrecisionType & lambda, const unsigned int numBand);
128 
130  void PrintSelf(std::ostream& os, itk::Indent indent) const;
131 
134  {
135  return m_RSR;
136  }
137 
140  {
141  return m_SolarIrradiance;
142  }
143 
144 protected:
146  SatelliteRSR();
147 
149  //SatelliteRSR( const std::string & filename );
150 
152  virtual ~SatelliteRSR()
153  {
154  }
155 ;
156 
157  bool m_SortBands;
158 
159 private:
160  SatelliteRSR(const Self&); //purposely not implemented
161  void operator=(const Self&); //purposely not implemented
162 
165 
168 
170  unsigned int m_NbBands;
171 };
172 
173 }// end namespace otb
174 
175 
176 #ifndef OTB_MANUAL_INSTANTIATION
177 #include "otbSatelliteRSR.txx"
178 #endif
179 
180 #endif
181 
std::vector< PairType > VectorPairType
std::vector< SpectralResponsePointerType > RSRVectorType
itk::SmartPointer< Self > Pointer
This class represents a hierarchy of vector data.
SpectralResponseType * GetSolarIrradiance()
RSRVectorType & GetRSR()
SpectralResponseType::Pointer SpectralResponsePointerType
SpectralResponseType::VectorPairType VectorPairType
itk::DataObject Superclass
SpectralResponsePointerType m_SolarIrradiance
TPrecision PrecisionType
bool operator()(SpectralResponsePointerType a, SpectralResponsePointerType b)
SpectralResponse< TPrecision, TValuePrecision > SpectralResponseType
unsigned int m_NbBands
TValuePrecision ValuePrecisionType
void PrintSelf(std::ostream &os, itk::Indent indent) const
virtual bool Clear()
itk::SmartPointer< const Self > ConstPointer
void Load(const std::string &filename, ValuePrecisionType coefNormalization=1.0)
void operator=(const Self &)
This class represents the spectral response of an object (or a satellite band).
RSRVectorType m_RSR
SatelliteRSR Self
ValuePrecisionType operator()(const PrecisionType &lambda, const unsigned int numBand)
virtual int Size() const