Problems with loading the meta-header

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
braggpeaks
Posts: 15
Joined: Tue, 2012-04-17, 08:02

Problems with loading the meta-header

#1 Post by braggpeaks »

Hey,

well, i am trying, regarding the well documented feature described in http://support.dcmtk.org/wiki/dcmtk/how ... metaheader to only load the meta-header (mainly for performance issues), but I always get a bad()-state:

Approach 2:

Code: Select all

status = fileFormat->loadFile(dicomFileNames.at(idx).c_str());
status = fileFormat->getDataset()->findAndGetOFString(DCM_SOPClassUID, result); // good()

status = fileFormat->loadFile(dicomFileNames.at(idx).c_str(),
                                  EXS_Unknown,
                                  EGL_noChange,
                                  DCM_MaxReadLength,
                                  ERM_metaOnly);
status = fileFormat->getDataset()->findAndGetOFString(DCM_SOPClassUID, result); // bad()
status = fileFormat->getMetaInfo()->findAndGetOFString(DCM_SOPClassUID, result); // bad()

Approach 1:

Code: Select all

status = metaInfo->loadFile(dicomFileNames.at(idx).c_str());
status = metaInfo->findAndGetOFString(DCM_SOPClassUID, result); // bad()
Since I don't think that this is a bug, could you please help me out finding the (simple) cause?

Thanks for your advice,
Daniel

Uli Schlachter
DCMTK Developer
Posts: 120
Joined: Thu, 2009-11-26, 08:15

#2 Post by Uli Schlachter »

The problem is DCM_SOPClassUID. This element is part of the dataset and not the metaheader. What you are looking for is DCM_MediaStorageSOPClassUID which should give you the same value as DCM_SOPClassUID.

braggpeaks
Posts: 15
Joined: Tue, 2012-04-17, 08:02

#3 Post by braggpeaks »

Thanks for your fast response.

That was indeed the cause, got it now for SOPClassUID and SOPInstanceUID. But: I got some several tags that I further need (e.g. StudyInstanceUID).

1) where can I see, which tags are part of the dataset and
2) if StudyInstanceUID is part of the dataset, how can I quickly load them, without loading the complete dataset (background: there are also RTDOSE files with ~200 MB filesize, where I do only need the meta-header).

Thanks,
Daniel

Uli Schlachter
DCMTK Developer
Posts: 120
Joined: Thu, 2009-11-26, 08:15

#4 Post by Uli Schlachter »

In DICOM files, elements are sorted by group and tag number. The group number also decides which tags are put into the meta header and which aren't. E.g. MediaStorageSOPClassUID has tag (0002,0002) while SOPClassUID is (0008, 0016).

I'm not sure up until which group number elements go into the meta header. A quick look at some sample data showed that the meta header only contained elements of group 2 and that the dataset started with group 8 (as the two sample tags above show).

Since the above turned into a DICOM question and not a DCMTK question, you can look into the DICOM standard for more info. The standard surely knows which exact groups belong into the meta header. :-)

For your second question:
There is a hack implemented via the dcmStopParsingAfterElement OFGlobal. This is used for dcmdump's --stop-after-elem. You could e.g. do dcmStopParsingAfterElement.set(DCM_StudyInstanceUID) and later tags will not be read.
However, please note that if the specified tag is not present, the whole file will still be read.
See the API docs for more details.

Uli

braggpeaks
Posts: 15
Joined: Tue, 2012-04-17, 08:02

#5 Post by braggpeaks »

Thank you, Uli!

I made some benchmarks using dcmStopParsingAfterElement, but it is not significantly faster. Anyway, all my questions are now answered.

Daniel

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

#6 Post by J. Riesmeier »

Regarding the file meta information header, I would recommend to read the relevant sections of part 10 of the DICOM standard!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest