Skip to content

How do I convert PALETTE COLOR pixel data to RGB? #1406

Answered by scaramallion
PankajSujyot asked this question in Q&A
Discussion options

You must be logged in to vote

You need to apply the palette colour LUT:

import matplotlib.pyplot as plt

from pydicom import dcmread
from pydicom.pixel_data_handlers.util import apply_color_lut

ds = dcmread(...)
arr = ds.pixel_array
rgb = apply_color_lut(arr, ds)
plt.imshow(rgb)
plt.show()

Replies: 1 comment 29 replies

Comment options

You must be logged in to vote
29 replies
@PankajSujyot
Comment options

@scaramallion
Comment options

@PankajSujyot
Comment options

@scaramallion
Comment options

@PankajSujyot
Comment options

Answer selected by scaramallion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #1405 on June 09, 2021 08:53.