Best way to read dicom file

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Geof
Posts: 8
Joined: Tue, 2007-03-06, 17:13

Best way to read dicom file

#1 Post by Geof » Mon, 2007-04-30, 23:16

Hi

I would like to know what is the best way to read all the tag of a dicom file. O would like to read the tag and display the value in a visual interface. Is it possible to read at the same time Tag containning string, unsigned number, date float number etc

Thank you

Michael Onken
DCMTK Developer
Posts: 1755
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#2 Post by Michael Onken » Wed, 2007-05-02, 10:25

Hi,

you should use the API of DcmItem (accessible here), especially the findAndGetOFStringArray() which works for most DICOM data types (value representations): AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, OB, OF, OW, PN, SH, SL, SS, ST, TM, UI, UL, US, UT.

A list of all value representations (VRs) can be found in the DICOM standard, part 5. Especially for some numeric VRs you will have to use other member functions of DcmItem, e. g. findAndGetSint32() to get a numeric representation of the element value and to do the string conversion yourself.

Regards,
Michael

Geof
Posts: 8
Joined: Tue, 2007-03-06, 17:13

#3 Post by Geof » Fri, 2007-05-04, 13:59

Ok I understand that but I have difficulty to understand how I can retrived contour data. I'm able to output the contour data to a DcmElement with the function print ( MyElement.Print ( stream, 1 ) ) but how I can directly acces the contour data?

Michael Onken
DCMTK Developer
Posts: 1755
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#4 Post by Michael Onken » Fri, 2007-05-04, 14:44

Hi Geof,

I am sorry, I do not understand the question...
Contour data is saved in DICOM attributes (tags), too. So you can access them like other data with the API functions mentioned above. For most data types (and so for most tags) you can use the findAndGetOFSTringArray method, for some numeric data types you have to choose an appropriate one. So you always have to look at the elements VR first, before accessing its value.

If you want to iterate over all elements of a dataset (in cases you don't know, what will be the next tag you want to look at), you can use DcmItem's nextObject() method or (not that good) getElement().

Regards,
Michael

Post Reply

Who is online

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