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.
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:
- 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.
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
sFile = DIALOG_PICKFILE( $
PATH=FILEPATH('',SUBDIRECTORY=['examples','data']), $
TITLE='Select DICOM Patient File', FILTER='*.dcm')
oImg = OBJ_NEW('IDLffDicomEx', sfile)
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