DICOMDIR interface

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
bjornw
Posts: 1
Joined: Wed, 2004-11-10, 20:19

DICOMDIR interface

#1 Post by bjornw » Wed, 2004-11-10, 20:29

Hi there!

I have some questions regarding the interface for creating and accessing a DICOMDIR.

I have just created a DICOMDIR using the DicomDirInterface class (imported some studies from files), and now I want to perform queries on the same DICOMDIR.

I would really want to have some function that searches for and returns only the patients (the complete DcmItem object, and not just the DcmElement) so that I later can perform substring matching for narrowing a search. Is this possible? I've scanned through the code and I don't immidiately see any function which does exactly this.

Or, put in other words, I would like to list out all patients, and for each patient, lets say print patient name, id, gender and so forth (only way I can see this done right now is to perform a complete new search for every tag....)

Hopefully I'm missing something essential here :-)

dcmtk-noob

bjornw>
Bjørn Wennberg | bjornw@hue.no

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

Re: DICOMDIR interface

#2 Post by Jörg Riesmeier » Thu, 2004-11-11, 12:17

Since this is a frequently asked question I've created a new entry: FAQ #30

chinson
Posts: 3
Joined: Thu, 2004-12-23, 11:14

#3 Post by chinson » Sun, 2005-01-02, 15:06

Code: Select all

      DcmDicomDir            dicomdir(DICOMDIR_FILENAME);
      DcmDirectoryRecord *   root = &(dicomdir.getRootRecord());
      DcmDirectoryRecord *   PatientRecord = NULL;
      DcmDirectoryRecord *   StudyRecord = NULL;
      DcmDirectoryRecord *   SeriesRecord = NULL;
      DcmDirectoryRecord *   FileRecord = NULL;
      OFString            tmpString;

      if(root != NULL)
      {
         while (((PatientRecord = root->nextSub(PatientRecord)) != NULL))
         {
            if (PatientRecord->findAndGetOFString(DCM_PatientsName, tmpString).good())
            {
               cout << "Patient Name : " << tmpString << "\n";
            }
            else
            {
               cerr << "Can't retrieve patient name from DICOMDIR file!\n";
            }

            while (((StudyRecord = PatientRecord->nextSub(StudyRecord)) != NULL))
            {
               if (StudyRecord->findAndGetOFString(DCM_StudyDescription, tmpString).good())
               {
                  cout << "Study Description : " << tmpString << "\n";
               }
               else
               {
                  cerr << "Can't retrieve study description from DICOMDIR file!\n";
               }

               while (((SeriesRecord = StudyRecord->nextSub(SeriesRecord)) != NULL))
               {
                  if (SeriesRecord->findAndGetOFString(DCM_SeriesDescription, tmpString).good())
                  {
                     cout << "Series Description : " << tmpString << "\n";
                  }
                  else
                  {
                     cerr << "Can't retrieve series description from DICOMDIR file!\n";
                  }
               }
            }
         }
      } 
These are my codes to perform DICOMDIR searching.
It is work.
However there is a little problem, it is quitely slow when loading DICOMDIR file.

Code: Select all

DcmDicomDir dicomdir(DICOMDIR_FILENAME);
Can it be faster?

My platform is Windows/MSVC 6.0-SP5.
Last edited by chinson on Tue, 2005-03-08, 09:28, edited 1 time in total.
Easy Life
[img]http://www.nhacks.com/email/email/Y2hpbnNvbnllaA%3D%3D/R01haWw%3D/0/image.png[/img]
[url=http://www.nhacks.com/email/]Get Your Gmail Logo Here[/url]

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#4 Post by Jörg Riesmeier » Mon, 2005-01-03, 11:01

Depending on the complexity/size of the DICOMDIR the reading process might take some time. This is because the internal tree structures needs to be reconstructed in memory when reading the DICOMDIR from file. Nevertheless, it should be possible to speed up the corresponding routines.

Maybe you could provide more details on your observation that the reading processing is "quite slow". How long does it take to read a particular DICOMDIR file with a certain number of patients, studies, series and instances?

chinson
Posts: 3
Joined: Thu, 2004-12-23, 11:14

#5 Post by chinson » Mon, 2005-01-03, 13:47

Hi,

I use DcmDicomDir to read a DICOMDIR file with 21,158 KB.
It contain 5 patients and every patient has only one study, one series and about 200~400 instances.
The initiallization of DcmDicomDir consumes 4 secs and I wish it can be shortened to less than 2 secs if it is possible.

Chinson
Easy Life
[img]http://www.nhacks.com/email/email/Y2hpbnNvbnllaA%3D%3D/R01haWw%3D/0/image.png[/img]
[url=http://www.nhacks.com/email/]Get Your Gmail Logo Here[/url]

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#6 Post by Jörg Riesmeier » Mon, 2005-01-03, 14:30

I used an 8.3 MByte DICOMDIR file and without creating a backup (dcmgpdir -nb) it took about 1.5 seconds! Machine is PIV 2.4 GHz, 512 MB RAM with Linux OS. My Windows machine (PII 350) is much slower (~ 9 seconds).

Did you already use a profiler or something like that to identify the "evildoer"?

chinson
Posts: 3
Joined: Thu, 2004-12-23, 11:14

#7 Post by chinson » Mon, 2005-01-03, 16:47

Hi Jörg,
Jörg Riesmeier wrote:I used an 8.3 MByte DICOMDIR file and without creating a backup (dcmgpdir -nb) it took about 1.5 seconds! Machine is PIV 2.4 GHz, 512 MB RAM with Linux OS. My Windows machine (PII 350) is much slower (~ 9 seconds).
My DICOMDIR file is 21.x MBytes. So, it seems reasonable to take about 4 seconds in reading the file. (Machine is XP 1.25GHz, 1GB RAM with Windows XP OS.)
Jörg Riesmeier wrote: Did you already use a profiler or something like that to identify the "evildoer"?
I am not sure what "profiler" is. All I did was track the step and found that the most time consuming step is

Code: Select all

DICOMDIR dicomdir(DICOMDIR_FILE_NAME)
.

Thank you for your response.

Chinson
Easy Life
[img]http://www.nhacks.com/email/email/Y2hpbnNvbnllaA%3D%3D/R01haWw%3D/0/image.png[/img]
[url=http://www.nhacks.com/email/]Get Your Gmail Logo Here[/url]

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#8 Post by Jörg Riesmeier » Mon, 2005-01-03, 16:53

I am not sure what "profiler" is.
See here.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest