Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Mon, 2018-06-18, 06:44

All times are UTC + 1 hour

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu, 2004-11-11, 12:14 

Joined: Fri, 2004-10-29, 21:38
Posts: 2217
Location: Oldenburg, Germany
:?: I would like to create and access a DICOMDIR file. What would be the preferred way?

:!: For the creation of a DICOMDIR an easy to use wrapper class has been introduced with DCMTK 3.5.3. The following example from the toolkit's documentation shows how to use the class DicomDirInterface:

DicomDirInterface dicomdir;
OFCondition status = dicomdir.createNewDicomDir();
if (status.good())
  while ( /* there are files */ )
    dicomdir.addDicomFile( /* current filename */ );
  status = dicomdir.writeDicomDir();
  if (status.bad())
    cerr << "Error: cannot write DICOMDIR (" << status.text() << ")" << endl;
} else
  cerr << "Error: cannot create DICOMDIR (" << status.text() << ")" << endl;

A more comprehensive example is provided as part of the command line tool "dcmgpdir".

:!: In order to access particular records of a DICOMDIR one needs to use a different approach:

DICOMDIR files can be read through class DcmDicomDir. This class has a constructor to which the path and filename ("DICOMDIR") can be passed. The individual records are accessed through class DcmDirectoryRecord. These two classes maintain a "logical" view of the DICOMDIR contents, i.e. you can browse through the logical tree structure and don't need to resolve the byte offsets that create the logical linking on top of the physical sequence structure within the DICOMDIR file.

So basically, follow these steps:
  • create an instance of class DcmDicomDir
  • get the root of the DICOMDIR tree using DcmDicomDir::getRootRecord()
  • navigate through the tree using DcmDirectoryRecord::nextSub()
  • the type of each record can be determined using DcmDirectoryRecord::getRecordType()
Since the class DicomDirInterface also relies on these classes and methods you should check its implementation for a working example.

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 1 guest

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