[Insight-users] [ITK Community] Obtaining Real Result from Inverse Fourier Transform

DVigneault davis.vigneault at gmail.com
Tue Nov 26 09:17:26 EST 2013


Hello all--

I'm still getting the error message "FFTW 3.3.2 or later is required so that
FFTW_WISDOM_ONLY is defined" when trying to compile the
FFTWComplexToComplexImageFilter.  After reading up on linking libraries in
CMake, I've added the following to the bottom of my CMakeLists.txt file:

****

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/Modules/")

find_package (FFTW)
if (FFTWD_FOUND)
  include_directories(${FFTW_LIBDIR})
  target_link_libraries (fftw ${FFTWD_LIB})
  message("FFTWD_FOUND is true!  Libraries linked!")
endif (FFTWD_FOUND)

****

In then copied the FindFFTW.cmake file into the Modules folder, uncommented
"mark_as_advanced(ITK_USE_FFTWD)" and "option(ITK_USE_FFTWD "Use double
precision FFTW if found" ON)", and added a bunch of message() statements to
see what was going on.  It looks to me as though the library is linking
properly, but then I still get the error when I compile.  Here's what I see
in the console when I cmake ../src, and the contents of my FindFFTW.cmake
file (both copied below).  Please let me know if there is any other
information I can provide that would be helpful in debugging this problem,
and thanks in advance for your help!

--Davis



####
#### CONSOLE OUTPUT ON TYPING "cmake ../src"
####

-- The C compiler identification is Clang 4.2.0
-- The CXX compiler identification is Clang 4.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
The header was successfully found.
The FFTW_INCLUDE variable was successfully set.
-- /opt/local
ITK_USE_FFTWD was set.
FFTWD_LIB is True!
We've got threads.
FFTWD_FOUND is true!  Libraries linked!
-- Configuring done
-- Generating done
-- Build files have been written to:
/Users/Davis/Desktop/ITKExamples/00_Pipeline/05_c2c/bin

####
#### End console output
####


####
#### CONTENTS OF 'FindFFTW.cmake' FILE
####

## FFTW can be compiled and subsequently linked against
## various data types.
## There is a single set of include files, and then multiple libraries,
## One for each type.  I.e. libfftw.a-->double, libfftwf.a-->float

## The following logic belongs in the individual package
mark_as_advanced(ITK_USE_FFTWD)
option(ITK_USE_FFTWD "Use double precision FFTW if found" ON)
#mark_as_advanced(ITK_USE_FFTWF)
#option(ITK_USE_FFTWF "Use single precision FFTW if found" ON)

if(ITK_USE_FFTWD OR ITK_USE_FFTWF)

  set(FFTW_INC_SEARCHPATH
    /sw/include
    /usr/include
    /usr/local/include
    /usr/include/fftw
    /usr/local/include/fftw
    
    ## User-supplied
    #/Applications/ITK/build/fftw/include/
    #/Applications/ITK/build/fftwd/src/fftwd/api/
    #/Applications/ITK/build/fftwf/src/fftwf/api/
    #/opt/local/include

  )

  find_path(FFTW_INCLUDE_PATH fftw3.h ${FFTW_INC_SEARCHPATH})

  if(FFTW_INCLUDE_PATH)
    set(FFTW_INCLUDE ${FFTW_INCLUDE_PATH})
    message("The header was successfully found.")
  endif()

  if(FFTW_INCLUDE)
    include_directories( ${FFTW_INCLUDE})
    message("The FFTW_INCLUDE variable was successfully set.")
  endif()

  get_filename_component(FFTW_INSTALL_BASE_PATH ${FFTW_INCLUDE_PATH} PATH)

message(STATUS ${FFTW_INSTALL_BASE_PATH})

  set(FFTW_LIB_SEARCHPATH
    ${FFTW_INSTALL_BASE_PATH}/lib
    /usr/lib/fftw
    /usr/local/lib/fftw
  )

  if(ITK_USE_FFTWD)
    message("ITK_USE_FFTWD was set.")
    mark_as_advanced(FFTWD_LIB)
    find_library(FFTWD_LIB fftw3 ${FFTW_LIB_SEARCHPATH}) #Double Precision
Lib
    find_library(FFTWD_THREADS_LIB fftw3_threads ${FFTW_LIB_SEARCHPATH})
#Double Precision Lib only if compiled with threads support

    if(FFTWD_LIB)
    message("FFTWD_LIB is True!")
      set(FFTWD_FOUND 1)
      get_filename_component(FFTW_LIBDIR ${FFTWD_LIB} PATH)
      if(FFTWD_THREADS_LIB)
        set(FFTWD_LIB ${FFTWD_LIB} ${FFTWD_THREADS_LIB} )
        message("We've got threads.")
      endif()
    endif()
  endif()

  if(ITK_USE_FFTWF)
    message("ITK_USE_FFTWF was set.")
    mark_as_advanced(FFTWF_LIB)
    find_library(FFTWF_LIB fftw3f ${FFTW_LIB_SEARCHPATH}) #Single Precision
Lib
    find_library(FFTWF_THREADS_LIB fftw3f_threads ${FFTW_LIB_SEARCHPATH})
#Single Precision Lib only if compiled with threads support
    message(STATUS ${FFTWF_THREADS_LIB})

    if(FFTWF_LIB)
      message("FFTWF_LIB is True!")
      set(FFTWF_FOUND 1)
      get_filename_component(FFTW_LIBDIR ${FFTWF_LIB} PATH)
      if(FFTWF_THREADS_LIB)
        set(FFTWF_LIB ${FFTWF_LIB} ${FFTWF_THREADS_LIB} )
        message("We've got threads.")
      endif()
    endif()
  endif()

endif()

####
#### End FindFFTW.cmake
####



--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Obtaining-Real-Result-from-Inverse-Fourier-Transform-tp7584430p7584458.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list