Orfeo Toolbox  4.0
otbFormosatImageMetadataInterface.cxx
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 
20 
21 #include <boost/algorithm/string.hpp>
22 #include "otbMacro.h"
23 #include "otbMath.h"
24 #include "itkMetaDataObject.h"
25 #include "otbImageKeywordlist.h"
26 
27 namespace otb
28 {
29 
32 {
33 }
34 
35 bool
37 {
38  std::string sensorID = GetSensorID();
39  if (sensorID.find("Formosat") != std::string::npos) return true;
40  else return false;
41 }
42 
43 std::string
45 {
46  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
47  if (!this->CanRead())
48  {
49  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
50  }
51 
52  ImageKeywordlistType imageKeywordlist;
53 
55  {
56  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
57  }
58 
59  if (imageKeywordlist.HasKey("support_data.instrument"))
60  {
61  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.instrument");
62  return valueString;
63  }
64 
65  return "";
66 }
67 
68 unsigned int
70 {
71  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
72  if (!this->CanRead())
73  {
74  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
75  }
76 
77  ImageKeywordlistType imageKeywordlist;
78 
80  {
81  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
82  }
83 
84  if (imageKeywordlist.HasKey("support_data.instrument_index"))
85  {
86  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.instrument_index");
87  unsigned int value = atoi(valueString.c_str());
88  return value;
89  }
90 
91  return -1; // Invalid value
92 }
93 
96 {
97  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
98  if (!this->CanRead())
99  {
100  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
101  }
102 
103  ImageKeywordlistType imageKeywordlist;
104 
106  {
107  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
108  }
109 
110  std::vector<double> outputValues;
111  if (imageKeywordlist.HasKey("support_data.solar_irradiance"))
112  {
113  std::vector<std::string> outputValuesString;
114  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.solar_irradiance");
115  boost::trim(valueString);
116  boost::split(outputValuesString, valueString, boost::is_any_of(" "));
117  for (unsigned int i = 0; i < outputValuesString.size(); ++i)
118  {
119  outputValues.push_back(atof(outputValuesString[i].c_str()));
120  }
121  }
122 
123  VariableLengthVectorType outputValuesVariableLengthVector;
124  outputValuesVariableLengthVector.SetSize(outputValues.size());
125  outputValuesVariableLengthVector.Fill(0);
126  //In the case of SPOT, the bands are in a different order:
127  // XS3, XS2. XS1, SWIR in the tif file.
128  if (outputValues.size() == 1)
129  {
130  //this is a PAN image
131  outputValuesVariableLengthVector[0] = outputValues[0];
132  }
133  else if (outputValues.size() == 4)
134  {
135  outputValuesVariableLengthVector[0] = outputValues[2];
136  outputValuesVariableLengthVector[1] = outputValues[1];
137  outputValuesVariableLengthVector[2] = outputValues[0];
138  outputValuesVariableLengthVector[3] = outputValues[3];
139  }
140  else
141  {
142  itkExceptionMacro("Invalid Solar Irradiance");
143  }
144 
145  return outputValuesVariableLengthVector;
146 }
147 
148 int
150 {
151  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
152  if (!this->CanRead())
153  {
154  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
155  }
156 
157  ImageKeywordlistType imageKeywordlist;
158 
160  {
161  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
162  }
163 
164  if (!imageKeywordlist.HasKey("support_data.image_date"))
165  {
166  return -1;
167  }
168 
169  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.image_date");
170  std::vector<std::string> outputValues;
171 
172  boost::split(outputValues, valueString, boost::is_any_of(" T:-"));
173 
174  if (outputValues.size() <= 2) itkExceptionMacro(<< "Invalid Day");
175 
176  int value = atoi(outputValues[2].c_str());
177  return value;
178 }
179 
180 int
182 {
183  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
184  if (!this->CanRead())
185  {
186  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
187  }
188 
189  ImageKeywordlistType imageKeywordlist;
190 
192  {
193  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
194  }
195 
196  if (!imageKeywordlist.HasKey("support_data.image_date"))
197  {
198  return -1;
199  }
200 
201  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.image_date");
202  std::vector<std::string> outputValues;
203  boost::split(outputValues, valueString, boost::is_any_of(" T:-"));
204 
205  if (outputValues.size() <= 2) itkExceptionMacro(<< "Invalid Month");
206 
207  int value = atoi(outputValues[1].c_str());
208  return value;
209 }
210 
211 int
213 {
214  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
215  if (!this->CanRead())
216  {
217  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
218  }
219 
220  ImageKeywordlistType imageKeywordlist;
221 
223  {
224  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
225  }
226 
227  if (!imageKeywordlist.HasKey("support_data.image_date"))
228  {
229  return -1;
230  }
231 
232  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.image_date");
233  std::vector<std::string> outputValues;
234  boost::split(outputValues, valueString, boost::is_any_of(" T:-"));
235 
236  if (outputValues.size() <= 2) itkExceptionMacro(<< "Invalid Year");
237 
238  int value = atoi(outputValues[0].c_str());
239  return value;
240 }
241 
242 int
244 {
245  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
246  if (!this->CanRead())
247  {
248  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
249  }
250 
251  ImageKeywordlistType imageKeywordlist;
252 
254  {
255  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
256  }
257 
258  if (!imageKeywordlist.HasKey("support_data.image_date"))
259  {
260  return -1;
261  }
262 
263  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.image_date");
264  std::vector<std::string> outputValues;
265  boost::split(outputValues, valueString, boost::is_any_of(" T:-"));
266 
267  if (outputValues.size() < 4) itkExceptionMacro(<< "Invalid Hour");
268 
269  int value = atoi(outputValues[3].c_str());
270  return value;
271 }
272 
273 int
275 {
276  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
277  if (!this->CanRead())
278  {
279  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
280  }
281 
282  ImageKeywordlistType imageKeywordlist;
283 
285  {
286  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
287  }
288 
289  if (!imageKeywordlist.HasKey("support_data.image_date"))
290  {
291  return -1;
292  }
293 
294  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.image_date");
295  std::vector<std::string> outputValues;
296  boost::split(outputValues, valueString, boost::is_any_of(" T:-"));
297 
298  if (outputValues.size() < 5) itkExceptionMacro(<< "Invalid Minute");
299 
300  int value = atoi(outputValues[4].c_str());
301  return value;
302 }
303 
304 int
306 {
307  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
308  if (!this->CanRead())
309  {
310  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
311  }
312 
313  ImageKeywordlistType imageKeywordlist;
314 
316  {
317  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
318  }
319 
320  if (!imageKeywordlist.HasKey("support_data.production_date"))
321  {
322  return -1;
323  }
324 
325  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.production_date");
326  std::vector<std::string> outputValues;
327  boost::split(outputValues, valueString, boost::is_any_of(" T:-"));
328 
329  if (outputValues.size() <= 2) itkExceptionMacro(<< "Invalid Day");
330 
331  int value = atoi(outputValues[2].c_str());
332  return value;
333 }
334 
335 int
337 {
338  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
339  if (!this->CanRead())
340  {
341  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
342  }
343 
344  ImageKeywordlistType imageKeywordlist;
345 
347  {
348  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
349  }
350 
351  if (!imageKeywordlist.HasKey("support_data.production_date"))
352  {
353  return -1;
354  }
355 
356  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.production_date");
357  std::vector<std::string> outputValues;
358  boost::split(outputValues, valueString, boost::is_any_of(" T:-"));
359 
360  if (outputValues.size() <= 2) itkExceptionMacro(<< "Invalid Month");
361 
362  int value = atoi(outputValues[1].c_str());
363  return value;
364 }
365 
366 int
368 {
369  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
370  if (!this->CanRead())
371  {
372  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
373  }
374 
375  ImageKeywordlistType imageKeywordlist;
376 
378  {
379  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
380  }
381 
382  if (!imageKeywordlist.HasKey("support_data.production_date"))
383  {
384  return -1;
385  }
386 
387  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.production_date");
388  std::vector<std::string> outputValues;
389  boost::split(outputValues, valueString, boost::is_any_of(" T:-"));
390 
391  if (outputValues.size() <= 2) itkExceptionMacro(<< "Invalid Year");
392 
393  int value = atoi(outputValues[0].c_str());
394  return value;
395 }
396 
400 {
401  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
402  if (!this->CanRead())
403  {
404  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
405  }
406 
407  ImageKeywordlistType imageKeywordlist;
408 
410  {
411  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
412  }
413 
414  std::vector<double> outputValues;
415  if (imageKeywordlist.HasKey("support_data.physical_bias"))
416  {
417  std::vector<std::string> outputValuesString;
418  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.physical_bias");
419  boost::trim(valueString);
420  boost::split(outputValuesString, valueString, boost::is_any_of(" "));
421  for (unsigned int i = 0; i < outputValuesString.size(); ++i)
422  {
423  outputValues.push_back(atof(outputValuesString[i].c_str()));
424  }
425  }
426 
427  VariableLengthVectorType outputValuesVariableLengthVector;
428  outputValuesVariableLengthVector.SetSize(outputValues.size());
429  outputValuesVariableLengthVector.Fill(0);
430  //In the case of FORMOSAT-2, the bands are in a different order:
431  // XS3, XS2. XS1, SWIR in the tif file.
432 
433  if (outputValues.size() == 1)
434  {
435  //this is a PAN image
436  outputValuesVariableLengthVector[0] = outputValues[0];
437  }
438  else if (outputValues.size() == 4)
439  {
440  outputValuesVariableLengthVector[0] = outputValues[2];
441  outputValuesVariableLengthVector[1] = outputValues[1];
442  outputValuesVariableLengthVector[2] = outputValues[0];
443  outputValuesVariableLengthVector[3] = outputValues[3];
444  }
445  else
446  {
447  itkExceptionMacro("Invalid Physical Bias");
448  }
449 
450  return outputValuesVariableLengthVector;
451 }
452 
456 {
457  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
458  if (!this->CanRead())
459  {
460  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
461  }
462 
463  ImageKeywordlistType imageKeywordlist;
464 
466  {
467  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
468  }
469 
470  std::vector<double> outputValues;
471  if (imageKeywordlist.HasKey("support_data.physical_gain"))
472  {
473  std::vector<std::string> outputValuesString;
474  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.physical_gain");
475  boost::trim(valueString);
476  boost::split(outputValuesString, valueString, boost::is_any_of(" "));
477  for (unsigned int i = 0; i < outputValuesString.size(); ++i)
478  {
479  outputValues.push_back(atof(outputValuesString[i].c_str()));
480  }
481  }
482 
483  VariableLengthVectorType outputValuesVariableLengthVector;
484  outputValuesVariableLengthVector.SetSize(outputValues.size());
485  outputValuesVariableLengthVector.Fill(0);
486  //In the case of SPOT, the bands are in a different order:
487  // XS3, XS2. XS1, SWIR in the tif file.
488 
489  if (outputValues.size() == 1)
490  {
491  //this is a PAN image
492  outputValuesVariableLengthVector[0] = outputValues[0];
493  }
494  else if (outputValues.size() == 4)
495  {
496  outputValuesVariableLengthVector[0] = outputValues[2];
497  outputValuesVariableLengthVector[1] = outputValues[1];
498  outputValuesVariableLengthVector[2] = outputValues[0];
499  outputValuesVariableLengthVector[3] = outputValues[3];
500  }
501  else
502  {
503  itkExceptionMacro("Invalid Physical Gain");
504  }
505 
506  return outputValuesVariableLengthVector;
507 }
508 
509 double
511 {
512  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
513  if (!this->CanRead())
514  {
515  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
516  }
517 
518  ImageKeywordlistType imageKeywordlist;
519 
521  {
522  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
523  }
524 
525  if (!imageKeywordlist.HasKey("support_data.incident_angle"))
526  {
527  return 0;
528  }
529 
530  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.incident_angle");
531  double value = 90 - atof(valueString.c_str());
532  return value;
533 }
534 
535 double
537 {
538  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
539  if (!this->CanRead())
540  {
541  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
542  }
543 
544  ImageKeywordlistType imageKeywordlist;
545 
547  {
548  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
549  }
550 
551  if (!imageKeywordlist.HasKey("support_data.incident_angle"))
552  {
553  return 0;
554  }
555 
556  std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.sat_azimuth_angle");
557  double satAz = atof(valueString.c_str());
558 
559  // In some software version, a bug exists.
560  // We have to check the version t correct the satellite azimuth angle contained in the metadata
561  std::string softVersion = imageKeywordlist.GetMetadataByKey("support_data.software_version");
562 
563  if( (softVersion == "R2P_02.03.P1") || (softVersion == "R2P_02.02") || (softVersion == "R2P_02.03") )
564  {
565  if (!imageKeywordlist.HasKey("support_data.viewing_angle_across_track"))
566  {
567  return 0;
568  }
569  if (!imageKeywordlist.HasKey("support_data.viewing_angle_along_track"))
570  {
571  return 0;
572  }
573  if (!imageKeywordlist.HasKey("support_data.scene_orientation"))
574  {
575  return 0;
576  }
577 
578  valueString = imageKeywordlist.GetMetadataByKey("support_data.viewing_angle_across_track");
579  double viewingAngleAcrossTrack( atof(valueString.c_str()) );
580  valueString = imageKeywordlist.GetMetadataByKey("support_data.viewing_angle_along_track");
581  double viewingAngleAlongTrack( atof(valueString.c_str()) );
582  valueString = imageKeywordlist.GetMetadataByKey("support_data.scene_orientation");
583  double sceneOrientation( atof(valueString.c_str()) );
584 
585  double alpha = vcl_atan( vcl_tan( viewingAngleAcrossTrack * CONST_PI_180 ) / vcl_tan( viewingAngleAlongTrack * CONST_PI_180 ) ) * CONST_180_PI;
586 
587  if( viewingAngleAlongTrack < 0 )
588  {
589  if (alpha >0)
590  {
591  alpha = alpha - 180;
592  }
593  else
594  {
595  alpha = alpha + 180;
596  }
597  }
598 
599  alpha -= sceneOrientation;
600  if (alpha >0)
601  {
602  satAz += 180;
603  }
604  else
605  {
606  satAz = 180 - satAz;
607  }
608 
609  }
610 
611  return satAz;
612 }
613 
617 {
618  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
619  if (!this->CanRead())
620  {
621  itkExceptionMacro(<< "Invalid metadata, no Formosat2 Image");
622  }
623 
624  ImageKeywordlistType imageKeywordlist;
625 
627  {
628  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
629  }
630 
631  VariableLengthVectorType wavel(1);
632  wavel.Fill(0.);
633 
634  int nbBands = this->GetNumberOfBands();
635  std::string sensorId = this->GetSensorID();
636 
637  // Panchromatic case
638  if (nbBands == 1)
639  {
640  wavel.SetSize(1);
641  // FIXME that's definitely NOT correct in a formosat file!!!
642  if (sensorId == "SPOT4") wavel.Fill(0.610);
643  else if (sensorId == "SPOT5") wavel.Fill(0.480);
644  else itkExceptionMacro(<< "Invalid Formosat2 Sensor ID");
645  }
646  else if (nbBands > 1 && nbBands < 5)
647  {
648  wavel.SetSize(4);
649  //FIXME is that supposed to correspond to the bands in the files?
650  wavel[0] = 0.500;
651  wavel[1] = 0.610;
652  wavel[2] = 0.780;
653  wavel[3] = 1.580;
654  }
655  else itkExceptionMacro(<< "Invalid number of bands...");
656 
657  return wavel;
658 }
659 
663 {
664  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
665  if (!this->CanRead())
666  {
667  itkExceptionMacro(<< "Invalid metadata, no Formosat2 Image");
668  }
669 
670  ImageKeywordlistType imageKeywordlist;
671 
673  {
674  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
675  }
676 
677  VariableLengthVectorType wavel(1);
678  wavel.Fill(0.);
679 
680  int nbBands = this->GetNumberOfBands();
681  std::string sensorId = this->GetSensorID();
682 
683  // Panchromatic case
684  if (nbBands == 1)
685  {
686  wavel.SetSize(1);
687  if (sensorId == "SPOT4") wavel.Fill(0.680);
688  else if (sensorId == "SPOT5") wavel.Fill(0.710);
689  else itkExceptionMacro(<< "Invalid Formosat2 Sensor ID");
690  }
691  else if (nbBands > 1 && nbBands < 5)
692  {
693  //FIXME is that supposed to correspond to the bands in the files?
694  wavel.SetSize(4);
695  wavel[0] = 0.590;
696  wavel[1] = 0.680;
697  wavel[2] = 0.890;
698  wavel[3] = 1.750;
699  }
700  else itkExceptionMacro(<< "Invalid number of bands...");
701 
702  return wavel;
703 }
704 
705 unsigned int
707 ::BandIndexToWavelengthPosition(unsigned int i) const
708 {
709  otbMsgDevMacro(<< "Formosat2 detected: band 0 and 2 inverted");
710  if (i == 0) return 2;
711  if (i == 2) return 0;
712  return i;
713 }
714 
715 std::vector<unsigned int>
717 {
718  std::vector<unsigned int> rgb(3);
719  rgb[0] = 0;
720  rgb[1] = 1;
721  rgb[2] = 2;
722  return rgb;
723 }
724 
728 {
729  WavelengthSpectralBandVectorType wavelengthSpectralBand = InternalWavelengthSpectralBandVectorType::New();
730  std::list <std::vector<float> > tmpSpectralBandList;
731 
732  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
733  if (!this->CanRead())
734  {
735  itkExceptionMacro(<< "Invalid Metadata, no Formosat Image");
736  }
737 
738  ImageKeywordlistType imageKeywordlist;
739 
741  {
742  itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
743  }
744 
745  int nbBands = this->GetNumberOfBands();
746  std::string sensorId = this->GetSensorID();
747 
748  // Panchromatic case
749  if (nbBands == 1)
750  {
751  const float b0[281] =
752  {
753  0, 0, 0, 0, 0, 0,
754  0, 0, 0, 0, 0, 0,
755  0, 0, 0, 0, 0, 0,
756  0, 0, 0, 0, 0, 0,
757  0, 0, 0, 0, 0, 0,
758  0, 0, 0, 0, 0, 0,
759  0, 0, 0, 0, 0, 0,
760  0, 0, 0, 0, 0, 0,
761  0, 0, 0.000219376, 0.000219425, 0.000231534, 0.000284519,
762  0.000550079, 0.001, 0.003, 0.006, 0.012, 0.0235,
763  0.035, 0.043, 0.0503893, 0.0525, 0.055, 0.0565,
764  0.058, 0.059, 0.059, 0.0608594, 0.061, 0.0615,
765  0.062, 0.063, 0.063, 0.064, 0.063, 0.064,
766  0.065, 0.066, 0.066, 0.066, 0.066, 0.0675,
767  0.069, 0.0708104, 0.0709615, 0.0709001, 0.071, 0.0715,
768  0.073, 0.074, 0.074, 0.073, 0.073, 0.0735,
769  0.075, 0.0765, 0.078, 0.078, 0.078, 0.0785,
770  0.0800145, 0.0815, 0.083, 0.083, 0.083, 0.083,
771  0.083, 0.0835, 0.085, 0.0865, 0.087, 0.088,
772  0.087, 0.087, 0.088, 0.0885, 0.0907023, 0.0915,
773  0.092, 0.092, 0.092, 0.092, 0.093, 0.094,
774  0.095, 0.096, 0.096, 0.096, 0.095, 0.095,
775  0.095, 0.095, 0.096, 0.0975, 0.098, 0.099,
776  0.099, 0.098, 0.098, 0.0965, 0.096, 0.0965,
777  0.098, 0.0985, 0.099, 0.0995, 0.099, 0.0975,
778  0.097, 0.0955, 0.095, 0.095, 0.095, 0.0965,
779  0.097, 0.098, 0.098, 0.0975, 0.097, 0.096,
780  0.095, 0.095, 0.094, 0.094, 0.095, 0.0955,
781  0.096, 0.097, 0.097, 0.097, 0.097, 0.097,
782  0.097, 0.096, 0.097, 0.097, 0.097, 0.098,
783  0.098, 0.096, 0.095, 0.094, 0.093, 0.092,
784  0.091, 0.0905658, 0.089, 0.089, 0.089, 0.088,
785  0.088, 0.0875, 0.087, 0.086, 0.085, 0.084,
786  0.083, 0.0825, 0.082, 0.081, 0.081, 0.0804051,
787  0.079, 0.078, 0.077, 0.077, 0.076, 0.075,
788  0.074, 0.0735, 0.073, 0.0725, 0.072, 0.071,
789  0.071, 0.0704136, 0.069, 0.0685, 0.068, 0.067,
790  0.066, 0.0645, 0.063, 0.062, 0.0607892, 0.059,
791  0.058, 0.057, 0.056, 0.0545, 0.052, 0.0455,
792  0.038, 0.0286994, 0.0202138, 0.0125, 0.007, 0.004,
793  0.002, 0.001, 0.000909856, 0.000512159, 0.000357051, 0.00029112,
794  0.000215752, 0.000187213, 0.000171918, 0.000169724, 0.000166392, 0.000163058,
795  0.000159726, 0.000156393, 0.000153061, 0.000149728, 0, 0,
796  0, 0, 0, 0, 0, 0,
797  0, 0, 0, 0, 0, 0,
798  0, 0, 0, 0, 0, 0,
799  0, 0, 0, 0, 0
800  };
801 
802  //add panchromatic band to the temporary list
803  const std::vector<float> vb0 (b0, b0 + sizeof(b0) / sizeof(float) );
804  tmpSpectralBandList.push_back(vb0);
805  }
806  else if (nbBands > 1 && nbBands < 5)
807  {
808  const float b1[281] =
809  {
810  0, 0, 0, 0, 0, 0,
811  0, 0, 0, 0, 0, 0,
812  0, 0, 0, 0, 0, 0,
813  0, 0, 0, 0, 0, 0,
814  0, 0, 0, 0, 0, 0,
815  0, 0, 0, 0, 0, 0,
816  0, 0, 0, 0, 0, 0,
817  0, 0, 0, 0, 0, 0,
818  0, 0, 0.000354959, 0.000354603, 0.000376745, 0.000478212,
819  0.0009718, 0.002, 0.005, 0.0124297, 0.024, 0.0415,
820  0.057, 0.0685, 0.074, 0.074, 0.076, 0.0795695,
821  0.082, 0.084, 0.083, 0.0825, 0.086, 0.0910953,
822  0.094, 0.096, 0.096, 0.094, 0.094, 0.096,
823  0.099, 0.0995, 0.099, 0.098, 0.095, 0.092,
824  0.095, 0.0985, 0.092, 0.0695, 0.037, 0.025,
825  0.009, 0.0025, 0.001, 0.000847053, 0.000588401, 0.00051966,
826  0.00050602, 0, 0, 0, 0, 0,
827  0, 0, 0, 0, 0, 0,
828  0, 0, 0, 0, 0, 0,
829  0, 0, 0, 0, 0, 0,
830  0, 0, 0, 0, 0, 0,
831  0, 0, 0, 0, 0, 0,
832  0, 0, 0, 0, 0, 0,
833  0, 0, 0, 0, 0, 0,
834  0, 0, 0, 0, 0, 0,
835  0, 0, 0, 0, 0, 0,
836  0, 0, 0, 0, 0, 0,
837  0, 0, 0, 0, 0, 0,
838  0, 0, 0, 0, 0, 0,
839  0, 0, 0, 0, 0, 0,
840  0, 0, 0, 0, 0, 0,
841  0, 0, 0, 0, 0, 0,
842  0, 0, 0, 0, 0, 0,
843  0, 0, 0, 0, 0, 0,
844  0, 0, 0, 0, 0, 0,
845  0, 0, 0, 0, 0, 0,
846  0, 0, 0, 0, 0, 0,
847  0, 0, 0, 0, 0, 0,
848  0, 0, 0, 0, 0, 0,
849  0, 0, 0, 0, 0, 0,
850  0, 0, 0, 0, 0, 0,
851  0, 0, 0, 0, 0, 0,
852  0, 0, 0, 0, 0, 0,
853  0, 0, 0, 0, 0, 0,
854  0, 0, 0, 0, 0, 0,
855  0, 0, 0, 0, 0, 0,
856  0, 0, 0, 0, 0
857  };
858 
859  const float b2[281] =
860  {
861  0, 0, 0, 0, 0, 0,
862  0, 0, 0, 0, 0, 0,
863  0, 0, 0, 0, 0, 0,
864  0, 0, 0, 0, 0, 0,
865  0, 0, 0, 0, 0, 0,
866  0, 0, 0, 0, 0, 0,
867  0, 0, 0, 0, 0, 0,
868  0, 0, 0, 0, 0, 0,
869  0, 0, 0, 0, 0, 0,
870  0, 0, 0, 0, 0, 0,
871  0, 0, 0, 0, 0, 0,
872  0, 0, 0, 0, 0, 0,
873  0, 0, 0, 0, 0, 0,
874  0, 0, 0.000324677, 0.000326475, 0.000331943, 0.000386303,
875  0.000447683, 0.001, 0.003, 0.0045, 0.012, 0.0205,
876  0.036, 0.0615, 0.075, 0.081, 0.082, 0.0845,
877  0.087, 0.0885, 0.088, 0.087, 0.086, 0.0875,
878  0.0908484, 0.0925, 0.094, 0.094, 0.093, 0.0925,
879  0.093, 0.0955, 0.097, 0.098, 0.099, 0.099,
880  0.099, 0.099, 0.099, 0.099, 0.095, 0.0815,
881  0.057, 0.032, 0.018, 0.0112534, 0.005, 0.0015,
882  0.000758484, 0.000604297, 0.000512471, 0.000475316, 0.000453283, 0.00044559,
883  0, 0, 0, 0, 0, 0,
884  0, 0, 0, 0, 0, 0,
885  0, 0, 0, 0, 0, 0,
886  0, 0, 0, 0, 0, 0,
887  0, 0, 0, 0, 0, 0,
888  0, 0, 0, 0, 0, 0,
889  0, 0, 0, 0, 0, 0,
890  0, 0, 0, 0, 0, 0,
891  0, 0, 0, 0, 0, 0,
892  0, 0, 0, 0, 0, 0,
893  0, 0, 0, 0, 0, 0,
894  0, 0, 0, 0, 0, 0,
895  0, 0, 0, 0, 0, 0,
896  0, 0, 0, 0, 0, 0,
897  0, 0, 0, 0, 0, 0,
898  0, 0, 0, 0, 0, 0,
899  0, 0, 0, 0, 0, 0,
900  0, 0, 0, 0, 0, 0,
901  0, 0, 0, 0, 0, 0,
902  0, 0, 0, 0, 0, 0,
903  0, 0, 0, 0, 0, 0,
904  0, 0, 0, 0, 0, 0,
905  0, 0, 0, 0, 0, 0,
906  0, 0, 0, 0, 0, 0,
907  0, 0, 0, 0, 0
908  };
909 
910  const float b3[281] =
911  {
912  0, 0, 0, 0, 0, 0,
913  0, 0, 0, 0, 0, 0,
914  0, 0, 0, 0, 0, 0,
915  0, 0, 0, 0, 0, 0,
916  0, 0, 0, 0, 0, 0,
917  0, 0, 0, 0, 0, 0,
918  0, 0, 0, 0, 0, 0,
919  0, 0, 0, 0, 0, 0,
920  0, 0, 0, 0, 0, 0,
921  0, 0, 0, 0, 0, 0,
922  0, 0, 0, 0, 0, 0,
923  0, 0, 0, 0, 0, 0,
924  0, 0, 0, 0, 0, 0,
925  0, 0, 0, 0, 0, 0,
926  0, 0, 0, 0, 0, 0,
927  0, 0, 0, 0, 0, 0,
928  0, 0, 0, 0, 0, 0,
929  0, 0, 0, 0, 0, 0,
930  0, 0, 0, 0, 0, 0,
931  0, 0, 0, 0, 0, 0,
932  0, 0, 0, 0, 0, 0.000461752,
933  0.001, 0.001, 0.003, 0.006, 0.013, 0.0335,
934  0.063, 0.089, 0.098, 0.099, 0.099, 0.099,
935  0.099, 0.0985, 0.097, 0.0945, 0.092, 0.0906796,
936  0.089, 0.0907659, 0.093, 0.0965, 0.1, 0.097,
937  0.091, 0.0865, 0.086, 0.0910438, 0.094, 0.092,
938  0.093, 0.088, 0.064, 0.034, 0.015, 0.0075,
939  0.006, 0.0045, 0.003, 0.001, 0.000607601, 0.000202927,
940  0, 0, 0, 0, 0, 0,
941  0, 0, 0, 0, 0, 0,
942  0, 0, 0, 0, 0, 0,
943  0, 0, 0, 0, 0, 0,
944  0, 0, 0, 0, 0, 0,
945  0, 0, 0, 0, 0, 0,
946  0, 0, 0, 0, 0, 0,
947  0, 0, 0, 0, 0, 0,
948  0, 0, 0, 0, 0, 0,
949  0, 0, 0, 0, 0, 0,
950  0, 0, 0, 0, 0, 0,
951  0, 0, 0, 0, 0, 0,
952  0, 0, 0, 0, 0, 0,
953  0, 0, 0, 0, 0, 0,
954  0, 0, 0, 0, 0, 0,
955  0, 0, 0, 0, 0, 0,
956  0, 0, 0, 0, 0, 0,
957  0, 0, 0, 0, 0, 0,
958  0, 0, 0, 0, 0
959  };
960 
961  const float b4[281] =
962  {
963  0, 0, 0, 0, 0, 0,
964  0, 0, 0, 0, 0, 0,
965  0, 0, 0, 0, 0, 0,
966  0, 0, 0, 0, 0, 0,
967  0, 0, 0, 0, 0, 0,
968  0, 0, 0, 0, 0, 0,
969  0, 0, 0, 0, 0, 0,
970  0, 0, 0, 0, 0, 0,
971  0, 0, 0, 0, 0, 0,
972  0, 0, 0, 0, 0, 0,
973  0, 0, 0, 0, 0, 0,
974  0, 0, 0, 0, 0, 0,
975  0, 0, 0, 0, 0, 0,
976  0, 0, 0, 0, 0, 0,
977  0, 0, 0, 0, 0, 0,
978  0, 0, 0, 0, 0, 0,
979  0, 0, 0, 0, 0, 0,
980  0, 0, 0, 0, 0, 0,
981  0, 0, 0, 0, 0, 0,
982  0, 0, 0, 0, 0, 0,
983  0, 0, 0, 0, 0, 0,
984  0, 0, 0, 0, 0, 0,
985  0, 0, 0, 0, 0, 0,
986  0, 0, 0, 0, 0, 0,
987  0, 0, 0, 0, 0, 0,
988  0, 0, 0, 0, 0, 0,
989  0, 0, 0, 0, 0, 0,
990  0, 0.000481456, 0.00071923, 0.00098303, 0.001, 0.000947915,
991  0.00090899, 0.000887367, 0.000576847, 0.000470858, 0.00052246, 0.000713811,
992  0.001, 0.0015, 0.003, 0.005, 0.008, 0.0145,
993  0.022, 0.035, 0.049, 0.0595, 0.075, 0.0905,
994  0.098, 0.0995, 0.097, 0.093, 0.091, 0.0925,
995  0.094, 0.096, 0.096, 0.0955, 0.094, 0.092,
996  0.0907811, 0.089, 0.088, 0.088, 0.088, 0.088,
997  0.088, 0.0875, 0.087, 0.086, 0.085, 0.084,
998  0.083, 0.083, 0.082, 0.081, 0.0806396, 0.079,
999  0.078, 0.077, 0.076, 0.075, 0.074, 0.073,
1000  0.072, 0.071, 0.0700369, 0.0685, 0.067, 0.0655,
1001  0.064, 0.063, 0.063, 0.062, 0.059, 0.054,
1002  0.043, 0.034, 0.025, 0.016, 0.009, 0.0055,
1003  0.003, 0.0015, 0.001, 0.000691333, 0.000432126, 0.000356974,
1004  0.000265441, 0.000219773, 0.000195346, 0.000192716, 0.000188932, 0.000185148,
1005  0.000181364, 0.00017758, 0.000173796, 0.000170011, 0.000166227, 0,
1006  0, 0, 0, 0, 0, 0,
1007  0, 0, 0, 0, 0, 0,
1008  0, 0, 0, 0, 0, 0,
1009  0, 0, 0, 0, 0
1010  };
1011 
1012  //Add multispectral bands to the temporary list
1013  const std::vector<float> vb1 (b1, b1 + sizeof(b1) / sizeof(float) );
1014  tmpSpectralBandList.push_back(vb1);
1015  const std::vector<float> vb2 (b2, b2 + sizeof(b2) / sizeof(float) );
1016  tmpSpectralBandList.push_back(vb2);
1017  const std::vector<float> vb3 (b3, b3 + sizeof(b3) / sizeof(float) );
1018  tmpSpectralBandList.push_back(vb3);
1019  const std::vector<float> vb4 (b4, b4 + sizeof(b4) / sizeof(float) );
1020  tmpSpectralBandList.push_back(vb4);
1021 
1022  unsigned int j = 0;
1023  for (std::list <std::vector<float> >::const_iterator it = tmpSpectralBandList.begin(); it != tmpSpectralBandList.end(); ++it)
1024  {
1025  wavelengthSpectralBand->PushBack(FilterFunctionValues::New());
1026  wavelengthSpectralBand->GetNthElement(j)->SetFilterFunctionValues(*it);
1027  wavelengthSpectralBand->GetNthElement(j)->SetMinSpectralValue(0.300);
1028  wavelengthSpectralBand->GetNthElement(j)->SetMaxSpectralValue(1.0);
1029  wavelengthSpectralBand->GetNthElement(j)->SetUserStep(0.0025);
1030  ++j;
1031  }
1032  }
1033 
1034  return wavelengthSpectralBand;
1035 }
1036 
1037 } // end namespace otb

Generated at Sat Mar 8 2014 15:55:46 for Orfeo Toolbox with doxygen 1.8.3.1