Orfeo Toolbox  4.0
otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.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 =========================================================================*/
19 #include "otbSIXSTraits.h"
20 
21 namespace otb
22 {
29 {
30  this->ProcessObject::SetNumberOfRequiredInputs(1);
31  this->ProcessObject::SetNumberOfRequiredOutputs(1);
32  // Create the output. We use static_cast<> here because we know the default
33  // output must be of type TOutputPointSet
35  = static_cast<AtmosphericRadiativeTermsType*>(this->MakeOutput(0).GetPointer());
36 
37  this->ProcessObject::SetNthOutput(0, output.GetPointer());
38 
39 }
45 ::MakeOutput(unsigned int)
46 {
47  return static_cast<itk::DataObject*>(AtmosphericRadiativeTermsType::New().GetPointer());
48 }
49 
53 void
56 {
57  this->GraftNthOutput(0, graft);
58 }
59 
63 void
65 ::GraftNthOutput(unsigned int idx, itk::DataObject *graft)
66 {
67  if (idx >= this->GetNumberOfOutputs())
68  {
69  itkExceptionMacro(<< "Requested to graft output " << idx <<
70  " but this filter only has " << this->GetNumberOfOutputs() << " Outputs.");
71  }
72 
73  if (!graft)
74  {
75  itkExceptionMacro(<< "Requested to graft output that is a NULL pointer");
76  }
77 
78  itk::DataObject * output = this->GetOutput(idx);
79 
80  // Call Graft on the PointSet in order to copy meta-information, and containers.
81  output->Graft(graft);
82 }
83 
92 {
93  if (this->GetNumberOfOutputs() < 1)
94  {
95  return 0;
96  }
97  return static_cast<AtmosphericRadiativeTermsType *> (this->ProcessObject::GetOutput(0));
98 }
99 
105 ::GetOutput(unsigned int idx)
106 {
107  return static_cast<AtmosphericRadiativeTermsType*>
108  (this->itk::ProcessObject::GetOutput(idx));
109 }
110 
111 void
114 {
115  // A single input image
116  this->itk::ProcessObject::SetNthInput(0, const_cast<AtmosphericCorrectionParametersType*>(object));
117 }
118 
122 {
123  // If there is no input
124  if (this->GetNumberOfInputs() != 1)
125  {
126  // exit
127  return 0;
128  }
129  // else return the first input
130  return static_cast<AtmosphericCorrectionParametersType *>
131  (this->itk::ProcessObject::GetInput(0));
132 }
133 
134 void
137 {
138 
139  AtmosphericCorrectionParametersPointer input = this->GetInput();
140  AtmosphericRadiativeTermsPointer output = this->GetOutput();
141 
142  output->GetValues().clear();
143  typedef AtmosphericCorrectionParameters::WavelengthSpectralBandVectorType WavelengthSpectralBandVectorType;
144  WavelengthSpectralBandVectorType WavelengthSpectralBandVector = input->GetWavelengthSpectralBand();
145  unsigned int NbBand = WavelengthSpectralBandVector->Size();
146 
147  double atmosphericReflectance(0.);
148  double atmosphericSphericalAlbedo(0.);
149  double totalGaseousTransmission(0.);
150  double downwardTransmittance(0.);
151  double upwardTransmittance(0.);
152  double upwardDiffuseTransmittance(0.);
153  double upwardDirectTransmittance(0.);
154  double upwardDiffuseTransmittanceForRayleigh(0.);
155  double upwardDiffuseTransmittanceForAerosol(0.);
156 
157  for (unsigned int i = 0; i < NbBand; ++i)
158  {
159  atmosphericReflectance = 0.;
160  atmosphericSphericalAlbedo = 0.;
161  totalGaseousTransmission = 0.;
162  downwardTransmittance = 0.;
163  upwardTransmittance = 0.;
164  upwardDiffuseTransmittance = 0.;
165  upwardDirectTransmittance = 0.;
166  upwardDiffuseTransmittanceForRayleigh = 0.;
167  upwardDiffuseTransmittanceForAerosol = 0.;
169  input->GetSolarZenithalAngle(),
170  input->GetSolarAzimutalAngle(),
171  input->GetViewingZenithalAngle(),
172  input->GetViewingAzimutalAngle(),
173  input->GetMonth(),
174  input->GetDay(),
175  input->GetAtmosphericPressure(),
176  input->GetWaterVaporAmount(),
177  input->GetOzoneAmount(),
178  input->GetAerosolModel(),
179  input->GetAerosolOptical(),
180  input->GetWavelengthSpectralBand()->GetNthElement(i),
182  atmosphericReflectance,
183  atmosphericSphericalAlbedo,
184  totalGaseousTransmission,
185  downwardTransmittance,
186  upwardTransmittance,
187  upwardDiffuseTransmittance,
188  upwardDirectTransmittance,
189  upwardDiffuseTransmittanceForRayleigh,
190  upwardDiffuseTransmittanceForAerosol
191  );
192 
193  output->SetIntrinsicAtmosphericReflectance(i, atmosphericReflectance);
194  output->SetSphericalAlbedo(i, atmosphericSphericalAlbedo);
195  output->SetTotalGaseousTransmission(i, totalGaseousTransmission);
196  output->SetDownwardTransmittance(i, downwardTransmittance);
197  output->SetUpwardTransmittance(i, upwardTransmittance);
198  output->SetUpwardDiffuseTransmittance(i, upwardDiffuseTransmittance);
199  output->SetUpwardDirectTransmittance(i, upwardDirectTransmittance);
200  output->SetUpwardDiffuseTransmittanceForRayleigh(i, upwardDiffuseTransmittanceForRayleigh);
201  output->SetUpwardDiffuseTransmittanceForAerosol(i, upwardDiffuseTransmittanceForAerosol);
202  output->SetWavelengthSpectralBand(i, input->GetWavelengthSpectralBand()->GetNthElement(i)->GetCenterSpectralValue());
203  }
204 }
205 
209 void
211 ::PrintSelf(std::ostream& os, itk::Indent indent) const
212 {
213  Superclass::PrintSelf(os, indent);
214 }
215 
216 } // end namespace otb

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