[Insight-users] FFT in 3D not working?

Luis Ibanez luis.ibanez at kitware.com
Thu Aug 3 12:56:32 EDT 2006


Hi Monica,


The symbol that you actually need is USE_FFTWF or USE_FFTWD.

This is a configuration bug that was fixed recently in CVS.

The first symbol indicates that you will do FFT in "floats"
while the second symbol indicates that you will do FFT in
"doubles".


Please let us know if you encounter any problems,


    Thanks


      Luis



------------------------
mhg at unizar.es wrote:
> Dear Luis,
> 
> I installed fftw and set the flag USE_FFT to on in my current 
> instalation of itk
> library, recompiled and installed. However, when I try to use the class
> "itkFFTWComplexConjugateToRealImageFilter.h" in my own code:
> 
> #include "itkFFTWRealToComplexConjugateImageFilter.h"
> typedef itk::FFTWRealToComplexConjugateImageFilter< float, 3 > 
> FFTFilterType;
> 
> I get the following strange error
> 
> /home/monica/usrsrc/itkSrc/applications/itkLDMM/app/fftDemo.cpp:32: error:
> syntax error before `;' token
> 
> I have been looking into the insight users list and I guess I need to add
> something related to the fftw library into the CMakeLists of my project,
> although I'm not really sure.
> 
> Could you tell me what I am doing wrong?
> 
> Best, Monica.
> 
> Quoting Luis Ibanez <luis.ibanez at kitware.com>:
> 
>>
>> Hi Monica,
>>
>>
>> There was a bug in the netlib function that VnlFFT uses for computing
>> the Fourier Transform. This bug has been fixed very recently.
>> (last week).
>>
>>
>> You may want to checkout the current CVS version of ITK in order to
>> get this bug fix.
>>
>>
>> Note that this bug was for the VnlFFT version.
>> The FFTW version should have worked anyways,
>> did you tried with the FFTW version ?
>>
>>
>>    Please let us know,
>>
>>
>>      Thanks
>>
>>
>>         Luis
>>
>>
>> ---------------------------
>> mhg at unizar.es wrote:
>>
>>> Dear Insight users,
>>>
>>> I am trying to use the class 
>>> itkVnlFFTRealToComplexConjugateImageFilter.h
>>> to get the fft transform of a 3D image. I wrote the code presented avobe
>>> using itk version 2.01 to write the real part of the Fourier transform
>>> of a 3D image. I tested my code with a second order derivative kernel
>>> of 64 x 64 x 64. In the following direction I posted the results:
>>>
>>> http://webmail.unizar.es/DescargarFicheros.php?id0=1157193166.php3NXuyp&idn0=real1.vtk&id1=1157193166.php5tbxOn&idn1=real2.vtk& 
>>> where real1.vtk is the file with the itk computed result and 
>>> real2.vtk is the
>>> file computed with the fft implemented in vtk. Looking at these 
>>> results you can
>>> appreciate that the image computed with the itk code is not correct.
>>>
>>> Maybe there is an error in my code or maybe you already fixed this 
>>> bug in latest
>>> releases of itk. I would appreciate if any of you can tell me what is 
>>> the reason
>>> why my code is not working.
>>>
>>> Best, Monica.
>>>
>>> #include "itkVnlFFTRealToComplexConjugateImageFilter.h"
>>> #include "itkFFTWRealToComplexConjugateImageFilter.h"
>>> #include "itkComplexToRealImageFilter.h"
>>> #include "itkComplexToImaginaryImageFilter.h"
>>>
>>> using namespace std;
>>>
>>> typedef FloatPixelType PixelType;
>>> typedef FloatImageType ImageType;
>>> typedef FloatIteratorType IteratorType;
>>> typedef FloatNeighborhoodIteratorType NeighborhoodIteratorType;
>>> typedef FloatNumericTraits NumericTraits;
>>>
>>> typedef itk::VnlFFTRealToComplexConjugateImageFilter< PixelType, 3 >
>>> FFTFilterType;
>>> typedef FFTFilterType::OutputImageType ComplexImageType;
>>> typedef itk::ComplexToRealImageFilter< ComplexImageType, ImageType >
>>> RealFilterType;
>>> typedef itk::ComplexToImaginaryImageFilter< ComplexImageType, 
>>> ImageType >
>>> ImaginaryFilterType;
>>>
>>> typedef FloatReaderType ReaderType;
>>> typedef FloatWriterType WriterType;
>>>
>>> void usage()
>>> {
>>>  cerr << "Usage: fftDemo [input] [output]" << endl;
>>>  exit(1);
>>> }
>>>
>>> int main( int argc, char **argv )
>>> {
>>>  if( argc < 3 )
>>>    usage();
>>>
>>>  char *input_name = NULL, *output_name = NULL;
>>>  input_name  = argv[1];
>>>  argc--;
>>>  argv++;
>>>  output_name = argv[1];
>>>  argc--;
>>>  argv++;
>>>
>>>  // Reading the images
>>>  ReaderType::Pointer sourceR = ReaderType::New();
>>>  sourceR->SetFileName( input_name );
>>>  sourceR->Update();
>>>
>>>  FFTFilterType::Pointer fft = FFTFilterType::New();
>>>
>>>  fft->SetInput( sourceR->GetOutput() );
>>>  try
>>>  {
>>>    fft->Update();
>>>  }
>>>  catch( itk::ExceptionObject & excp )
>>>  {
>>>    std::cerr << "Error: " << std::endl;
>>>    std::cerr << excp << std::endl;
>>>  }
>>>
>>>  RealFilterType::Pointer realFilter = RealFilterType::New();
>>>  realFilter->SetInput( fft->GetOutput() );
>>>  realFilter->Update();
>>>
>>>  WriterType::Pointer writer = WriterType::New();
>>>  writer->SetFileName( output_name );
>>>  writer->SetInput( realFilter->GetOutput() );
>>>  writer->Update();
>>>
>>>  return 0;
>>> }
>>>
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>
>>
>>
>>
> 
> 
> 
> 
> 




More information about the Insight-users mailing list