21 #ifndef otbAngularProjectionBinaryImageFilter_hxx
22 #define otbAngularProjectionBinaryImageFilter_hxx
25 #include <vnl/vnl_math.h>
27 #include "itkImageRegionIterator.h"
28 #include "itkProgressReporter.h"
33 template <
class TInputImage,
class TOutputImage,
class TPrecision>
36 this->SetNumberOfRequiredInputs(2);
39 template <
class TInputImage,
class TOutputImage,
class TPrecision>
45 template <
class TInputImage,
class TOutputImage,
class TPrecision>
51 template <
class TInputImage,
class TOutputImage,
class TPrecision>
54 if (this->GetNumberOfInputs() < 1)
59 return static_cast<const TInputImage*
>(this->itk::ProcessObject::GetInput(0));
62 template <
class TInputImage,
class TOutputImage,
class TPrecision>
65 if (this->GetNumberOfInputs() < 2)
70 return static_cast<const TInputImage*
>(this->itk::ProcessObject::GetInput(1));
73 template <
class TInputImage,
class TOutputImage,
class TPrecision>
77 this->SetNumberOfRequiredOutputs(angle.size());
78 for (
unsigned int i = 0; i < this->GetNumberOfRequiredOutputs(); ++i)
80 this->SetNthOutput(i, OutputImageType::New());
85 template <
class TInputImage,
class TOutputImage,
class TPrecision>
88 Superclass::GenerateOutputInformation();
89 for (
unsigned int i = 0; i < this->GetNumberOfOutputs(); ++i)
91 this->GetOutput(i)->SetRegions(this->GetInput()->GetRequestedRegion());
95 template <
class TInputImage,
class TOutputImage,
class TPrecision>
97 itk::ThreadIdType threadId)
99 itk::ProgressReporter reporter(
this, threadId, outputRegionForThread.GetNumberOfPixels());
102 this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread);
104 itk::ImageRegionConstIterator<InputImageType> iter1(this->GetInput1(), inputRegionForThread);
107 itk::ImageRegionConstIterator<InputImageType> iter2(this->GetInput2(), inputRegionForThread);
110 std::vector<itk::ImageRegionIterator<OutputImageType>> outIter(this->GetNumberOfOutputs());
111 for (
unsigned int i = 0; i < outIter.size(); ++i)
113 outIter[i] = itk::ImageRegionIterator<OutputImageType>(this->GetOutput(i), outputRegionForThread);
114 outIter[i].GoToBegin();
117 while (!iter1.IsAtEnd() && !iter2.IsAtEnd())
119 for (
unsigned int i = 0; i < outIter.size(); ++i)
121 outIter[i].Set(std::cos(m_AngleSet[i]) * iter1.Get() + std::sin(m_AngleSet[i]) * iter2.Get());
128 reporter.CompletedPixel();