--
You received this message because you are subscribed to the Google Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Thank you Juan. IIt looks like the event caught by the CanvasToolBase
are not whtn I am looking for (mouse click and keyboard events)
Nadav,
The canvas itself is a matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg
. If you wanted, you could subclass that class and provide your own mousePressEvent
and friends. Something like:
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
import matplotlib.pyplot as plt
from skimage import data
class MyCanvas(FigureCanvasQtAgg):
def mousePressEvent(self, event):
pass
def main():
image = data.camera()
f, ax = plt.subplots()
f.canvas = MyCanvas()
ax.imshow(image, interpolation='nearest')
h, w = image.shape
plt.show()
Nadav,
You want the slider to update the value as it is moving? If so, pass update_on="move"
to Slider()
. I tried your example, and my view does update on key presses. I am using skimage 0.9.3 on Windows 7.
import matplotlib.pyplot as plt
from skimage import data
from skimage import viewer
from skimage.viewer.plugins.overlayplugin import OverlayPlugin
from skimage.viewer.widgets import Slider
class Cimage(object):
def __init__(self):
self.recname = 'howdy'
self.rgb_image = data.camera()
self.gamma = 1
def key_press(self, event):
self.view.image = self.view.image[::-1]
def image_update(self, image, **kwargs):
return image[::-1] - int(kwargs['gamma']) * 5
def create_window(self):
self.view = viewer.ImageViewer(self.rgb_image)
plugin = OverlayPlugin(image_filter=self.image_update)
plugin += Slider('gamma', 1.0, 3.0
, value=self.gamma,
orientation='vertical', update_on='move')
plugin += Slider('mat mix', 0.0, 1.0, value=0.0,
update_on='move', orientation='vertical')
plugin += Slider('wb mix', 0.0, 1.0, value=0.0,
update_on='move', orientation='horizontal')
self.view += plugin
self.view.connect_event('key_press_event', self.key_press)
self.view.setWindowTitle(self.recname)
self.view.show()
def main():
a = Cimage()
a.create_window()
if __name__ == '__main__':
main()
About my earlier example, you would need to call f.canvas.show
instead of plt.show
(I ran the code this time). But, if the MPLCanvas methods work, I’d stick with those.
Cheers,
Steve
You received this message because you are subscribed to a topic in the Google Groups "scikit-image" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scikit-image/pRZYHjAW78U/unsubscribe.
To unsubscribe from this group and all of its topics, send an email to scikit-image...@googlegroups.com.