DICM_TAG_INFO Function
Retrieves the Digital Imaging and Communications in Medicine (DICOM) tags, which are described in the function's input file, from an image associative array.
Usage
result = DICM_TAG_INFO (filename, image)
Input Parameters
filename — On input, a string containing the name of the file which contains the descriptions for the DICOM tags.
image — An image associative array with valid DICOM tags in image ‘comments’ key.
Returned Value
resultAn associative array containing DICOM tags information.
Discussion
The DICM_TAG_INFO function extracts the tag information from an image associative array that contains a DICOM image. The tag information is returned as an associative array. Table 5-8: Associative Array Keys describes each key of the associative array:
 
Associative Array Keys
Array Key Name
Variable Type
Description
tag
STRING
A 1-dimensional array containing the DICOM tags
description
STRING
A 1-dimensional array containing the DICOM tag descriptions
value
STRING
A 1-dimensional array containing the DICOM tag values
The DICM_TAG_INFO function needs a file containing the tag description as input. This file contains a tag followed by a description for this tag. The tags in this file must be in ascending order. For example:
(0002,0000) Group Length UL 1
(0002,0001) File Meta Information Version OB 1
 
note
The input text file can contain either part or all of the tag descriptions which are from the DICOM image associative array.
Example 1
This example uses IMAGE_READ to read a DICOM image file. Then it extracts the DICOM tags and displays the information of the result variable.
For this example, pvwave_des1.txt contains all tag information.
rw_dir = GETENV('RW_DIR')
dicm_file = rw_dir + '/image-2_0/data/pvwave.dicm' 
dicm_desc_file = rw_dir + '/image-2_0/data/pvwave_des1.txt' 
 
image = IMAGE_READ(dicm_file, File_type='dicm')
tags = DICM_TAG_INFO(dicm_desc_file, image)
INFO, tags, /Full    
 
; PV-WAVE prints the following:
; TAGS            AS. ARR   = Associative Array(3) 
; tag             STRING    = Array(14)          
; description     STRING    = Array(14)          
; value           STRING    = Array(14) 
 
FOR i= 0L,13 DO PRINT, (tags('tag'))(i), '  ',  (tags('value'))(i)
 
; PV-WAVE prints the following:           
; (0008,0016)  1.2.840.10008.5.1.4.1.1.7
; (0008,0018)  1.2.124.113532.1.1.1
; (0008,0064)  WSD
; (0020,000D)  072495.0449
; (0020,000E)  REMSAMPLES1
; (0028,0002)  1
; (0028,0004)  MONOCHROME2
; (0028,0010)  256
; (0028,0011)  256
; (0028,0100)  8    
; (0028,0101)  8
; (0028,0102)  7
; (0028,0103)  0
; (7FE0,0010)  32768 * 2 bytes at offset 339 (0x0153) in pvwave.dicm
;              (has |little endian|str_size_2|implicit_hint|)
Example 2
For this example, pvwave_des2.txt only contains tag information related to image information. The tags in pvwave_des2.txt are:
(0028,0002)   Samples Per Pixel
(0028,0004)   Photometric Interpretation
(0028,0010)   Rows
(0028,0011)   Columns
(0028,0100)   BitsAllocated
(0028,0101)   BitsStored
(0028,0102)   HighBit
(0028,0103)   Pixel Representation
 
rw_dir = GETENV('RW_DIR')
dicm_file = rw_dir + '/image-2_0/data/pvwave.dicm' 
dicm_desc_file = rw_dir + '/image-2_0/data/pvwave_des2.txt' 
 
image = IMAGE_READ(dicm_file, File_type='dicm')
tags = DICM_TAG_INFO(dicm_desc_file, image)
INFO, tags, /Full    
 
; PV-WAVE prints the following:
; TAGS            AS. ARR   = Associative Array(3) 
; tag             STRING    = Array(8)
; description     STRING    = Array(8)
; value           STRING    = Array(8)
 
FOR i=0L,7 DO PRINT, (tags('tag'))(i), '  ',  (tags('value'))(i)
 
; PV-WAVE prints the following:           
; (0028,0002)  1
; (0028,0004)  MONOCHROME2
; (0028,0010)  256
; (0028,0011)  256
; (0028,0100)  8
; (0028,0101)  8
; (0028,0102)  7
; (0028,0103)  0
See Also