0

I read a .dcm image from my own dataset using tfio.image.decode_dicom_image following this link. The shape of the read image is shown as (None,None,None,None). While displaying the image using plt.imshow, the output of np.squeeze is zero-dimensional and hence giving error in 2-d image display. Could someone please help me understand what is the problem?

Amit Joshi
  • 15,448
  • 21
  • 77
  • 141
psj
  • 356
  • 3
  • 18

1 Answers1

0

Try pydicom to read .dcm data

from pydicom import dcmread
import matplotlib.pyplot as plt     

read= dcmread('000000.dcm')
img=read.pixel_array
plt.imshow(img,cmap = 'gray')

or sometime the directiory is wrong

Kukesh
  • 490
  • 1
  • 5
  • 18
  • Thanks, I tried reading using pydicom also, but this creates a break in the tensorflow graph and I had to use py_function/numpy_function, which is giving another error "as_list() is not defined on an unknown TensorShape." which I could not resolve. So I tried keeping pure tensorflow code. – psj Mar 16 '21 at 12:06