18 #ifndef __otbMorphologicalPyramidSynthesisFilter_txx
19 #define __otbMorphologicalPyramidSynthesisFilter_txx
34 template <
class TInputImage,
class TOutputImage>
38 this->SetNumberOfRequiredInputs(5);
43 template <
class TInputImage,
class TOutputImage>
50 template <
class TInputImage,
class TOutputImage>
55 this->SetNthInput(1, const_cast<InputImageListType *>(imageList));
61 template <
class TInputImage,
class TOutputImage>
66 this->SetNthInput(2, const_cast<InputImageListType *>(imageList));
73 template <
class TInputImage,
class TOutputImage>
78 this->SetNthInput(3, const_cast<InputImageListType *>(imageList));
84 template <
class TInputImage,
class TOutputImage>
89 this->SetNthInput(4, const_cast<InputImageListType *>(imageList));
96 template <
class TInputImage,
class TOutputImage>
108 template <
class TInputImage,
class TOutputImage>
110 ::InputImageListType*
120 template <
class TInputImage,
class TOutputImage>
122 ::InputImageListType*
132 template <
class TInputImage,
class TOutputImage>
134 ::InputImageListType*
143 template <
class TInputImage,
class TOutputImage>
148 otbMsgDevMacro(<<
"MorphologicalPyramidSynthesisFilter : Entering main method.");
165 typename DuplicatorType::Pointer duplicator = DuplicatorType::New();
166 duplicator->SetInputImage(this->GetInput());
167 duplicator->Update();
170 typename InputImageType::Pointer currentImage = duplicator->GetOutput();
173 typename AddFilterType::Pointer add1, add2;
174 typename SubtractFilterType::Pointer subtract1, subtract2;
175 typename ResamplerType::Pointer resampler;
182 while (it != supFilter->
End())
184 size.push_back(it.Get()->GetLargestPossibleRegion().GetSize());
187 otbMsgDevMacro(<<
"MorphologicalPyramidSynthesisFilter : Size vector computation OK");
204 && itSize != size.rend())
209 resampler = ResamplerType::New();
210 resampler->SetSize(*itSize);
211 resampler->SetInput(currentImage);
213 otbMsgDevMacro(<<
"MorphologicalPyramidSynthesisFilter: step " << i <<
" Upsampling OK");
215 add1 = AddFilterType::New();
216 add1->SetInput1(resampler->GetOutput());
217 add1->SetInput2(itsupFilter.Get());
218 add2 = AddFilterType::New();
219 add2->SetInput1(add1->GetOutput());
220 add2->SetInput2(itsupDeci.Get());
223 subtract1 = SubtractFilterType::New();
224 subtract1->SetInput1(add2->GetOutput());
225 subtract1->SetInput2(itinfFilter.Get());
226 subtract2 = SubtractFilterType::New();
227 subtract2->SetInput1(subtract1->GetOutput());
228 subtract2->SetInput2(itinfDeci.Get());
230 otbMsgDevMacro(<<
"MorphologicalPyramidSynthesisFilter: step " << i <<
" Details addition OK");
233 currentImage = subtract2->GetOutput();
234 OutputImageList->
PushBack(currentImage);
243 otbMsgDevMacro(<<
"MorphologicalPyramidSynthesisFilter: Exiting main method.");
248 template <
class TInputImage,
class TOutputImage>
253 Superclass::PrintSelf(os, indent);