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

Gaetan Lehmann gaetan.lehmann at jouy.inra.fr
Tue Aug 29 04:05:27 EDT 2006


Hi Luis,

Last night, I was testing the build of ITK cvs without the #if  
defined(USE_FFTW) blocks in the FFTW classes. Everything is fine, without  
are without using fftw.

What you are proposing would solve my problems with wrapper, but I still  
think that
- it's a quite complex solution for a simple problem
- it will not solve all the problem for the users, for example if they  
don't have built ITK with USE_FFTWF or USE_FFTWD

The USE_FFTW? options are useful only for the ITK tests. I can't see any  
case where there is any benefit to have them for the final user.

The code is ready in my working copy - just let me know what you want to do

Gaetan


On Mon, 28 Aug 2006 23:31:12 +0200, Luis Ibanez <luis.ibanez at kitware.com>  
wrote:

>
> Hi Monica,
>
> Thanks for reporting this.
>
> It seems that the problem is originated from the FindFFTW.cmake
> file in the directory:
>
>
>              Insight/CMake/FindFFTW.cmake
>
>
> This file is used by CMake for finding all the components needed
> by FFTW.
>
> In order to propagate to the rest of code the choices of using FFTWF
> or FFTWD, this file adds the following command line definitions to the
> compiler flags:
>
>                   ADD_DEFINITION( -DUSE_FFTW )
>
> and/or
>
>                   ADD_DEFINITION( -DUSE_FFTW )
>
>
> This definitions become available to the tests and examples
> inside the ITK source tree, but not to external applications.
> Therefore ITK builds fine in the Dashboard, but when external
> applications try to use FFTW functionalities, their #ifdef for
> USE_FFTWF and USEFFTD will fail because the symbols are not
> defined.
>
>
>
> One alternative for fixing these definitions is to have the file
>
>              Insight/itkConfigure.h.in
>
> have extra lines that when processed by CMake will be converted
> into
>
>              #define USE_FFTWF
>
> and/or
>              #define USE_FFTWD
>
> in the itkConfigure.h file.
>
>
> These lines in itkConfigure.h.in should look like:
>
>            #cmakedefine  USE_FFTWF
>            #cmakedefine  USE_FFTWD
>
>
> Please find attached to this email modified versions of
> the FindFFTW.cmake and itkConfigure.h.in files.
>
>
> Could you use these file in replacement of the ones that
> your got from CVS, and give it a try to build your wrapping  ?
>
>
>    Please let us know how it goes.
>
>
>      If it works fine for you, then we will commit these changes
>      into the CVS repository.
>
>
>
>          Thanks
>
>
>
>              Luis
>
>
>
>
> --------------------
> mhg at unizar.es wrote:
>> Dear Luis,
>>
>> I have just installed the current version of the InsightToolkit from
>> your CVS
>> repository (today's date 2006-08-28). My algorithm is working now with  
>> vnl
>> library. However, when I try to use the FFTW wrappers I get a bunch of
>> errors.
>> It seems as the compiler is not able to find these wrappers although it
>> finds
>> the includes.
>>
>> As demo, I adapted the code in itkFFTTest.cxx to work in my external
>> project as
>> attached.
>>
>> The first error given by the compiler is given at line 254:
>>
>> function `int itkFFTWF_FFTTest(int, char**)':
>> /home/monica/.../app/itkFFTTest.cpp:254: error: `
>> FFTWRealToComplexConjugateImageFilter' undeclared in namespace `itk'
>>
>> /home/monica/.../app/itkFFTTest.cpp:254: error: syntax error before `,'
>> token
>>
>> The installation of fftw library was performed using ./configure
>> --enable-float
>> --enable-threads so the fftw libraries can be found under /usr/local
>> folders.
>> The installation of InsightToolkit library was performed enabling the  
>> flag
>> USE_FFTWF to ON and these variables were automatically set to
>>
>> FFTWF_LIB                        /usr/local/lib/libfftw3f.a
>> FFTWF_THREADS_LIB                /usr/local/lib/libfftw3f_threads.a
>> FFTW_INCLUDE_PATH                /usr/local/include
>>
>> Is there any bug in this CVS version of the library?
>> Am I doing something wrong?
>>
>> Thanks in advance.
>>
>> Another minor issue: when I compile my executables I get these  
>> warnings. Is
>> there any problem with that?
>>
>> /usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld:
>> `.gnu.linkonce.t._ZN3itk25SpatialOrientationAdapterILi3EE18ToDirectionCosinesERKNS_18SpatialOrientation31ValidCoordinateOrientationFlagsE'
>>
>> referenced in section `.rodata' of
>> /home/monica/src/lib/InsightToolkit/libITKIO.a(itkNiftiImageIO.o):
>> defined in
>> discarded section
>> `.gnu.linkonce.t._ZN3itk25SpatialOrientationAdapterILi3EE18ToDirectionCosinesERKNS_18SpatialOrientation31ValidCoordinateOrientationFlagsE'
>>
>> of /home/monica/src/lib/InsightToolkit/libITKIO.a(itkNiftiImageIO.o)
>>
>> /usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld:
>> `.gnu.linkonce.t._ZN3itk25SpatialOrientationAdapterILi3EE18ToDirectionCosinesERKNS_18SpatialOrientation31ValidCoordinateOrientationFlagsE'
>>
>> referenced in section `.rodata' of
>> /home/monica/src/lib/InsightToolkit/libITKIO.a(itkAnalyzeImageIO.o):
>> defined in
>> discarded section
>> `.gnu.linkonce.t._ZN3itk25SpatialOrientationAdapterILi3EE18ToDirectionCosinesERKNS_18SpatialOrientation31ValidCoordinateOrientationFlagsE'
>>
>> of /home/monica/src/lib/InsightToolkit/libITKIO.a(itkAnalyzeImageIO.o)
>>
>> Thanks again!!
>>
>> 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.
>>>>
>>>>
> ===============================================================
>
>
>



-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr


More information about the Insight-developers mailing list