17 #ifndef __itkFFTWRealToComplexConjugateImageFilter_txx
18 #define __itkFFTWRealToComplexConjugateImageFilter_txx
34 template <
typename TPixel,
unsigned int VDimension>
43 if ( !inputPtr || !outputPtr )
53 outputPtr->SetBufferedRegion( outputPtr->GetRequestedRegion() );
54 outputPtr->Allocate();
57 = inputPtr->GetLargestPossibleRegion().GetSize();
59 = outputPtr->GetLargestPossibleRegion().GetSize();
65 unsigned int total_inputSize = 1;
66 unsigned int total_outputSize = 1;
68 for(
unsigned i = 0; i < VDimension; i++)
70 total_inputSize *= inputSize[i];
71 total_outputSize *= outputSize[i];
74 if(this->m_PlanComputed)
78 if(this->m_LastImageSize != total_inputSize)
80 delete [] this->m_InputBuffer;
81 delete [] this->m_OutputBuffer;
82 FFTWProxyType::DestroyPlan(this->m_Plan);
83 this->m_PlanComputed =
false;
86 if(!this->m_PlanComputed)
88 this->m_InputBuffer =
new TPixel[total_inputSize];
89 this->m_OutputBuffer =
90 new typename FFTWProxyType::ComplexType[total_outputSize];
91 this->m_LastImageSize = total_inputSize;
95 this->m_Plan = FFTWProxyType::Plan_dft_r2c_1d(inputSize[0],
101 this->m_Plan = FFTWProxyType::Plan_dft_r2c_2d(inputSize[1],
104 this->m_OutputBuffer,
108 this->m_Plan = FFTWProxyType::Plan_dft_r2c_3d(inputSize[2],
112 this->m_OutputBuffer,
116 int *sizes =
new int[VDimension];
117 for(
unsigned int i = 0; i < VDimension; i++)
119 sizes[(VDimension - 1) - i] = inputSize[i];
122 this->m_Plan = FFTWProxyType::Plan_dft_r2c(VDimension,sizes,
124 this->m_OutputBuffer,
128 this->m_PlanComputed =
true;
130 memcpy(this->m_InputBuffer,
131 inputPtr->GetBufferPointer(),
132 total_inputSize *
sizeof(TPixel));
134 memcpy(outputPtr->GetBufferPointer(),
135 this->m_OutputBuffer,
136 total_outputSize *
sizeof(
typename FFTWProxyType::ComplexType));
139 template <
typename TPixel,
unsigned int VDimension>
149 #endif //_itkFFTWRealToComplexConjugateImageFilter_txx