Previous Medical Imaging in IDL: IDL DICOM Reference Next

IDLffDicomEx::GetValue

Syntax | Return Value | Arguments | Keywords | Example | Version History

The IDLffDicomEx::GetValue function method returns the value of a DICOM attribute specified by a standard DICOM attribute tag. This method allows you to return values of public attributes. See IDLffDicomEx::GetPrivateValue for information on returning the values of private attributes.


Note
GetValue will fail if you attempt to return a value for an attribute that does not exist, an attribute that does not have a value, or an attribute that has been removed. If you are not sure if an attribute exists or has a value use IDLffDicomEx::QueryValue before calling GetValue.

Syntax

Result = Obj->[IDLffDicomEx::]GetValue(DicomTag [, SEQID=integer] [, COUNT=variable] )

Return Value

Returns one of the following:

Arguments

DicomTag

A string that identifies the group and element of a DICOM attribute in the form 'XXXX,XXXX'. The DicomTag argument must reference a public tag. See DICOM Attributes for a list of tags.

Keywords

SEQID

Set this keyword only if retrieving the value of an attribute that exists within a sequence. Use this keyword to specify sequence identifier as follows:

COUNT

Set this keyword equal to a named variable that will contain an unsigned long value indicating the number of elements in this method's return value. Possible values are:

Example

The following example reads the multi-valued Image Type attribute from a DICOM file in the examples\data directory. See IMAGE_TYPE for more information on this attribute.

PRO read_imagetypeattr_doc  
  
; Select a DICOM file to examine.  
sFile = DIALOG_PICKFILE( $  
    PATH=FILEPATH('',SUBDIRECTORY=['examples','data']), $  
    TITLE='Select DICOM Patient File', FILTER='*.dcm', $  
    GET_PATH=path)  
  
; Open the selected file in read-only mode.  
 oImg = OBJ_NEW('IDLffDicomEx', sfile)  
      
; Return the Image Type attribute that can have 2 to n values.   
result = oImg->GetValue('0008,0008', COUNT=vCount)  
  
FOR i = 1, vCount DO BEGIN  
   Print, 'Result number', i, + ' is ', result[i-1]  
ENDFOR  
  
END  

For the mr_knee.dcm file, the following appears in the Output Log window:

Result number       1 is ORIGINAL  
Result number       2 is PRIMARY  

Version History

6.1
Introduced

  IDL Online Help (March 06, 2007)