Orfeo Toolbox  4.0
otbMorphologicalPyramidMRToMSConverter.txx
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 #ifndef __otbMorphologicalPyramidMRToMSConverter_txx
19 #define __otbMorphologicalPyramidMRToMSConverter_txx
20 
23 #include "otbMacro.h"
24 
25 namespace otb
26 {
27 namespace MorphologicalPyramid
28 {
32 template <class TInputImage, class TOutputImage>
35 {
36  this->SetNumberOfRequiredInputs(2);
37  this->SetNumberOfRequiredOutputs(2);
38  OutputImageListPointerType supFilter = OutputImageListType::New();
39  this->SetNthOutput(0, supFilter.GetPointer());
40  OutputImageListPointerType infFilter = OutputImageListType::New();
41  this->SetNthOutput(1, infFilter.GetPointer());
42  OutputImageListPointerType outputList = OutputImageListType::New();
43  this->SetNthOutput(2, outputList.GetPointer());
44  OutputImageListPointerType supDeci = OutputImageListType::New();
45  this->SetNthOutput(3, supDeci.GetPointer());
46  OutputImageListPointerType infDeci = OutputImageListType::New();
47  this->SetNthOutput(4, infDeci.GetPointer());
48 }
54 template <class TInputImage, class TOutputImage>
56 ::OutputImageListType*
59 {
60  return dynamic_cast<OutputImageListType*>(this->itk::ProcessObject::GetOutput(2));
61 }
67 template <class TInputImage, class TOutputImage>
69 ::OutputImageListType*
72 {
73  return dynamic_cast<OutputImageListType*>(this->itk::ProcessObject::GetOutput(0));
74 }
80 template <class TInputImage, class TOutputImage>
82 ::OutputImageListType*
85 {
86  return dynamic_cast<OutputImageListType*>(this->itk::ProcessObject::GetOutput(1));
87 }
93 template <class TInputImage, class TOutputImage>
95 ::OutputImageListType*
98 {
99  return dynamic_cast<OutputImageListType*>(this->itk::ProcessObject::GetOutput(3));
100 }
106 template <class TInputImage, class TOutputImage>
108 ::OutputImageListType*
111 {
112  return dynamic_cast<OutputImageListType*>(this->itk::ProcessObject::GetOutput(4));
113 }
118 template <class TInputImage, class TOutputImage>
119 void
122 {
123  this->SetNthInput(2, const_cast<InputImageListType *>(imageList));
124 }
129 template <class TInputImage, class TOutputImage>
130 void
133 {
134  this->SetNthInput(0, const_cast<InputImageListType *>(imageList));
135 }
140 template <class TInputImage, class TOutputImage>
141 void
144 {
145  this->SetNthInput(1, const_cast<InputImageListType *>(imageList));
146 }
151 template <class TInputImage, class TOutputImage>
152 void
155 {
156  this->SetNthInput(3, const_cast<InputImageListType *>(imageList));
157 }
162 template <class TInputImage, class TOutputImage>
163 void
166 {
167  this->SetNthInput(4, const_cast<InputImageListType *>(imageList));
168 }
173 template <class TInputImage, class TOutputImage>
175 ::InputImageListType*
178 {
179  return dynamic_cast<InputImageListType *>(this->itk::ProcessObject::GetInput(2));
180 }
185 template <class TInputImage, class TOutputImage>
187 ::InputImageListType*
190 {
191  return dynamic_cast<InputImageListType *>(this->itk::ProcessObject::GetInput(0));
192 }
197 template <class TInputImage, class TOutputImage>
199 ::InputImageListType*
202 {
203  return dynamic_cast<InputImageListType *>(this->itk::ProcessObject::GetInput(1));
204 }
209 template <class TInputImage, class TOutputImage>
211 ::InputImageListType*
214 {
215  return dynamic_cast<InputImageListType *>(this->itk::ProcessObject::GetInput(3));
216 }
221 template <class TInputImage, class TOutputImage>
223 ::InputImageListType*
226 {
227  return dynamic_cast<InputImageListType *>(this->itk::ProcessObject::GetInput(4));
228 }
232 template <class TInputImage, class TOutputImage>
233 void
236 {
237  // Input images lists pointers
238  InputImageListPointerType supFilter = this->GetSupFilter();
239  InputImageListPointerType infFilter = this->GetInfFilter();
240  InputImageListPointerType supDeci = this->GetSupDeci();
241  InputImageListPointerType infDeci = this->GetInfDeci();
242  InputImageListPointerType inputList = this->GetInput();
243 
244  // Output images lists pointers
245  OutputImageListPointerType supFilterFullResolution = this->GetSupFilterFullResolution();
246  OutputImageListPointerType infFilterFullResolution = this->GetInfFilterFullResolution();
247  OutputImageListPointerType supDeciFullResolution = this->GetSupDeciFullResolution();
248  OutputImageListPointerType infDeciFullResolution = this->GetInfDeciFullResolution();
249  OutputImageListPointerType outputList = this->GetOutput();
250 
251  // typedef of the resampling filter
253 
254  // Definition of the resampler filters
255  typename ResamplerType::Pointer resampler;
256 
257  // Full resolution size
258  typename InputImageType::SizeType frsize = supFilter->Front()->GetLargestPossibleRegion().GetSize();
259  otbMsgDevMacro(<< "MRToMSConverter: Full resolution size: " << frsize);
260 
261  // SupFilter resampling
262  otbMsgDevMacro(<< "MRToMSConverter: SupFilter resampling.");
263  InputImageListIteratorType it = supFilter->Begin();
264  // The first image does not need any resampling
265  supFilterFullResolution->PushBack(it.Get());
266  ++it;
267  for (; it != supFilter->End(); ++it)
268  {
269  resampler = ResamplerType::New();
270  resampler->SetSize(frsize);
271  resampler->SetInput(it.Get());
272  resampler->Update();
273  supFilterFullResolution->PushBack(resampler->GetOutput());
274  }
275  otbMsgDevMacro(<< "MRToMSConverter: InfFilter resampling.");
276  // InfFilter resampling
277  it = infFilter->Begin();
278  // The first image does not need any resampling
279  infFilterFullResolution->PushBack(it.Get());
280  ++it;
281  for (; it != infFilter->End(); ++it)
282  {
283  resampler = ResamplerType::New();
284  resampler->SetSize(frsize);
285  resampler->SetInput(it.Get());
286  resampler->Update();
287  infFilterFullResolution->PushBack(resampler->GetOutput());
288  }
289 
290  if (inputList)
291  {
292  otbMsgDevMacro(<< "MRToMSConverter: Optional inputList resampling.");
293  // Analyse image resampling
294  it = inputList->Begin();
295  // The first image does not need any resampling
296  outputList->PushBack(it.Get());
297  ++it;
298  for (; it != inputList->End(); ++it)
299  {
300  resampler = ResamplerType::New();
301  resampler->SetSize(frsize);
302  resampler->SetInput(it.Get());
303  resampler->Update();
304  outputList->PushBack(resampler->GetOutput());
305  }
306  }
307 
308  if (supDeci)
309  {
310  otbMsgDevMacro(<< "MRToMSConverter: Optional supDeci resampling.");
311  // SupDeci resampling
312  it = supDeci->Begin();
313  // The first image does not need any resampling
314  supDeciFullResolution->PushBack(it.Get());
315  ++it;
316  for (; it != supDeci->End(); ++it)
317  {
318  resampler = ResamplerType::New();
319  resampler->SetSize(frsize);
320  resampler->SetInput(it.Get());
321  resampler->Update();
322  supDeciFullResolution->PushBack(resampler->GetOutput());
323  }
324  }
325 
326  if (infDeci)
327  {
328  otbMsgDevMacro(<< "MRToMSConverter: Optional infDeci resampling.");
329  // InfDeci resampling
330  it = infDeci->Begin();
331  // The first image does not need any resampling
332  infDeciFullResolution->PushBack(it.Get());
333  ++it;
334  for (; it != infDeci->End(); ++it)
335  {
336  resampler = ResamplerType::New();
337  resampler->SetSize(frsize);
338  resampler->SetInput(it.Get());
339  resampler->Update();
340  infDeciFullResolution->PushBack(resampler->GetOutput());
341  }
342  }
343 }
347 template <class TInputImage, class TOutputImage>
348 void
350 ::PrintSelf(std::ostream& os, itk::Indent indent) const
351 {
352  Superclass::PrintSelf(os, indent);
353 }
354 } // End namespace MorphologicalPyramid
355 } // End namespace otb
356 #endif

Generated at Sat Mar 8 2014 16:08:35 for Orfeo Toolbox with doxygen 1.8.3.1