Skip to content

Instantly share code, notes, and snippets.

@trigfa
Last active December 23, 2015 12:39
Show Gist options
  • Save trigfa/6637045 to your computer and use it in GitHub Desktop.
Save trigfa/6637045 to your computer and use it in GitHub Desktop.
Displaying a dicom image in a matplotlib widget within a pyqt window. The axes have been set to not visible
class MainWindow(QMainWindow, Ui_MainWindow):
def __init__(self,parent=None):
QDialog.__init__(self,parent)
self.setupUi(self)
self.mpl.canvas.ax.clear()
ds=dicom.read_file("slice.dcm")
#self.mpl.canvas.ax.imshow(self.image1, cmap=pylab.cm.bone)
self.mpl.canvas.ax.imshow(ds.pixel_array, cmap=pylab.cm.bone)
self.mpl.canvas.ax.xaxis.set_visible(False)
self.mpl.canvas.ax.yaxis.set_visible(False)
self.mpl.canvas.draw()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment