Sean M
Sean M

Reputation: 91

How to convert a DICOM from Monochrome 1 to Monochrome 2?

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.

Upvotes: 4

Views: 4146

Answers (2)

jjjshade
jjjshade

Reputation: 126

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.

Upvotes: 1

Markus Sabin
Markus Sabin

Reputation: 4013

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.

Upvotes: 2

Related Questions