From 3acae2274fb14c801ba92881a3f353a1a63debd6 Mon Sep 17 00:00:00 2001 From: arve0 Date: Fri, 20 Feb 2015 13:09:25 +0100 Subject: [PATCH] move CollectionViewer `update_image` to parent class --- skimage/viewer/viewers/core.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/skimage/viewer/viewers/core.py b/skimage/viewer/viewers/core.py index 6cf6ffc8..50a69603 100644 --- a/skimage/viewer/viewers/core.py +++ b/skimage/viewer/viewers/core.py @@ -153,6 +153,9 @@ class ImageViewer(QtWidgets.QMainWindow): for showing images. `ImageViewer` doesn't subclass the Matplotlib axes (or figure) because of the high probability of name collisions. + Subclasses and plugins will likely extend the `update_image` method to add + custom overlays or filter the displayed image. + Parameters ---------- image : array @@ -283,6 +286,14 @@ class ImageViewer(QtWidgets.QMainWindow): image = io.imread(filename) self._update_original_image(image) + def update_image(self, image): + """Update displayed image. + + This method can be overridden or extended in subclasses and plugins to + react to image changes. + """ + self._update_original_image(image) + def _update_original_image(self, image): self.original_image = image # update saved image self.image = image.copy() # update displayed image @@ -423,9 +434,6 @@ class CollectionViewer(ImageViewer): home/end keys First/last image in collection. - Subclasses and plugins will likely extend the `update_image` method to add - custom overlays or filter the displayed image. - Parameters ---------- image_collection : list of images @@ -472,14 +480,6 @@ class CollectionViewer(ImageViewer): self.slider.val = index self.update_image(self.image_collection[index]) - def update_image(self, image): - """Update displayed image. - - This method can be overridden or extended in subclasses and plugins to - react to image changes. - """ - self._update_original_image(image) - def keyPressEvent(self, event): if type(event) == QtWidgets.QKeyEvent: key = event.key()