21 #ifndef otbMultiToMonoChannelExtractROI_hxx
22 #define otbMultiToMonoChannelExtractROI_hxx
32 template <
class TInputPixelType,
class TOutputPixelType>
41 template <
class TInputPixelType,
class TOutputPixelType>
44 Superclass::PrintSelf(os, indent);
56 template <
class TInputPixelType,
class TOutputPixelType>
59 typename Superclass::InputImageConstPointer inputPtr = this->GetInput();
61 if ((m_Channel <= 0) || (m_Channel > inputPtr->GetVectorLength()))
63 itkExceptionMacro(<<
"otb::MultiToMonoChannelExtractROI::GenerateOutputInformation "
64 <<
"The selected channel must in the range [1;" << inputPtr->GetVectorLength() <<
"] "
65 <<
typeid(itk::ImageBase<InputImageDimension>*).name());
70 Superclass::GenerateOutputInformation();
73 template <
class TInputPixelType,
class TOutputPixelType>
75 itk::ThreadIdType threadId)
77 itkDebugMacro(<<
"Actually executing");
80 typename Superclass::InputImageConstPointer inputPtr = this->GetInput();
81 typename Superclass::OutputImagePointer outputPtr = this->GetOutput();
84 itk::ProgressReporter progress(
this, threadId, outputRegionForThread.GetNumberOfPixels());
88 this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread);
91 typedef itk::ImageRegionIterator<OutputImageType> OutputIterator;
92 typedef itk::ImageRegionConstIterator<InputImageType> InputIterator;
94 OutputIterator outIt(outputPtr, outputRegionForThread);
95 InputIterator inIt(inputPtr, inputRegionForThread);
98 const unsigned int channelIn(m_Channel - 1);
100 while (!outIt.IsAtEnd())
105 outIt.Set(pixelOutput);
108 progress.CompletedPixel();