On Mon, Feb 27, 2012 at 4:13 AM, Guillaume Gay
<guillaume@mitotic-machine.org> wrote:
Le 26/02/2012 21:15, Stéfan van der Walt a écrit :
On Sat, Feb 25, 2012 at 11:10 AM, Tony Yu<tsyu80@gmail.com> wrote:
Plugin system
------
It might be nice to have some sort of plugin system for the image viewer.
That way, tools like this could be implemented a bit more easily and, also,
easily added to the viewer or ignored by the user.
At the moment, we basically have a double-viewer implementation:
simply vs fancy. So we separate out
imshow(x) and imshow(x, fancy=True)
I thought one solution was to sub-class FigureCanvas, with extra buttons, but from what I understand, it is not that easy to do this at the platform independant level.
But maybe adding arguments to the function call, for exemple imshow(x, set_contrast=True, linescan=True) plus keyboard toggles is enough?
Hey Guillaume,
I'm still tossing around ideas for implementing some sort of interactive viewer with pluggable tools. Based off your LineProfile idea, I created the beginnings of a
matplotlib image-viewer, which could have some sort of plugin system (not really implemented).
I took a different approach than your original implementation: the line-profile output shows up as a separate figure. I think it'd be nice to have tools integrated into the image window, but I think this will be really difficult to do well (specifically, resizing the figure window and adjusting canvas area when connecting and disconnecting the tool). Using multiple figures is easier, although a little more cumbersome for the user. One advantage is that you can disconnect the tool just by closing the tool's figure (this doesn't currently work for Qt4 backends because of an
MPL bug).
Right now, the LineProfile tool is just a test case: the main components are an ImageWindow class and the Widget base class. I'd like to test the architecture with some different use cases (e.g. contrast-adjustment widget, mask editor, etc.) when I have the time. I could see these classes changing dramatically after testing different uses.
Everything's in a single file at the moment, but the idea would be to move the Widget subclasses to some sort of "widgets" directory.
-Tony
P.S. Guillaume: I couldn't figure out why `img_zoomed`/`previous_axis`/`current_axis` were necessary, so I just removed them. If there was some functionality that I missed, let me know.
agree to an extent. Nevertheless, I think providing a viewer that supplies
*an infrastructure* for creating GUI tools might be really valuable. I
haven't really thought through what this plugin system would look like, so
it may just be a pipe dream.
This is a tricky problem (which set of tools to use, etc.)--but in
principle, it would be nice to have a few standard viewers, e.g.,
image compare, image compare + parameter adjust, mask editor (to build
custom filters, e.g.) and image inspector (like the one you and
Guillaume are working on).
Stéfan
What do you mean by mask editor? Something like a slider to adjust a threshold with a superimposed mask?
Guillaume