I'm reading in a DICOM with pydicom.read_file()
like this:
x = pydicom.read_file(/path/to/dicom/)
This returns an instance of FileDataset
but I get an error when trying to access a value like this:
x[0x20,0x32]
OUTPUT: *** KeyError: (0020, 0032)
I also tried accessing the value like this:
x.ImagePositionPatient
OUTPUT: *** AttributeError: 'FileDataset' object has no attribute 'ImagePositionPatient'
The reason this confuses me is because when I look at all the values using x.values
I see the field is in fact present:
(0020, 0032) Image Position (Patient)
How can the key be missing if I can clearly see that it exists?
I'm not an expert on PyDICOM but it should work just like a regular Python dictionary.