MedicalVisualization

Qt with DCMTK

Qt with CMake | | VIS Framework

To link with DCMTK we need to install the library:

In the DCMTK directory type:

sudo make install-lib

We may also have to install the libz library as dependency of DCMTK:

sudo apt-get install libz-dev

Then we can locate the DCMTK library and associated headers with CMake in the CMakeLists.txt definition file of our qt framework. We follow the following steps:

We try to find DCMTK:

FIND_PATH(DCMTK_DIR include/dcmtk/config/osconfig.h PATHS /usr/local)
FIND_PACKAGE(DCMTK)

Determine DCMTK status and locate additional dependencies:

IF (DCMTK_FOUND)
   INCLUDE_DIRECTORIES(${DCMTK_INCLUDE_DIR})
   IF (NOT WIN32)
      ADD_DEFINITIONS(-DHAVE_CONFIG_H)
   ENDIF (NOT WIN32)

   # find threads library
   FIND_PACKAGE(Threads)

   # find ZLIB dependency
   FIND_PACKAGE(ZLIB)
   INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})

   ADD_DEFINITIONS(-DHAVE_DCMTK)
ENDIF (DCMTK_FOUND)

Finally link application target as defined by variable APPNAME with all dependencies:

IF (DCMTK_FOUND)
   TARGET_LINK_LIBRARIES(${APPNAME}
      ${DCMTK_LIBRARIES}
      ${ZLIB_LIBRARY}
      ${CMAKE_THREAD_LIBS_INIT}
      )
ENDIF (DCMTK_FOUND)


Qt with CMake | | VIS Framework

Options: