mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-10 12:40:08 +08:00
@@ -165,6 +165,11 @@ class Plugin(QDialog):
|
||||
# If param is a widget, return its `val` attribute.
|
||||
return param if not hasattr(param, 'val') else param.val
|
||||
|
||||
@property
|
||||
def filtered_image(self):
|
||||
"""Return filtered image."""
|
||||
return self.image_viewer.image
|
||||
|
||||
def display_filtered_image(self, image):
|
||||
"""Display the filtered image on image viewer.
|
||||
|
||||
|
||||
@@ -74,6 +74,14 @@ class OverlayPlugin(Plugin):
|
||||
self._overlay_plot.set_cmap(self.cmap)
|
||||
self.image_viewer.redraw()
|
||||
|
||||
@property
|
||||
def filtered_image(self):
|
||||
"""Return filtered image.
|
||||
|
||||
This "filtered image" is used when saving from the plugin.
|
||||
"""
|
||||
return self.overlay
|
||||
|
||||
def display_filtered_image(self, image):
|
||||
"""Display filtered image as an overlay on top of image in viewer."""
|
||||
self.overlay = image
|
||||
|
||||
@@ -6,6 +6,9 @@ try:
|
||||
except ImportError:
|
||||
print("Could not import PyQt4 -- skimage.viewer not available.")
|
||||
|
||||
import numpy as np
|
||||
|
||||
import skimage
|
||||
from skimage import io
|
||||
from .core import BaseWidget
|
||||
|
||||
@@ -84,7 +87,11 @@ class SaveButtons(BaseWidget):
|
||||
basename, ext = os.path.splitext(filename)
|
||||
if not ext:
|
||||
filename = '%s.%s' % (filename, self.default_format)
|
||||
io.imsave(filename, self.plugin.image_viewer.image)
|
||||
image = self.plugin.filtered_image
|
||||
if image.dtype == np.bool:
|
||||
#TODO: This check/conversion should probably be in `imsave`.
|
||||
image = skimage.img_as_ubyte(image)
|
||||
io.imsave(filename, image)
|
||||
|
||||
|
||||
def notify(msg):
|
||||
|
||||
Reference in New Issue
Block a user