3

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']
Suever
  • 64,497
  • 14
  • 82
  • 101
Pedro Monteiro
  • 347
  • 1
  • 4
  • 12
  • 1
    It would be helpful to know the purpose of averaging the window parameters. Probably your question is not "how do I calculate the average of two integers in python". Window Center and Window Width are multi-value attributes, so that it is possible to store an arbitrary number of Center/Width values in a DICOM header. In your example you have two window sets (WC=29, WW=56 and WC=700, WW=3200) Averaging them does not make a lot of sense to me. – Markus Sabin Jan 18 '16 at 07:39
  • The thing is, I have this set of 20 images and each image has a value of winow/level different when I open them in a viewer (not sure how it is calculated this value), but the tags of them have the same value, which I provided in the question. But in the software I'm developing I need to show these 20 images on one screen and display a value of window/level for all of them, my question is: what would be that value (average?) of window/level to all these images? Understand now? – Pedro Monteiro Jan 18 '16 at 22:08
  • Yes that helps. I upvoted the answer of cneller, it is what I would also suggest. Averaging them does not make more sense than using the values provided from any of the images. Most of the time the users will manually adjust it anyway, so what you provide is no more than a starting point. – Markus Sabin Jan 19 '16 at 07:36

1 Answers1

2

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.

jdg
  • 2,230
  • 2
  • 20
  • 18
cneller
  • 1,542
  • 1
  • 15
  • 24