18 #ifndef __otbForwardFourierMellinTransformImageFilter_txx
19 #define __otbForwardFourierMellinTransformImageFilter_txx
26 template <
class TPixel,
class TInterpol,
unsigned int Dimension>
32 m_OutputSize.Fill(512);
33 m_FFTFilter = FourierImageFilterType::New();
34 m_Interpolator = InterpolatorType::New();
35 m_Transform = LogPolarTransformType::New();
36 m_ResampleFilter = ResampleFilterType::New();
37 m_ResampleFilter->SetInterpolator(m_Interpolator);
38 m_ResampleFilter->SetTransform(m_Transform);
39 m_DefaultPixelValue = 0;
42 template <
class TPixel,
class TInterpol,
unsigned int Dimension>
47 Superclass::GenerateOutputInformation();
58 largestPossibleRegion.SetIndex(index);
59 largestPossibleRegion.SetSize(m_OutputSize);
60 outputPtr->SetLargestPossibleRegion(largestPossibleRegion);
63 template <
class TPixel,
class TInterpol,
unsigned int Dimension>
70 params[0] = 0.5 *
static_cast<double>(this->GetInput()->GetLargestPossibleRegion().GetSize()[0]);
71 params[1] = 0.5 *
static_cast<double>(this->GetInput()->GetLargestPossibleRegion().GetSize()[1]);
72 params[2] = 360. / m_OutputSize[0];
74 vcl_log(vcl_sqrt(vcl_pow(static_cast<double>(this->GetInput()->GetLargestPossibleRegion().GetSize()[0]), 2)
75 + vcl_pow(static_cast<double>(this->GetInput()->GetLargestPossibleRegion().GetSize()[1]),
76 2.)) / 2) / m_OutputSize[1];
77 m_Transform->SetParameters(params);
80 m_ResampleFilter->SetInput(this->GetInput());
81 m_ResampleFilter->SetDefaultPixelValue(m_DefaultPixelValue);
82 m_ResampleFilter->SetSize(m_OutputSize);
83 m_ResampleFilter->Update();
86 m_Iterator =
IteratorType(tempImage, tempImage->GetRequestedRegion());
90 const PixelType minOutputValue = itk::NumericTraits<PixelType>::NonpositiveMin();
91 const PixelType maxOutputValue = itk::NumericTraits<PixelType>::max();
95 for (m_Iterator.GoToBegin(); !m_Iterator.IsAtEnd(); ++m_Iterator)
97 double Rho = m_Iterator.GetIndex()[1] * params[3];
99 double valueTemp =
static_cast<double>(m_Iterator.Get());
100 valueTemp *= vcl_exp(m_Sigma * Rho);
101 valueTemp *= params[3];
104 if (value < minOutputValue)
106 pixval = minOutputValue;
108 else if (value > maxOutputValue)
110 pixval = maxOutputValue;
116 m_Iterator.Set(pixval);
118 m_FFTFilter->SetInput(tempImage);
120 m_FFTFilter->GraftOutput(this->GetOutput());
121 m_FFTFilter->Update();
122 this->GraftOutput(m_FFTFilter->GetOutput());
127 template <
class TPixel,
class TInterpol,
unsigned int Dimension>
132 Superclass::PrintSelf(os, indent);