22 #ifndef otbFunctionToImageFilter_hxx
23 #define otbFunctionToImageFilter_hxx
26 #include "itkImageRegionConstIterator.h"
34 template <
class TInputImage,
class TOutputImage,
class TFunction>
38 m_PixelFunction = FunctionType::New();
39 this->DynamicMultiThreadingOn();
58 template <
class TInputImage,
class TOutputImage,
class TFunction>
61 InputImagePointer inputPtr =
dynamic_cast<const TInputImage*
>((itk::ProcessObject::GetInput(0)));
62 if (inputPtr.IsNull())
64 itkExceptionMacro(<<
"At least one input is missing."
65 <<
" Input is missing :" << inputPtr.GetPointer();)
67 m_PixelFunction->SetInputImage(inputPtr);
74 template <
class TInputImage,
class TOutputImage,
class TFunction>
79 InputImagePointer inputPtr =
dynamic_cast<const TInputImage*
>((itk::ProcessObject::GetInput(0)));
83 itk::ImageRegionConstIterator<TInputImage> inputIt(inputPtr, outputRegionForThread);
84 itk::ImageRegionIterator<TOutputImage> outputIt(outputPtr, outputRegionForThread);
90 while (!inputIt.IsAtEnd())
92 outputIt.Set(
static_cast<OutputImagePixelType>(m_PixelFunction->EvaluateAtIndex(inputIt.GetIndex())));
OutputImageType::RegionType OutputImageRegionType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void BeforeThreadedGenerateData() override
InputImageType::ConstPointer InputImagePointer
OutputImageType::PixelType OutputImagePixelType
OutputImageType::Pointer OutputImagePointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.