21 #ifndef otbLabelMapToSimulatedImageFilter_hxx
22 #define otbLabelMapToSimulatedImageFilter_hxx
29 template <
class TInputLabelMap,
class TSimuStep1,
class TSimuStep2,
class TOutputImage>
32 m_NumberOfComponentsPerPixel = 3;
33 m_SatRSRFilename =
"";
40 template <
class TInputLabelMap,
class TSimuStep1,
class TSimuStep2,
class TOutputImage>
43 Superclass::GenerateOutputInformation();
46 output->SetNumberOfComponentsPerPixel(m_NumberOfComponentsPerPixel);
49 template <
class TInputLabelMap,
class TSimuStep1,
class TSimuStep2,
class TOutputImage>
55 typename OutputImageType::PixelType pixel;
56 pixel.SetSize(m_NumberOfComponentsPerPixel);
57 pixel.Fill(input->GetBackgroundValue());
59 output->FillBuffer(pixel);
61 Superclass::BeforeThreadedGenerateData();
64 template <
class TInputLabelMap,
class TSimuStep1,
class TSimuStep2,
class TOutputImage>
73 for (
unsigned int i = 0; i < labelObject->GetNumberOfAttributes(); ++i)
75 if (labelObject->GetAvailableAttributes()[i].compare(
"path") == 0)
80 readSpectrum->Load(m_PathRoot + labelObject->GetAttribute(
"path"), 100);
81 reduceSpectralResponse->SetInputSpectralResponse(readSpectrum);
90 labelToParams->SetLabel(labelObject->GetAttribute(
"area"));
91 labelToParams->GenerateData();
93 simuStep1->SetInput(labelToParams->GetStep1Parameters());
95 simuStep2->SetParameters(labelToParams->GetStep2Parameters());
96 simuStep2->SetReflectance(simuStep1->GetReflectance());
97 simuStep2->SetTransmittance(simuStep1->GetTransmittance());
99 reduceSpectralResponse->SetInputSpectralResponse(simuStep2->GetViewingReflectance());
103 satRSR->SetNbBands(m_NumberOfComponentsPerPixel);
104 satRSR->Load(m_SatRSRFilename);
105 reduceSpectralResponse->SetInputSatRSR(satRSR);
106 reduceSpectralResponse->CalculateResponse();
108 typename OutputImageType::PixelType pixel;
109 pixel.SetSize(m_NumberOfComponentsPerPixel);
116 while (!lit.IsAtEnd())
118 IndexType idx = lit.GetLine().GetIndex();
119 unsigned long length = lit.GetLine().GetLength();
120 for (
unsigned int i = 0; i < length; ++i)
123 for (
unsigned int j = 0; j < m_NumberOfComponentsPerPixel; ++j)
125 double ran = randomGen->GetNormalVariate(m_Mean, m_Variance);
126 pixel[j] =
static_cast<InternalPixelType>(reduceSpectralResponse->GetReduceResponse()->GetResponse()[j].second + ran);
128 this->GetOutput()->SetPixel(idx, pixel);
136 template <
class TInputLabelMap,
class TSimuStep1,
class TSimuStep2,
class TOutputImage>
139 Superclass::PrintSelf(os, indent);