Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
Last active August 9, 2022 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergiolucero/fc58084e349db7ce2cd499dc94bc638b to your computer and use it in GitHub Desktop.
Save sergiolucero/fc58084e349db7ce2cd499dc94bc638b to your computer and use it in GitHub Desktop.
view dcm folder
import pydicom as dicom
import matplotlib.pylab as plt
import glob
fig=plt.figure(figsize=(20,12));rows=2;cols=2;axes=[]
for a, file in zip(range(rows*cols),glob.glob('*.dcm')):
axes.append( fig.add_subplot(rows, cols, a+1) )
axes[-1].set_title(file)
axes[-1].axis('off')
plt.imshow(dicom.dcmread(file).pixel_array)
fig.tight_layout()
plt.show()
@sergiolucero
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment