22 #ifndef otbImageListToSingleImageFilter_hxx
23 #define otbImageListToSingleImageFilter_hxx
25 #include "itkImageRegionConstIteratorWithIndex.h"
26 #include "itkImageRegionIteratorWithIndex.h"
27 #include "itkProgressReporter.h"
35 template <
class TImageType>
38 this->SetNumberOfRequiredInputs(1);
39 this->SetNumberOfRequiredOutputs(1);
43 template <
class TImageType>
47 if (this->GetNumberOfInputs() != 1)
59 template <
class TImageType>
66 typedef itk::ImageRegionConstIteratorWithIndex<InputImageType> InputIteratorType;
67 typedef itk::ImageRegionIteratorWithIndex<OutputImageType> OutputIteratorType;
69 outputPtr->SetBufferedRegion(outputPtr->GetRequestedRegion());
70 outputPtr->Allocate();
72 itk::ProgressReporter progress(
this, 0, outputPtr->GetRequestedRegion().GetNumberOfPixels());
74 OutputIteratorType outputIt(outputPtr, outputPtr->GetRequestedRegion());
77 InputIteratorType inputIt(inputPtr, outputPtr->GetRequestedRegion());
79 while (!inputIt.IsAtEnd())
82 if (!(outputIt).IsAtEnd())
84 outputIt.Set(inputIt.Get());
89 itkGenericExceptionMacro(
"End of image at index " << outputIt.GetIndex() <<
" !");
98 template <
class TImageType>
101 Superclass::PrintSelf(os, indent);