Orfeo Toolbox  4.0
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 
135 protected:
137  SatelliteRSR();
139  //SatelliteRSR( const std::string & filename );
141  virtual ~SatelliteRSR()
142  {
143  }
144 ;
145 
146  bool m_SortBands;
147 
148 private:
149  SatelliteRSR(const Self&); //purposely not implemented
150  void operator=(const Self&); //purposely not implemented
151 
155  unsigned int m_NbBands;
156 };
157 
158 }// end namespace otb
159 
160 
161 #ifndef OTB_MANUAL_INSTANTIATION
162 #include "otbSatelliteRSR.txx"
163 #endif
164 
165 #endif
166 

Generated at Sat Mar 8 2014 16:17:07 for Orfeo Toolbox with doxygen 1.8.3.1