Reference Guide > D Routines > DICM_TAGS Function
  

DICM_TAGS Function
Adds, deletes, modifies, or updates the Digital Imaging and Communications in Medicine (DICOM) tags in an image associative array to match the image associative array's keys. Image Associative Array’s Keys describes each key of the image associative array.
Usage
result = DICM_TAGS (image, [tag, value])
Input Parameters
image — An image associative array.
tag — (Optional) A string containing the DICOM tag to add or delete from the image associative array comments key. To add a tag, specify the image, tag, and value parameters. To delete a tag, specify only the tag and image parameters.
value — (Optional) A string containing the value associated with the DICOM tag to add to or modify in the image associative array comments key. The image parameter must be used with the tag parameter.
Returned Value
result — An image associative array containing the updated DICOM tag information in the comments key.
Keywords
None.
Discussion
The DICM_TAGS function is used to add, delete, modify, or update DICOM tag information within an image associative array comments key.
To update the DICOM tag information in the comments key to reflect any changes made to the image associative array, only the image parameter is necessary. Generally, modifying an image associative array height key value would not be reflected in the DICOM tag information within an image associative array comments key until you write the image variable to a file. The DICM_TAGS function preforms an update to the DICOM tag information within an image associative array comments key without needing to write the image variable to a file. Example 1 demonstrates how to update the comments key.
To delete a DICOM tag from the image associative array comments key, specify only the image and tag input parameters. The comments key of the returned image associative array reflects any updated tags minus the deleted tag, sorted in ascending order. Example 4 demonstrates how to delete a DICOM tag.
To add or modify an existing DICOM tag in the image associative array comments key, specify all three input parameters (image, tag, and value). If the DICOM tag exists, this function modifies the tag in the comments key. If the DICOM tag does not exist, the tag and value are added to the comments key of the image associative array and sorted in ascending order. Example 3 demonstrates how to modify an existing tag and example 2 demonstrates how to add a new DICOM tag.
 
note
DICOM tags containing a Value Representation SQ (Sequence of Items) are currently not supported.
Example 1
Using the attributes defined in the image associative array img, create a new image associative array result, and update the comments key within result to match the information in the image associative array.
image_init
a = dist(512)
b = BYTE(a)
img = IMAGE_CREATE(b, File_type='DICM')
FOR i = 0L, 24 DO PRINT, (img('comments'))(i)
 
; Update img('height') and img('width')
FOR i = 0L, 24 DO PRINT, (img('comments'))(i)
img('height') = 1000	
img('width') = 1200
result = DICM_TAGS(img)
FOR i = 0L, 24 DO PRINT, (result('comments'))(i)
Example 2
Add a DICOM tag for Patient Sex to img and overwrite the comments key within img.
img = DICM_TAGS(img, tag ='(0010,0040)', value = 'M')
FOR i = 0L, 25 DO PRINT, (img('comments'))(i)
Example 3
Modify an existing DICOM tag and overwrite the comments key within img.
img = DICM_TAGS(img, tag ='(0010,0040)', value = 'F')
FOR i = 0L, 25 DO PRINT, (img('comments'))(i)
Example 4
Create a new image associative array result, and delete the specified tag from the comments key.
result = DICM_TAGS(img, tag='(0010,0040)')
FOR i = 0L, 24 DO PRINT, (result('comments'))(i)
See Also
IMAGE_CREATE, IMAGE_READ,   IMAGE_WRITE  

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.