Discussion:
Reading DICOMDIR using dcmtk
(too old to reply)
Vijay Subramaniam
2004-10-20 08:19:57 UTC
Permalink
Hi,

Can anyone tell me the easiest way to read the contents of DICOMDIR
using dcmtk. The class DicomDirInterface only talks about creating a
DICOMDIR. Specifically this is what I need to do -
I need to read the patient names and dates of a DICOM DVD
having images, using dcmtk

If anyone can help it would be great.

Thanks.
Vijay
Shabu
2004-10-21 02:01:10 UTC
Permalink
Post by Vijay Subramaniam
Hi,
Can anyone tell me the easiest way to read the contents of DICOMDIR
using dcmtk. The class DicomDirInterface only talks about creating a
DICOMDIR. Specifically this is what I need to do -
I need to read the patient names and dates of a DICOM DVD
having images, using dcmtk
If anyone can help it would be great.
Thanks.
Vijay
Hi Vijay,

Well I am also trying to do the same & as u said the
DicomDirInterface class only talks about creating one... I have
already posted a query about that here, but haven't got a response
that fixed my query...

http://groups.google.com/groups?hl=en&lr=&threadm=78b6f41.0410072356.31521608%40posting.google.com&prev=/groups%3Fgroup%3Dcomp.protocols.dicom%26hl%3Den

I looked up in the code for that class & I can see the functions
createNewDicomDir() & appendToDicomDir() which take a filename as
input & the commnets says that something about "DICOMDIR file" but it
isn't clear if they read in a dicomdir file & create a root-node
structure ( say like in XML DOM structure)

But before that I am still struggling to make a sample app that
uses DCMTK & have posted a query about that too here...

http://groups.google.com/groups?hl=en&lr=&threadm=78b6f41.0410080002.26570ec1%40posting.google.com&prev=/groups%3Fgroup%3Dcomp.protocols.dicom%26hl%3Den

the code sample I am using in my sample project is this...

=== CUT ===

The following example shows how to create a general purpose DICOMDIR
from multiple files:

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;

=== CUT ===

I get linker errors when I try to use DCMTK as specified above &
the errors are in the link... So I made a almost perfect copy of
DCMTK's sample apps in my own MFC project & the same linker erros keep
reoccuring... I think there are some project settings that need to be
tweaked & I have no idea even after reading the INSTALL, README files
of DCMPTK... So after spending a few days trying to mimic the sample
apps that come with DCMTK, I have given up(untill I get some other
clues) & I am now trying to work with the vtkDicomImageReader class
that comes with another toolkit... But that class doesn't do the
network support present in DCMTK... if u don't want network support(
its not a priority for me too) then u could check that out...

Meanwhile if u have managed to use DCMTK in a sample app( is it in
MFC), can u reply in my thread on how u did it, cause whatever I do I
keep getting linker errors...

Cheers,
Michael
Marco Eichelberg
2004-10-21 08:06:22 UTC
Permalink
Post by Vijay Subramaniam
Can anyone tell me the easiest way to read the contents of DICOMDIR
using dcmtk. The class DicomDirInterface only talks about creating a
DICOMDIR. Specifically this is what I need to do -
I need to read the patient names and dates of a DICOM DVD
having images, using dcmtk
class DcmDicomDir is what you are looking for (see
dcmdata/include/dcdicdir.h). This class allows you to read a DICOMDIR
file and to browse through the logical structure (patient - study -
series - instance) of the directory records.

Use DcmDicomDir::getRootRecord() to get access to the root directory
record, then use methods of class DcmDirectoryRecord to walk through
the tree.

DicomDirInterface is, as the documentation suggests, only a helper
class (a wrapper around class DcmDicomDir) that simplifies the task
of creating or extending a DICOMDIR from a number of DICOM files.

Regards,
Marco Eichelberg
OFFIS
Vijay Subramaniam
2004-10-25 08:50:34 UTC
Permalink
Hi Marco,

Thanks for your suggestion on reading the DICOMDIR. While going
through the documentation of dcmtk I couldnt find any useful
documentation on DcmDirectoryRecord (specifically on how to use the
APIs). Please can you point me to the same.

Thanks.
Vijay
Post by Marco Eichelberg
Post by Vijay Subramaniam
Can anyone tell me the easiest way to read the contents of DICOMDIR
using dcmtk. The class DicomDirInterface only talks about creating a
DICOMDIR. Specifically this is what I need to do -
I need to read the patient names and dates of a DICOM DVD
having images, using dcmtk
class DcmDicomDir is what you are looking for (see
dcmdata/include/dcdicdir.h). This class allows you to read a DICOMDIR
file and to browse through the logical structure (patient - study -
series - instance) of the directory records.
Use DcmDicomDir::getRootRecord() to get access to the root directory
record, then use methods of class DcmDirectoryRecord to walk through
the tree.
DicomDirInterface is, as the documentation suggests, only a helper
class (a wrapper around class DcmDicomDir) that simplifies the task
of creating or extending a DICOMDIR from a number of DICOM files.
Regards,
Marco Eichelberg
OFFIS
Marco Eichelberg
2004-10-25 10:07:41 UTC
Permalink
Post by Vijay Subramaniam
Thanks for your suggestion on reading the DICOMDIR. While going
through the documentation of dcmtk I couldnt find any useful
documentation on DcmDirectoryRecord (specifically on how to use the
APIs). Please can you point me to the same.
You are right. Class DcmDirectoryRecord is still invisible in the
doxygen documentation because this is one of the remaining "ancient"
files in the toolkit that have not yet been documented.
(By the way, please note the FAQ entry entitled "where is the rest
of the documentation", which mentions that a significant financial
contribution would certainly accelerate the development of the remaining
documentation :-)

Class DcmDirectoryRecord is derived from DcmItem, so you can treat it
like any other dataset or sequence item. In addition, it offers
the methods

// provide directory record type
virtual E_DirRecType getRecordType();

// number of lower level directory records
virtual unsigned long cardSub();

// access lower level directory record
virtual DcmDirectoryRecord* getSub(const unsigned long num);

There are also a few methods for handling multiple-reference
directory records (MRDR) but these should be rarely needed.

Regards,
Marco Eichelberg
OFFIS
Vijay Subramaniam
2004-10-28 11:03:38 UTC
Permalink
Marco,

Thanks for the info. I ran into one issue. I am trying this program
with a DICOMDIR which has one patient, 1 study and four series each
having a image

This is a snippet of the code

DcmDicomDir* myDir = new DcmDicomDir("/data/dicomdir");
// THis is a valid dicom dir
DcmDirectoryRecord *myDcmDirRec = &(myDir->getRootRecord());
// This returns
// "fffe","e000",na,"Directory Record" root #=0
// "fffe","e00d",na,"ItemDelimitationItem for re-encoding"

myDir->cardSub();
// This returns 0

hence we are not able to do
DcmDirectoryRecord *patRec =
myDcmDirRec->getSub(myDcmDirRec->cardSub());

If you can help us in any way it will be great!!

Thanks
Vijay
Post by Marco Eichelberg
Post by Vijay Subramaniam
Thanks for your suggestion on reading the DICOMDIR. While going
through the documentation of dcmtk I couldnt find any useful
documentation on DcmDirectoryRecord (specifically on how to use the
APIs). Please can you point me to the same.
You are right. Class DcmDirectoryRecord is still invisible in the
doxygen documentation because this is one of the remaining "ancient"
files in the toolkit that have not yet been documented.
(By the way, please note the FAQ entry entitled "where is the rest
of the documentation", which mentions that a significant financial
contribution would certainly accelerate the development of the remaining
documentation :-)
Class DcmDirectoryRecord is derived from DcmItem, so you can treat it
like any other dataset or sequence item. In addition, it offers
the methods
// provide directory record type
virtual E_DirRecType getRecordType();
// number of lower level directory records
virtual unsigned long cardSub();
// access lower level directory record
virtual DcmDirectoryRecord* getSub(const unsigned long num);
There are also a few methods for handling multiple-reference
directory records (MRDR) but these should be rarely needed.
Regards,
Marco Eichelberg
OFFIS
Loading...