[Insight-users] extracting an application
Karthik Krishnan
Karthik.Krishnan at kitware.com
Mon May 22 01:16:56 EDT 2006
Most likely, VTK simply wasn't found. Post the value of VTK_DIR in your
CMakeCache.txt. If there is a NOT_FOUND there, you need to set VTK_DIR
to the VTK binary directory while configuring using CMake. See the
documentation of the FIND_PACKAGE command:
http://cmake.org/HTML/Documentation.html
To be correct, since your project *requires* VTK, you should have
FIND_PACKAGE( VTK REQUIRED )
instead of
FIND_PACKAGE( VTK )
The latter implies that it is optional. (as in InsightApplications,
where only a few apps require VTK). This will ensure that your project
never gets configured if VTK isn't found.
HTH,
karthik
On Sun, 2006-05-21 at 16:18 +0200, Severino Fernandez wrote:
> I am getting just started using ITK (I just used it shortly a couple
> of years ago) and I am having some problems in my first intent to get
> an application with a GUI generated outside the ITK applications
> project.
> I am trying to do all this with Visual C++ 6.0.
> I have installed FLTK and VTK following the instructions.
> I have taken from the applications some directories to try to build
> ImageRegistration2D. I copied also FltkImageViewer and vtk from
> InsightApplications-2.6.0\Auxiliary, and changed their respective
> CMakeLists.txt according to the instructions Luis gave to George on
> december 5th 2003 regarding the compilation of GaussianFilter outside
> InsightApplications.
> Everything seems to work OK with both FltkImageViewer and vtk (at
> least I can compile them using their respective .dsw without errors or
> warnings) but when I try to compile ImageRegistration2D some *.h are
> not located by Visual C++:
>
> C:\INTA\pleyades\InsightToolkit\MisProyectos\vtk
> \itkImageToVTKImageFilter.h(21) : fatal error C1083: Cannot open
> include file: 'vtkImageImport.h': No such file or directory
>
> I have seen that this is a *.h within the generated VTK directory. I
> supposed that the CMakeLists.txt command:
>
> FIND_PACKAGE(VTK)
> IF(VTK_FOUND)
> INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIR})
> ENDIF(VTK_FOUND)
>
> would take care of this, but it seems I am totally wrong. In fact, it
> is the first time I try to understand how CMake works.
>
> I get one more warning from Visual C++:
>
> Build : warning : failed to (or don't know how to) build 'C:\INTA
> \pleyades\InsightToolkit\MisProyectos\ImageRegistration2D\bin\fluid'
>
> but I do not understand at all where it comes from.
>
> I would very much appreciate if somebody can point me to any resources
> I can study in order to understand what happens at all.
>
> I paste here the CMakeLists.txt of ImageRegistration2D I modified. As
> you see, I had to define explicitly the paths of the source and binary
> directories for FltkImageViewer and vtk, but this is because I did not
> know other perhaps more correct and elegant solution.
>
> PROJECT(ImageRegistration2D)
>
> SET (USE_FLTK ON)
> SET (USE_VTK ON)
>
> IF( NOT BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
>
> FIND_PACKAGE(ITK)
> IF(ITK_FOUND)
> INCLUDE(${ITK_USE_FILE})
> ELSE(ITK_FOUND)
> MESSAGE(FATAL_ERROR
> "Cannot build InsightApplications without ITK. Please set
> ITK_DIR.")
> ENDIF(ITK_FOUND)
>
> FIND_PACKAGE(FLTK)
> IF(FLTK_FOUND)
> INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR})
> ENDIF(FLTK_FOUND)
>
> FIND_PACKAGE(VTK)
> IF(VTK_FOUND)
> INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIR})
> ENDIF(VTK_FOUND)
>
> #FIND_PACKAGE(FltkImageViewer)
> #IF(FltkImageViewer_FOUND)
> # MESSAGE("FltkImageViewer_USE_FILE = ${FltkImageViewer_USE_FILE}")
> # INCLUDE(${FltkImageViewer_USE_FILE})
> #ELSE(FltkImageViewer_FOUND)
>
> #INCLUDE($ENV{HOME}/src/InsightApplications-1.4/FindFltkImageViewer.cmake)
> # MESSAGE(FATAL_ERROR "Cannot build ImageRegistration2D without
> FltkImageViewer. Please set FltkImageViewer_DIR.")
> #ENDIF(FltkImageViewer_FOUND)
>
>
> ENDIF( NOT BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
>
> INCLUDE_REGULAR_EXPRESSION(".*")
>
> SET (FltkImageViewer_SOURCE_DIR
> "C:/INTA/pleyades/InsightToolkit/MisProyectos/FltkImageViewer")
> SET (FltkImageViewer_BINARY_DIR
> "C:/INTA/pleyades/InsightToolkit/MisProyectos/FltkImageViewer/bin")
> SET (vtk_SOURCE_DIR
> "C:/INTA/pleyades/InsightToolkit/MisProyectos/vtk")
> SET (vtk_BINARY_DIR
> "C:/INTA/pleyades/InsightToolkit/MisProyectos/vtk/bin")
>
> INCLUDE_DIRECTORIES(
> ${FltkImageViewer_SOURCE_DIR}
> ${FltkImageViewer_BINARY_DIR}
> ${vtk_SOURCE_DIR}
> ${vtk_BINARY_DIR}
> ${ImageRegistration2D_SOURCE_DIR}
> ${ImageRegistration2D_BINARY_DIR}
> )
>
> MESSAGE("el directorio FltkImageViewer es aqui
> ${FltkImageViewer_SOURCE_DIR}")
> MESSAGE("el directorio vtk es aqui ${vtk_SOURCE_DIR}")
> MESSAGE("el directorio ImageRegistration2D es aqui
> ${ImageRegistration2D_SOURCE_DIR}")
>
> MACRO(ADD_GUI_EXECUTABLE name sources)
> ADD_EXECUTABLE(${name} ${sources})
> ENDMACRO(ADD_GUI_EXECUTABLE)
>
> MACRO(ITK_DISABLE_FLTK_GENERATED_WARNINGS files)
> IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.6)
> IF(CMAKE_COMPILER_IS_GNUCXX)
> FOREACH(f ${files})
> STRING(REGEX REPLACE "\\.fl$" ".cxx" SRC "${f}")
> STRING(REGEX REPLACE ".*/([^/]*)$" "\\1" SRC "${SRC}")
> SET_SOURCE_FILES_PROPERTIES(${SRC} PROPERTIES COMPILE_FLAGS
> -w)
> ENDFOREACH(f)
> ENDIF(CMAKE_COMPILER_IS_GNUCXX)
> ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.6)
> ENDMACRO(ITK_DISABLE_FLTK_GENERATED_WARNINGS)
>
>
>
> FLTK_WRAP_UI(ImageRegistration2D ImageRegistrationConsoleGUI.fl)
> ITK_DISABLE_FLTK_GENERATED_WARNINGS(ImageRegistrationConsoleGUI.fl)
>
> SET(ImageRegistration2D_SRCS
> ImageRegistrationConsole.cxx
> ImageRegistrationConsoleBase.cxx
> ImageRegistration2D.cxx
> ${ImageRegistration2D_FLTK_UI_SRCS}
> )
>
> ADD_GUI_EXECUTABLE(ImageRegistration2D "${ImageRegistration2D_SRCS}")
>
> TARGET_LINK_LIBRARIES(ImageRegistration2D ITKFltkImageViewer ITKIO
> ITKNumerics ITKBasicFilters ITKStatistics
> vtkRendering vtkGraphics vtkHybrid
> vtkImaging vtkIO vtkFiltering vtkCommon
> )
>
> Thank you very much in advance for any help or advice.
> Best regards
> Severino Fernandez
> INTA
> Departamento de Teledeteccion
> Ctra. de Ajalvir Km 4
> 28850 Torrejon de Ardoz
> Spain
> email: fdezas at inta.es,severinofer at recol.es
> Tel +34916487800, +34915206362
> _______________________________________________
> 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