Problem with double precision and smartpointer in ITK
The problem I have is that I open an Image from a GUI using Qt (through the class I created ImageFrame, this class has defined the PixelType as follows:
typedef double PixelType;
typedef itk::Image<PixelType,2> ImageType;
and after the extraction of the image, I would lie to make a FFT which input is real data. The error says: it cannot be converted the third parameter of ‘itk::SmartPointer’ to ‘double*’ with and object of the ImageFrame class (which has defined the pixeltype as double).
1>.\prueba_r01.cpp(126) : error C2664: 'fftw_plan_dft_r2c_2d' : no se puede convertir el parámetro 3 de 'itk::SmartPointer' a 'double *'
1> with 1> [ 1> TObjectType=itk::Image 1> ] 1> No hay disponible ningún operador de conversión definido por el usuario que pueda realizar esta conversi开发者_StackOverflow社区ón, o bien no se puede llamar al operador
Now I cannot understand why it cannot calculate the fft if the pixel are in double format. Does anyone can give me an idea of how to fix this problem? Thank you all so much in advance!
To get the pixel data (a double*), you need to use
image->GetBufferPointer();
This will return a double*, that can be passed into FFTW.
This is because image.Pointer()
is a smart pointer object, a wrapper around the read pointer to your data. You must pass image.Pointer().GetPointer()
to fftw.
精彩评论