Re: Reading Dicom Header [message #35940] |
Mon, 28 July 2003 13:22 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
New2IDL writes:
> I am not sure how we can read the dicom headers from an image file.
> When i use some DICOM readers, i can see the info's. I want to read
> them in IDL. Can anybody help me please...
You will have to open the DICOM file something like this:
IDL> filename = 'mydicomimage.dcm'
IDL> thisObject = Obj_New('IDLffDicom', filename)
To see all of the header information, do this:
IDL> thisObject -> DumpElements
In the list that is printed out you will see a column of
numbers in parentheses. These are the Group and Element
numbers (in hexadecimal values). If you wish to obtain
one of the data elements, you have to use the Group and
Element numbers to do so.
For example, the Modality data element has a group number
of 0008 and an element number of 0060. If you wanted to
print the modality of this file, you would do something
like this:
IDL> modality = thisObject -> GetValue('0008'xL, '0060'xL)
IDL> Print, "Modality: ", *modality
Notice that the data element comes back in the form of a pointer.
To clean up, you would do this:
IDL> Ptr_Free, modality
IDL> Obj_Destroy, thisObject
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|