New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt-MPL viewer #229

Merged
merged 62 commits into from Aug 24, 2012

Conversation

Projects
None yet
2 participants
@tonysyu
Copy link
Member

tonysyu commented Jul 20, 2012

Alternate implementation of image viewer using Matplotlib to draw the image canvas and Qt for drawing widgets. This viewer is an alternative to the pure Matplotlib version in PR #165. Explicitly using Qt overcomes many of the deficiencies of using Matplotlib widgets and allows full control of menus and toolbars.

This viewer has 3 main parts:

  • An ImageViewer class that shows images.
  • A Plugin class (and subclasses) to manipulate or measure images.
  • Widgets for interacting with manipulation and measurement functions.

tonysyu added some commits Jul 20, 2012

Fix `add_argument`.
`arguments` is a list, but I was treating it like a dict.
ENH: Allow `Plugin.add_widget` to hook into Plugin attributes.
The `ptype` parameter of widget can now be set to 'plugin'. When this is the case, the plugin will set a plugin attribute whenever the widget is updated.

As an example, this commit adds a ComboBox widget which is hooked into the overlay color of the OverlayPlugin.
API Change: Attach ImageViewer to Plugin after init.
Plugin is now added to the viewer using an inplace add on the viewer instead of on initialization of the plugin. This change means that operations requiring the viewer must be delayed until attach operation.
Change image_viewer to Plugin property.
Raise an error when using Plugin.image_viewer before it is set. This error prevents other, more obscure, errors from getting raised.
Rename (dis)connect_event to (dis)connect_image_events.
This clarifies action since these events are on the image viewer, not the plugin.

tonysyu added some commits Jul 25, 2012

DOC: Improve docstrings for ImageViewer.
Oops: also changed added leading underscore to `update_status_bar`.
ENH: Create new Slider with editbox.
Also, make the behavior more consistent between updating plugin and widget parameters.
Revert modifications of IntelligentSlider.
Slider added in last commit removes the need for these modifications.
BUG: Fix behavior when initial overlay limits are bad.
Intensity limits are calculated by the initial input image. If this image has, for example, all black pixels, then subsequent overlays will remain all black because of the initialized limits. Set limits based on data type to fix this issue.
if self.draws_on_image:
self.connect_image_event('draw_event', self.on_draw)
# Call filter so that filtered image matches widget values
self.filter_image()

This comment has been minimized.

@stefanv

stefanv Aug 24, 2012

Member

Adding 3 widgets then runs the filter 3 times?

This comment has been minimized.

@tonysyu

tonysyu Aug 25, 2012

Member

I think the filtering should only occur once. attach is called when the plugin is attached to the viewer. In contrast, add_widget is called each time a widget is added to a plugin.

from ..utils import ClearColormap


#TODO: Maybe this bool definition should be moved to skimage.util.dtype.

This comment has been minimized.

@stefanv

stefanv Aug 24, 2012

Member

Let's do that.

This comment has been minimized.

@tonysyu

tonysyu Aug 25, 2012

Member

Actually, there's no need since PR#260 adds bool support. I did, however, remove the dtype_range hack and, instead, use the new bool support. I pushed directly to master because it seemed minor. Let me know if I shouldn't have done so.

stefanv added a commit that referenced this pull request Aug 24, 2012

@stefanv stefanv merged commit 7490322 into scikit-image:master Aug 24, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment