From 9f0449e663d468899372ee1ddac04707e978a7f5 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Sat, 21 Jul 2012 18:11:32 -0500 Subject: [PATCH] Add docstring for `overlay` and reorder methods. --- skimage/viewer/viewers/core.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/skimage/viewer/viewers/core.py b/skimage/viewer/viewers/core.py index 65939e9a..c3e8235f 100644 --- a/skimage/viewer/viewers/core.py +++ b/skimage/viewer/viewers/core.py @@ -46,6 +46,9 @@ class ImageViewer(QtGui.QMainWindow): Image being viewed. Setting this value will update the displayed frame. original_image : array Plugins typically operate on (but don't change) the original image. + overlay : array + Overlay displayed on top of image. This overlay defaults to a color map + with alpha values varying linearly from 0 to 1. plugins : list List of attached plugins. """ @@ -100,6 +103,16 @@ class ImageViewer(QtGui.QMainWindow): self.original_image = image self.image = image + def closeEvent(self, ce): + self.close() + + def show(self): + super(ImageViewer, self).show() + sys.exit(qApp.exec_()) + + def redraw(self): + self.canvas.draw_idle() + @property def image(self): return self._img @@ -108,7 +121,7 @@ class ImageViewer(QtGui.QMainWindow): def image(self, image): self._img = image self._image_plot.set_array(image) - self.canvas.draw_idle() + self.redraw() @property def overlay(self): @@ -126,13 +139,6 @@ class ImageViewer(QtGui.QMainWindow): self._overlay_plot.set_array(image) self.canvas.draw_idle() - def closeEvent(self, ce): - self.close() - - def show(self): - super(ImageViewer, self).show() - sys.exit(qApp.exec_()) - def connect_event(self, event, callback): """Connect callback function to matplotlib event and return id.""" cid = self.canvas.mpl_connect(event, callback) @@ -152,6 +158,3 @@ class ImageViewer(QtGui.QMainWindow): for artist_list in self._axes_artists: if artist in artist_list: artist_list.remove(artist) - - def redraw(self): - self.canvas.draw_idle()