On Mon, Mar 12, 2012 at 4:08 AM, Guillaume Gay
<guillaume@mitotic-machine.org> wrote:
Hi Tony,
This looks great.
I was
Le 10/03/2012 18:34, Tony Yu a écrit :
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).
Yes, I scratched my head on that, and I agree with you it is
difficult and would certainly look really ugly (and buggy) most of
the time.
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).
One thing I didn't figure out
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.
I already have some ideas on the contrast setter, I'll try to work
on that piece this week.
Hey Guillaume,
Sorry to change things up while you're working on this, but I wanted to split the viewer into different files; so, I've moved development to a repo called `skloupe`:
This name could change at some point. (Am I even allowed to call it a SciKit?)
If you've already started working on a contrast-adjustment plugin, it shouldn't be too hard to switch over. The original classes were moved to
- ImageWindow --> skloupe.viewers.ImageViewer
- Widget --> skloupe.plugins.Plugin
I renamed "Widget" to "Plugin" because there's a separate `widgets` subpackage for "basic" interactive tools, which currently has a `Slider` object that you may find useful.
Also, based off of Christophe Gohlke's `tifffile.imshow`, I've added support for viewing image collections in `skloupe.viewers.CollectionViewer`. Ideally, there will be a `skloupe.viewers.imshow` function that opens both images and image collections, but this isn't yet implemented.
Cheers,
-Tony