[Insight-users] How to use ITK+VTK+QT in an application

Luis Ibanez luis.ibanez at kitware.com
Sat Mar 27 14:23:10 EDT 2010


Hi Sutirsno,

Here is what you need in your CMakeLists.txt file
in order to use ITK+VTK+Qt:


FIND_PACKAGE(ITK  REQUIRED)
INCLUDE(${ITK_USE_FILE})

FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})

FIND_PACKAGE( Qt4   REQUIRED )


INCLUDE_DIRECTORIES(
  ${QT_INCLUDES}
  ${VTK_INCLUDE_DIR}
  ${QT_INCLUDE_DIR}
  ${QT_QTGUI_INCLUDE_DIR}
  ${QT_QTCORE_INCLUDE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
  )

LINK_LIBRARIES (
  ITKIO ITKStatistics ITKNumerics
  ${QT_QTCORE_LIBRARY}
  ${QT_QTGUI_LIBRARY}
  vtkCommon
  vtkRendering
  vtkIO
  vtkFiltering
  vtkGraphics
  vtkWidgets
  vtkImaging
  )



Regards,


      Luis




---------------------------------------------------------------------
On Thu, Mar 25, 2010 at 9:35 PM, SUTRISNO SUTRISNO
<sutrisno_link at yahoo.com> wrote:
> Hi Luis,
>
> I've studied hard to configure my project with cmake
> but I am still confused in writing CMakelists.txt
>  Can you help me how to write CMakeList.txt?
>
> I tried it in stages
> 1. Just qt
> 2. qt + vtk
> 3. vtk and qt + ITK
>
> I failed for the first step (qt only). I made a simple program and I tried
> configured with cmake
> my project directory:
>  qtcmake /
>                   - project.pro
>                   - main.cpp
>                   - form1.ui
>                   - form1.ui.h
>
> my CMakeLists.txt :
>
>     cmake_minimum_required(VERSION 2.6)
>     PROJECT(QtCmake)
>     INCLUDE (${CMAKE_ROOT}/Modules/FindQt.cmake)
>     FIND_PACKAGE(Qt3 REQUIRED)
>     INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR})
>     LINK_LIBRARIES( ${QT_QT_LIBRARY})
>     ADD_EXECUTABLE(QtCmake form1.ui.h form1.ui main.cpp  )
>
> But there were error :
>
> root at sutrisno-pc:~/project-sut/qtcmake# cmake .
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/sutrisno/project-sut/qtcmake
> root at sutrisno-pc:~/project-sut/qtcmake# make
> Scanning dependencies of target QtCmake
> [100%] Building CXX object CMakeFiles/QtCmake.dir/main.cpp.o
> /home/sutrisno/project-sut/qtcmake/main.cpp:2:19: error: form1.h: No such
> file or directory
> /home/sutrisno/project-sut/qtcmake/main.cpp: In function ‘int main(int,
> char**)’:
> /home/sutrisno/project-sut/qtcmake/main.cpp:7: error: ‘Form1’ was not
> declared in this scope
> /home/sutrisno/project-sut/qtcmake/main.cpp:7: error: expected `;' before
> ‘w’
> /home/sutrisno/project-sut/qtcmake/main.cpp:8: error: ‘w’ was not declared
> in this scope
> make[2]: *** [CMakeFiles/QtCmake.dir/main.cpp.o] Error 1
> make[1]: *** [CMakeFiles/QtCmake.dir/all] Error 2
> make: *** [all] Error 2
> root at sutrisno-pc:~/project-sut/qtcmake#
>
>
> Regards,
>
>       Sutrisno
> ________________________________


More information about the Insight-users mailing list