Visual Basic |
---|
Public Property Value As Variant |
The type of variant returned depends on the value representation of the data element, and may be a string, date (for time, date or date-time), or a numeric type, including floating point values where appropriate. Where not known in advance, the Vartype function may be of use.
Data elements of types not known to the program, whether private elements, or attributes recently defined by DICOM return the string " Unknown Data Type".
The pixel data attribute(7FE0,0010) is handled slightly differently, and returns a three dimensional array. See the Pixels attribute for further details.
If the data dictionary lists the element as having the possibility of a value multiplicity of >1, then an single dimensional array of the appropriate type is returned, the size of the array reflecting the actual number of elements present (which may be just one).
If the element is a sequence then an Object of type DicomDataSets is returned. As this is the only possible result of type Object, it can easily be identified using Visual Basic’s “Vartype” function or equivalent.
Non-existent Elements have a value of Null
As would be expected, this is the default property, so
attributes.Item(x, y).value
may be shorted to simply
attributes(x, y)
For details of the meanings of DICOM attributes, see DICOM standard Part 6.
Dates are returned as variant dates, and conversion to other formats (notably strings) is the responsibility of client programs and/or Windows. If you are unhappy with the format returned (e.g. 2 digit years), then changing the “Short Date” format in the control panel regional settings may cure the problem. Alternatively, your development environment may provide a means to specify explicit variant to date conversion formats.
For some applications which can only handle variants (VBScript, MatLab etc.) VariantValue may be more appropriate.