Search code examples
pythondicompydicom

Calculating value tag DICOM


I have a set of 20 DICOM images, and I need to show the average of Window and Center of these 20 images.

Using pydicom I get the value of these tags, where the value of the 20 images are equal, WindowWidth = ['56', '3200'] and WindowCenter = ['29', '700'].

How can I calculate this average value to Window and Center?

My simplified code, if it helps:

from dicom import read_file

ds = read_file("01.dcm")

print ds.WindowWidth # = ['56', '3200']
print ds.WindowCenter # = ['29', '700']

Solution

  • Some images [CT in particular] have multiple window levels specified to highlight different features. If your values are all the same between the 20 images, then choose one of the two sets (ideally, let the user choose them). Check attribute (0028,1055), Window Width and Center Explanation, to see if there is information there.