21 #ifndef otbUnaryFunctorWithIndexWithOutputSizeImageFilter_hxx
22 #define otbUnaryFunctorWithIndexWithOutputSizeImageFilter_hxx
25 #include "itkImageRegionIterator.h"
32 template <
class TInputImage,
class TOutputImage,
class TFunction>
35 this->SetNumberOfRequiredInputs(1);
37 template <
class TInputImage,
class TOutputImage,
class TFunction>
41 Superclass::GenerateInputRequestedRegion();
45 typename Superclass::InputImagePointer inputPtr =
const_cast<TInputImage*
>(this->GetInput());
46 typename Superclass::OutputImagePointer outputPtr = this->GetOutput();
48 if (!inputPtr || !outputPtr)
54 typename TInputImage::RegionType inputRequestedRegion;
55 inputRequestedRegion = inputPtr->GetRequestedRegion();
58 if (inputRequestedRegion.Crop(inputPtr->GetLargestPossibleRegion()))
60 inputPtr->SetRequestedRegion(inputRequestedRegion);
69 inputPtr->SetRequestedRegion(inputRequestedRegion);
72 itk::InvalidRequestedRegionError e(__FILE__, __LINE__);
73 std::ostringstream msg;
74 msg << this->GetNameOfClass() <<
"::GenerateInputRequestedRegion()";
75 e.SetLocation(msg.str());
76 e.SetDescription(
"Requested region is (at least partially) outside the largest possible region.");
77 e.SetDataObject(inputPtr);
85 template <
class TInputImage,
class TOutputImage,
class TFunction>
89 InputImagePointer inputPtr =
dynamic_cast<const TInputImage*
>(ProcessObjectType::GetInput(0));
94 this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread);
98 itk::ImageRegionIterator<TOutputImage> outputIt(outputPtr, outputRegionForThread);
101 outputIt.GoToBegin();
103 while (!inputIt.IsAtEnd())
105 outputIt.Set(m_Functor(inputIt.Get(), inputIt.GetIndex()));
InputImageType::RegionType InputImageRegionType
InputImageType::ConstPointer InputImagePointer
itk::ImageRegionConstIteratorWithIndex< TInputImage > IteratorType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
OutputImageType::RegionType OutputImageRegionType
UnaryFunctorWithIndexWithOutputSizeImageFilter()
void GenerateInputRequestedRegion(void) override
OutputImageType::Pointer OutputImagePointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.