>  Docs Center  >  IDL Reference  >  DICOM Toolkit  >  IDLffDicomEx::GetVR



DicomEx and DICOM Network Services require a separate license and installer. Contact your Harris Geospatial Solutions sales representative or technical support for more information.

The IDLffDicomEx::GetVR function method returns the Value Representation (VR) of a DICOM attribute. This method allows you to return the VR of a public attribute. See IDLffDicomEx::GetPrivateVR for information on returning the VR of a private attribute.

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


Result = Obj->[IDLffDicomEx::]GetVR(DicomTag [, SEQID=integer] )

Return Value

Returns a string indicating the Value Representation (VR) of the DICOM attribute specified by the DicomTag argument. See Value Representations for more information on individual value representations.



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.



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:

  • Set to a non-zero value (a sequence identifier) indicating the sequence in which the value is contained. This sequence identifier may have been returned via a previous call to the GetValue method.
  • Set to 0 or do not specify this keyword to indicate the attribute exists at the root level of the DICOM file. This is the default.


The following example returns the VR and value of the Modality attribute (0008,0060) of a selected DICOM file. This example does not make sure the attribute exists before returning it as this is a mandatory tag for valid DICOM files.

PRO read_vr_doc
; Select a DICOM file to examine. 
    PATH=FILEPATH('',SUBDIRECTORY=['examples','data']), $
    TITLE='Select DICOM Patient File', FILTER='*.dcm')
; Open the selected file in read-only mode.
 oImg = OBJ_NEW('IDLffDicomEx', sfile)
; Return information from the Modality attribute.
vValue = oImg->GetValue('0008,0060')
vVR = oImg->GetVR('0008,0060')
PRINT, 'Modality VR = ', vVR, + ' and value is ', vValue

For the mr_brain.dcm file, the output is:

Modality VR = CS and value is MR

Version History



© 2020 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us