Additional Topics > Medical Imaging in IDL > IDL DICOM Reference > IDLffDicomEx::GetVR

IDLffDicomEx::GetVR

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.

Note: 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.

Syntax

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.

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:

Example

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.

sFile = DIALOG_PICKFILE( $

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

 

END

For the mr_brain.dcm file, the output is:

Modality VR = CS and value is MR

Version History

6.1

Introduced