D
D
Dev_nab2021-07-08 18:39:55
Python
Dev_nab, 2021-07-08 18:39:55

How to get multiple images in a DICOM file?

The output is ONE image, although there are 11 of them in the DICOM file .
How to get all 11 images?

import pydicom
import numpy as np
import PIL.Image
# from PIL import Image

dataset = pydicom.dcmread(my_file)
im = dataset.pixel_array
rescaled_image = (np.maximum(im,0)/im.max())*255 # float pixels
final_image = np.uint8(rescaled_image) # integers pixels
final_image = PIL.Image.fromarray(final_image).convert('L') 
# Image.fromarray(final_image)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question