4

I am working on a project with DICOM images where I need to compare two DICOM images. The problem is, one is in monochrome 1 and the other is in monochrome 2 (zero means white and black, respectively). How can I convert these pixel intensities to compare them? I am using the "pydicom" toolkit.

glennsl
  • 28,186
  • 12
  • 57
  • 75
Sean M
  • 91
  • 2
  • 5

2 Answers2

1

Your major problem is not the Photometric Interpretation (MONO1/2).

You cannot compare pixel intensities of two DICOM images unless they refer to the same scale (e.g. Hounsfield Units).

If you have

(0028,1052) RescaleIntercept - present with any value
(0028,1053) RescaleSlope - present with any value
(0028,1054) RescaleType - present with value "OD" or "HU"

Then it is pretty easy: Apply the linear transformation:

<measured value> = <pixel value> * RescaleSlope + RescaleIntercept

The measured values can be compared.

The same is true if you have a non-linear Modality LUT stored as a lookup table in the header, but the same restrictions apply for Rescale Type.

Otherwise I would refrain from comparing pixel values. Of course, it appears to be easy to just invert one of the two images, but the fact that they have different Photometric Interpretation tells me that they have been acquired by different devices or techniques. This means, that the pixel data is visually correct and comparable but not mathematically related.

Markus Sabin
  • 3,916
  • 14
  • 32
  • Thanks! That's very good to know. I came across Hounsfield units when doing a bit of background research, but I was under the impression they were only valid for CTs. Are they valid for plain X-rays as well? – Sean M Mar 30 '17 at 19:24
  • No, they can't. X-Rays are projection images, so the pixels contain a summation of all tissue the ray came accross. HU are referring to tissue density, so they do not make sense in projection images. – Markus Sabin Mar 31 '17 at 06:02
  • I see. Is there a valid way to compare two projection images' pixel intensity? – Sean M Mar 31 '17 at 12:20
  • `but the fact that they have different Photometric Interpretation......` some CR/DX devices I came across provide configuration to set output type. Also, some devices only output raw data. Other application (generally bundled with device) "interpret it" for monochrome 1 or 2 and then convert it to DICOM. – Amit Joshi Mar 31 '17 at 14:06
  • Stilly I claim that unless the images refer to a commonly used scale, they are consistent with themselves but not among each other. E.g. a higher radiation dose applied to the same body part will yield different intensities even if both images match exactly in position, field of view and examined body part. – Markus Sabin Apr 03 '17 at 09:57
1

If it helps, when visualising with matplotlib.pyplot you can use

plt.imshow(image, cmap='gray_r')

to invert the pixels back to Monochrome2 for visual comparison without changing pixel values.

Also,

np.invert(image)

might be a work-around.

jjjshade
  • 101
  • 1
  • 6