mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-10 01:40:01 +08:00
Delete overlay when deleting plugin.
This commit is contained in:
@@ -18,3 +18,7 @@ class CannyPlugin(Plugin):
|
||||
def callback(self, *args, **kwargs):
|
||||
image = canny(*args, **kwargs)
|
||||
self.image_viewer.overlay = image
|
||||
|
||||
def closeEvent(self, event):
|
||||
self.image_viewer.overlay = None
|
||||
super(CannyPlugin, self).closeEvent(event)
|
||||
|
||||
@@ -117,7 +117,10 @@ class ImageViewer(QtGui.QMainWindow):
|
||||
@overlay.setter
|
||||
def overlay(self, image):
|
||||
self._overlay = image
|
||||
if self._overlay_plot is None:
|
||||
if image is None:
|
||||
self.ax.images.remove(self._overlay_plot)
|
||||
self._overlay_plot = None
|
||||
elif self._overlay_plot is None:
|
||||
self._overlay_plot = self.ax.imshow(image, cmap=self.overlay_cmap)
|
||||
else:
|
||||
self._overlay_plot.set_array(image)
|
||||
|
||||
Reference in New Issue
Block a user