So I've been hacking on a new implementation of an image-viewer/interactive-image-processor. See PR 229: https://github.com/scikits-image/scikits-image/pull/229 The previous implementation was written purely in Matplotlib, partly for portability. Unfortunately, I found this implementation a bit limiting because Matplotlib doesn't provide quite-enough widget support. In addition, there was no way to add custom toolbars or menus without getting toolkit-specific. So, I've added a new implementation that requires PyQt but also uses Matplotlib because of the wealth of plotting functionality that it provides. There's a lot that I added in my original implementation that needs to be updated for this implementation (an image collection viewer, and Guillaume Gay's contrast setter and line-profile plugins). I'm of the opinion, however, that these should be implemented later in order to reduce the work to review this PR (that's actually why I moved the line profile plugin<https://github.com/tonysyu/scikits-image/blob/qtmpl-lineprofile/skimage/viewer/plugins/lineprofile.py>to a separate branch). Overall, I'm pretty happy with the current implementation. The basic idea is that there's a viewer class (to view images, of course). You can then connect plugins to the viewer, which typically calls some sort of filter function, but that's in no way a requirement (for example, the line-profile plugin measures values in the image). Also, there are widgets that get attached to these plugins (currently, just a slider and a combo box) to adjust filtering or plugin parameters. There are two ways to implement a plugin: The first is by subclassing the base `Plugin` class<https://github.com/tonysyu/scikits-image/blob/qtmpl-viewer/skimage/viewer/plugins/canny.py>. The second (which I shamelessly stole from Bokeh) instantiates a plugin and just adds widgets<https://github.com/tonysyu/scikits-image/blob/qtmpl-viewer/viewer_examples/plugins/canny_simple.py>(using the addition operator) to control filter parameters. The first is probably more flexible, while the second is convenient for people who may not be as comfortable with object-oriented programming (plus I think it reads really well). It's a big PR, but I'd really appreciate comments and suggestions. Cheers, -Tony P.S. Stefan: In a separate branch, I've added the Hough Transform plugin you so desired. Right now it's a little hacky, partly because I haven't yet built the infrastructure to support this type of plot (not only does it plot an overlay but also Matplotlib lines; in addition, parameters have to be delegated to two different functions). Nevertheless, the implementation is surprisingly short<https://github.com/tonysyu/scikits-image/blob/qtmpl-houghplugin/viewer_examples/plugins/hough_transform_simple.py>, despite not adding anything else to support this use case.
participants (1)
-
Tony Yu