
Hi to all
I'm new in scikit-image, and i develop algorithms for medical applications.
Sometimes is very very useful to have user interaction, in particular Region of Interest (ROI) selection over an image. I found in skimage the RectangleTool and i'm trying to write a simple ROI selector in order to use the rectangle coords in successive computations.
unfortunately i can't be able to handle mouse events: for example if i've:
#import import skimage as sk from skimage import data import matplotlib.pyplot as plt from skimage.viewer.canvastools import RectangleTool import numpy as np from skimage.draw import polygon from skimage.draw import line
im = data.lena() f, ax = plt.subplots() plt.imshow(im)
def cable(img):
# is here usable "extents?"
rect_tool = RectangleTool(ax,on_enter=cable(im))
i simply want to see "extents" which is the attribute that store coords for user-selected rectangle according to http://scikit-image.org/docs/dev/api/skimage.viewer.canvastools.html?highlig...
i hope this is clear and if it's possible i think is useful to embed this example in docs.
thanks in advance

Hi Salvatore,
on_enter is expecting a function object, but you’ve passed the *result* of a function call. Here’s what it should look like:
def cable(extents): print(extents)
rect_tool = RectangleTool(ax,on_enter=cable)
Once you get it working, we’d love for you to submit a Pull Request with an example in the docstring for RectangleTool.
Regards,
Steve
participants (2)
-
Salvatore Scaramuzzino
-
Steven Silvester