DICOMDIR interface
Moderator: Moderator Team
DICOMDIR interface
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>
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
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
Re: DICOMDIR interface
Since this is a frequently asked question I've created a new entry: FAQ #30
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";
}
}
}
}
}
It is work.
However there is a little problem, it is quitely slow when loading DICOMDIR file.
Code: Select all
DcmDicomDir dicomdir(DICOMDIR_FILENAME);
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]
[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]
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
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?
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?
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
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]
[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]
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
Hi Jörg,
.
Thank you for your response.
Chinson
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: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).
I am not sure what "profiler" is. All I did was track the step and found that the most time consuming step isJörg Riesmeier wrote: Did you already use a profiler or something like that to identify the "evildoer"?
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]
[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]
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
See here.I am not sure what "profiler" is.
Who is online
Users browsing this forum: Google [Bot], Semrush [Bot] and 1 guest