21 #ifndef otbSatelliteRSR_hxx
22 #define otbSatelliteRSR_hxx
29 template <
class TPrecision,
class TValuePrecision>
34 m_SolarIrradiance = SpectralResponseType::New();
37 template <
class TPrecision,
class TValuePrecision>
43 std::ifstream fin(filename);
46 itkExceptionMacro(<<
"Error opening file" << filename);
50 for (
unsigned int i = 0; i < m_NbBands; ++i)
54 m_RSR.push_back(RSRBand);
62 fin >> solarIrradiance;
64 m_SolarIrradiance->GetResponse().push_back(std::make_pair(currentLambda, solarIrradiance));
66 for (
unsigned int i = 0; i < m_NbBands; ++i)
68 std::pair<TPrecision, TValuePrecision> currentPair;
69 currentPair.first = currentLambda;
70 fin >> currentPair.second;
71 currentPair.second = currentPair.second / coefNormalization;
73 m_RSR[i]->GetResponse().push_back(currentPair);
81 std::sort(m_RSR.begin(), m_RSR.end(),
sort_band());
85 template <
class TPrecision,
class TValuePrecision>
90 const double wavelengthPrecision = 0.0025;
94 sampling = wavelengthPrecision;
98 for (
unsigned int i = 0; i < m_NbBands; ++i)
102 m_RSR.push_back(RSRBand);
108 for (
double j = lambdaMin; j < lambdaMax; j = j + sampling)
111 std::pair<TPrecision, TValuePrecision> currentPair;
112 currentPair.first = currentLambda;
113 currentPair.second = value / coefNormalization;
114 m_RSR[0]->GetResponse().push_back(currentPair);
118 template <
class TPrecision,
class TValuePrecision>
125 template <
class TPrecision,
class TValuePrecision>
131 template <
class TPrecision,
class TValuePrecision>
133 const unsigned int numBand)
136 if (numBand >= m_NbBands)
138 itkExceptionMacro(<<
"There is no band num " << numBand <<
" in the RSR vector!(Size of the current RSR vector is " << m_NbBands <<
")");
142 return (*(m_RSR[numBand]))(lambda);
146 template <
class TPrecision,
class TValuePrecision>
149 Superclass::PrintSelf(os, indent);
154 for (
typename RSRVectorType::const_iterator it = m_RSR.begin(); it != m_RSR.end(); ++it)
156 os << indent <<
"Band Number " << it - m_RSR.begin() << std::endl;
157 (*it)->PrintSelf(os, indent);