[Insight-users] Compiling DicomImageViewer outside InsightApplications
Luis Ibanez
luis.ibanez at kitware.com
Fri Mar 28 10:40:33 EDT 2008
Hi Vries,
The DicomImageViewer, as well as many other applications in
InsightApplications, use the FLTK for its GUI. They also share
a basic set of classes for image viewing, that are located
in the directory:
InsightApplications/Auxiliary/FltkImageViewer
You will have to add this directory / library to your project
in order to be able to build the DicomImageViewer.
You could do so, by copying this directory under the one
of your application, and then including a command:
ADD_DIRECTORIES(FltkImageViewer)
to your CMakeLists.txt file.
Regards,
Luis
-----------------
Vries, J de wrote:
> Dear ITK users,
>
> With succes i could build ITK + ITK Applications, VTK, FLTK. But then i
> wanted to try and build examples outside the ITK applications directory.
> I want to do that in order to get a better understanding of how to
> create Cmakelist.txt files for futher projects. As an example i used
> DicomImageViewer from ITK Applications (this example in particular
> because i would like to use it in a futher project). But i ran into
> trouble when i wanted to compile DicomImageViewer outside the ITK
> Applications.
>
> It gave me the following linker error:
>
> Compiling...
> DicomImageViewerPam.cpp
> Compiling manifest to resources...
> Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
> Copyright (C) Microsoft Corporation. All rights reserved.
> Linking...
> LINK : fatal error LNK1104: cannot open file 'ITKFltkImageViewer.lib'
>
> I searched the ITK mailing list for answers but all the answers didn't
> work in my case: i keep getting the same linker error.
>
> Can anyone help me with this problem? Any help will be highly appreciated.
>
> Regards,
> Jurgen
>
> <<CMakeLists.txt>>
>
> ------------------------------------------------------------------------
> De inhoud van dit bericht is vertrouwelijk en alleen bestemd voor de
> geadresseerde(n). Anderen dan de geadresseerde mogen geen gebruik maken
> van dit bericht, het openbaar maken of op enige wijze verspreiden of
> vermenigvuldigen. Het UMCG kan niet aansprakelijk gesteld worden voor
> een incomplete aankomst of vertraging van dit verzonden bericht.
>
> The contents of this message are confidential and only intended for the
> eyes of the addressee(s). Others than the addressee(s) are not allowed
> to use this message, to make it public or to distribute or multiply this
> message in any way. The UMCG cannot be held responsible for incomplete
> reception or delay of this transferred message.
>
>
> ------------------------------------------------------------------------
>
> PROJECT(DicomImageViewerPam)
>
> INCLUDE_REGULAR_EXPRESSION("^.*$")
>
> SET(InsightApplications_SOURCE_DIR "D:/ITK/InsightApplications-3.4.0")
> SET(InsightApplications_BINARY_DIR "D:/ITK/BIN APPLICATIONS")
>
> # Tell CMake's FIND_PACKAGE command where to look for our Find<pkg>
> # modules.
>
> SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${InsightApplications_SOURCE_DIR})
>
> IF(NOT WIN32)
> OPTION(BUILD_SHARED_LIBS "Build Insight-Applications with shared libraries." OFF)
> ENDIF(NOT WIN32)
>
> #IF( 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 (${VTK_USE_FILE})
> ENDIF (VTK_FOUND)
>
>
> #ENDIF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
>
> FIND_LIBRARY(FltkImageViewer_LIBRARY NAMES ITKFltkImageViewer )
>
> # Macro for adding resources to GUI application on the Mac
> #
> IF(APPLE AND NOT FLTK_USE_X)
> FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools)
> FIND_FILE(ITK_FLTK_RESOURCE mac.r
> /usr/local/include/FL
> ${FLTK_DIR}/FL)
> IF(NOT ITK_FLTK_RESOURCE)
> MESSAGE("Fltk resources not found, GUI application will not respond to mouse events")
> ENDIF(NOT ITK_FLTK_RESOURCE)
>
> MACRO(ADD_GUI_EXECUTABLE name sources)
> ADD_EXECUTABLE(${name} ${sources})
> INSTALL_TARGETS(/bin ${name})
> SET(EXEC_PATH ${EXECUTABLE_OUTPUT_PATH})
> IF(NOT EXEC_PATH)
> SET(EXEC_PATH ${CMAKE_CURRENT_BINARY_DIR})
> ENDIF(NOT EXEC_PATH)
> IF(ITK_APPLE_RESOURCE)
> ADD_CUSTOM_COMMAND(SOURCE ${name}
> COMMAND ${ITK_APPLE_RESOURCE}
> ARGS -t APPL ${ITK_FLTK_RESOURCE} -o
> ${EXEC_PATH}/${name}
> TARGET ${name})
> ENDIF(ITK_APPLE_RESOURCE)
> ENDMACRO(ADD_GUI_EXECUTABLE)
> ELSE(APPLE AND NOT FLTK_USE_X)
> MACRO(ADD_GUI_EXECUTABLE name sources)
> ADD_EXECUTABLE(${name} ${sources})
> INSTALL_TARGETS(/bin ${name})
> ENDMACRO(ADD_GUI_EXECUTABLE)
> ENDIF(APPLE AND NOT FLTK_USE_X)
>
>
> INCLUDE_DIRECTORIES (
> ${InsightApplications_SOURCE_DIR}/Auxiliary/FltkImageViewer
> ${InsightApplications_SOURCE_DIR}/Auxiliary/VtkFltk
> ${InsightApplications_SOURCE_DIR}/Auxiliary/vtk
> ${InsightApplications_BINARY_DIR}/Auxiliary/FltkImageViewer
> ${InsightApplications_BINARY_DIR}/Auxiliary/VtkFltk
> ${DicomImageViewerPam_SOURCE_DIR}
>
> )
>
> LINK_LIBRARIES (
> ITKBasicFilters
> ITKIO
> ITKFltkImageViewer
> ITKCommon
> )
>
>
> ADD_GUI_EXECUTABLE( DicomImageViewerPam DicomImageViewerPam.cpp)
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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