Value Representation

DICOM header fields contain, in the great majority of cases, Value Representation (VR) codes that provide information about the type of the data that is stored or its expected format.

The following table provides an overview of the expected return types by VR:

VR

Name

pydicom

dicom_parser

Comments

AE

Application Entity

str

str

AS

Age String

str

float

Age in years.

AT

Attribute Tag

BaseTag

BaseTag

CS

Code String

str

str

Values will, by default, be converted to verbose values (if available).

DA

Date

str or DA

datetime.date

DS

Decimal String

DSfloat or DSdecimal

float

DT

Date Time

str or DT

datetime.datetime

FL

Floating Point Single

float

float

FD

Floating Point Double

float

float

IS

Integer String

IS

int

LO

Long String

str

str

LT

Long Text

str

str

OB

Other Byte

bytes

bytes or str

OD

Other Double

bytes

bytes or str

OF

Other Float

bytes

bytes or str

OL

Other Long

bytes

bytes or str

OV

Other 64-bit Very Long

bytes

bytes or str

OW

Other Word

bytes

bytes or str

PN

Person Name

PersonName

dict

SH

Short String

str

str

SL

Signed Long

int

int

SQ

Sequence of Items

Sequence

Header

SS

Signed Short

int

int

ST

Short Text

str

str

SV

Signed 64-bit Very Long

int

int

TM

Time

str or TM

datetime.time

UC

Unlimited Characters

str

str

UI

Unique Identifier (UID)

UID

UID

UL

Unsigned Long

int

int

UN

Unknown

bytes

bytes or str

UR

URI/URL

str

str

US

Unsigned Short

int

int

UT

Unlimited Text

str

str

UV

Unsigned 64-bit Very Long

int

int

Examples

Decimal String

Image Frequency String to float:

>>> raw_value = image.header.raw['ImagingFrequency'].value
>>> raw_value
"123.25993"
>>> type(raw_value)
str

>>> parsed_value = image.header.get('ImagingFrequency')
>>> parsed_value
123.25993
>>> type(parsed_value)
float

Age String

Age String (AS) to float:

>>> raw_value = image.header.raw['PatientAge'].value
>>> raw_value
"027Y"
>>> type(raw_value)
str

>>> parsed_value = image.header.get('PatientAge')
>>> parsed_value
27.0
>>> type(parsed_value)
float

Date String

Date String (DA) to datetime.date using the Header class’s indexing operator/subscript notation:

>>> raw_value = image.header.raw['PatientBirthDate'].value
>>> raw_value
"19901214"
>>> type(raw_value)
str

>>> parsed_value = image.header['PatientBirthDate']
>>> parsed_value
datetime.date(1990, 12, 14)
>>> type(parsed_value)
datetime.date

Code String

Code String (CS) to a verbose value or set of values:

>>> raw_value = image.header.raw['SequenceVariant'].value
>>> raw_value
['SP', 'OSP']
>>> type(raw_value)
pydicom.multival.MultiValue

>>> parsed_value = image.header['SequenceVariant']
>>> parsed_value
{'Oversampling Phase', 'Spoiled'}
>>> type(parsed_value)
set