21 #ifndef otbImageOfVectorsToMonoChannelExtractROI_hxx
22 #define otbImageOfVectorsToMonoChannelExtractROI_hxx
32 template <
class TInputImage,
class TOutputImage>
40 template <
class TInputImage,
class TOutputImage>
43 Superclass::PrintSelf(os, indent);
55 template <
class TInputImage,
class TOutputImage>
58 typename Superclass::InputImageConstPointer inputPtr = this->GetInput();
60 if ((m_Channel <= 0) || (m_Channel > InputImagePixelType::Dimension))
62 itkExceptionMacro(<<
"otb::ExtractImImageOfVectorsToMonoChannelExtractROIageFilter::GenerateOutputInformation "
63 <<
" Channel must be in the following range: [1;" << InputImagePixelType::Dimension <<
"] "
64 <<
typeid(itk::ImageBase<InputImageDimension>*).name());
69 Superclass::GenerateOutputInformation();
72 template <
class TInputImage,
class TOutputImage>
74 itk::ThreadIdType threadId)
76 itkDebugMacro(<<
"Actually executing");
79 typename Superclass::InputImageConstPointer inputPtr = this->GetInput();
80 typename Superclass::OutputImagePointer outputPtr = this->GetOutput();
83 itk::ProgressReporter progress(
this, threadId, outputRegionForThread.GetNumberOfPixels());
87 this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread);
90 typedef itk::ImageRegionIterator<OutputImageType> OutputIterator;
91 typedef itk::ImageRegionConstIterator<InputImageType> InputIterator;
93 OutputIterator outIt(outputPtr, outputRegionForThread);
94 InputIterator inIt(inputPtr, inputRegionForThread);
97 unsigned int channelIn(m_Channel - 1);
100 while (!outIt.IsAtEnd())
103 pixelInput = inIt.Get();
105 outIt.Set(pixelOutput);
108 progress.CompletedPixel();