DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Mon, 2014-10-20, 05:21

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed, 2006-02-08, 12:15 
Offline
ICSMED DICOM Services
ICSMED DICOM Services

Joined: Fri, 2004-10-29, 21:38
Posts: 2220
Location: Oldenburg, Germany
:?: How do I use the DCMTK 3.5.4 libraries in my own application?

:!: Here's an example for the Windows platform (MSVC):
  1. Create DCMTK project files with CMake (for demonstration purposes switch all external libraries off).
  2. Open the main project file "dcmtk.dsw" or "dcmtk.sln" in Visual Studio.
  3. Select target ALL_BUILD and compile the complete DCMTK.
  4. Select target INSTALL in order to install the DCMTK files to the directory specified using CMake.
  5. Create a new directory "testapp" somewhere on your harddisk with the following files.
Example program "testapp.cxx" from the dcmdata documentation:

Code:
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dctk.h"

int main()
{
  DcmFileFormat fileformat;
  OFCondition status = fileformat.loadFile("test.dcm");
  if (status.good())
  {
    OFString patientsName;
    if (fileformat.getDataset()->findAndGetOFString(DCM_PatientsName, patientsName).good())
    {
      cout << "Patient's Name: " << patientsName << endl;
    } else
      cerr << "Error: cannot access Patient's Name!" << endl;
  } else
    cerr << "Error: cannot read DICOM file (" << status.text() << ")" << endl;
  return 0;
}


Add minimum CMakeLists.txt file for MSVC6 and adjust path to installed DCMTK (if required):

Code:
PROJECT(testapp)

SET(DCMTK_DIR /dicom/dcmtk-3.5.4-win32-i386)

# settings for Microsoft Visual C++ 6
SET(CMAKE_C_FLAGS "/nologo /W3 /GX /Gy /YX")
SET(CMAKE_C_FLAGS_DEBUG "/MTd /Z7 /Od")
SET(CMAKE_C_FLAGS_RELEASE "/MT /O2")
SET(CMAKE_CXX_FLAGS "/nologo /W3 /GX /Gy /YX")
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")

ADD_DEFINITIONS(-D_REENTRANT)

INCLUDE_DIRECTORIES(${DCMTK_DIR}/include)
LINK_DIRECTORIES(${DCMTK_DIR}/lib)

ADD_EXECUTABLE(testapp testapp)
TARGET_LINK_LIBRARIES(testapp netapi32 wsock32 ofstd dcmdata)

Finally, create the project files for the test application using CMake and compile it using MSVC.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group