21 #ifndef otbAngularProjectionImageFilter_hxx
22 #define otbAngularProjectionImageFilter_hxx
25 #include <vnl/vnl_math.h>
27 #include <itkImageRegionIterator.h>
28 #include <itkProgressAccumulator.h>
33 template <
class TInputImage,
class TOutputImage,
class TAngleArray,
class TPrecision>
37 this->SetNumberOfRequiredOutputs(1);
40 template <
class TInputImage,
class TOutputImage,
class TAngleArray,
class TPrecision>
43 this->itk::ProcessObject::SetNthInput(i,
const_cast<InputImageType*
>(img));
46 template <
class TInputImage,
class TOutputImage,
class TAngleArray,
class TPrecision>
49 if (i >= this->GetNumberOfInputs())
54 return static_cast<const InputImageType*
>(this->itk::ProcessObject::GetInput(i));
57 template <
class TInputImage,
class TOutputImage,
class TAngleArray,
class TPrecision>
59 itk::ThreadIdType threadId)
61 itk::ProgressReporter reporter(
this, threadId, outputRegionForThread.GetNumberOfPixels());
64 this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread);
66 bool iteratorsAtEnd =
false;
68 for (
unsigned int i = 0; i < this->GetNumberOfInputs(); ++i)
73 iteratorsAtEnd =
true;
76 itk::ImageRegionIterator<OutputImageType> outIter(this->GetOutput(), outputRegionForThread);
79 while (!iteratorsAtEnd && !outIter.IsAtEnd())
81 outIter.Set(InternalGenerateData(it));
84 for (
unsigned int i = 0; i < this->GetNumberOfInputs(); ++i)
88 iteratorsAtEnd =
true;
91 reporter.CompletedPixel();
95 template <
class TInputImage,
class TOutputImage,
class TAngleArray,
class TPrecision>
101 if (this->GetNumberOfInputs() == 2)
104 output =
static_cast<PrecisionType>(it[0].Get()) * std::cos(alpha) -
static_cast<PrecisionType>(it[1].Get()) * std::sin(alpha);
106 else if (this->GetNumberOfInputs() == 3)
111 output =
static_cast<PrecisionType>(it[0].Get()) * std::cos(alpha) -
static_cast<PrecisionType>(it[1].Get()) * std::sin(alpha) * std::cos(beta) +
112 static_cast<PrecisionType>(it[2].Get()) * std::sin(alpha) * std::sin(beta);
116 unsigned int i = this->GetNumberOfInputs() - 1;
122 output =
static_cast<PrecisionType>(it[i].Get()) * std::cos(alpha) - output * std::sin(alpha);