Skip to content

Update Selection Widgets #3486

Closed
Closed

Description

@blink1073

I took a stab at updating the selection widgets. Namely, improving the RectangleSelector and LassoSelector, and adding new EllipseSelector, PaintSelector and LineSelector widgets. These are based on a proof of concept I made called image inspector, which in turn is based on the scikit-image canvastools.

I created a gist that demonstrates all the widgets.

Improvements to RectangleSelector:

  • Visible handles for manipulating the shape after it has been drawn
  • Keyboard modifiers:
    • Alt moves the existing shape (as does dragging the center handle)
    • Shift makes the shape square (or circular)
    • Ctrl makes the initial point the center of the shape (helpful for ellipses)
    • Ctrl and shift can be combined
  • When drawmode == 'line', actually draw the outline instead of a single line

The API is the same, but the default drawmode has been changed to 'patch', while allowing 'box' to alias to 'patch'. Also, the shape is no longer invisible after been drawn (so we can interact with it).

Improvements to LassoSelector:

  • Unified API with RectangeSelector
  • Keyboard modifier:
    • Shift enables polygon mode where it draws straight lines

Note that LassoSelector had two methods that were renamed: onpress -> press and onrelease -> release. The old methods could be kept, and call the new methods while giving a deprecation warning.

Here is a screenshot of the Ellipse tool:
image

How would you like me to proceed? Throw them all into one PR?

Activity

  1. blink1073 commented on Sep 8, 2014

    @blink1073
    MemberAuthor

    @tonysyu, @tacaswell, what are your thoughts?

  2. tacaswell commented on Sep 8, 2014

    @tacaswell
    Member

    Can you spilt them into as many PRs as make sense? My concern is that large PRs are hard to review (which makes it easier for bugs to slip in) and provide a larger cross section to collect conflicts (leading to more re-basing).

    Again, I apologize, I have not had the bandwidth to look in to this in any detail.

  3. added this to the milestone on Sep 8, 2014
  4. fariza commented on Sep 9, 2014

    @fariza
    Member

    @blink1073 just as a side note, this could be related #3475

  5. WeatherGod commented on Sep 9, 2014

    @WeatherGod
    Member
    Just to note, if you get this completed (I agree to break this up into smaller PRs) within the next month, I'll be sure to include mention of these new widgets in my book on interactive matplotlib

    On Tue, Sep 9, 2014 at 10:42 AM, Federico Ariza notifications@github.com
    wrote:

    @blink1073 https://github.com/blink1073 just as a side note, this could
    be related #3475 #3475

    —
    Reply to this email directly or view it on GitHub
    #3486 (comment)
    .

  6. fariza commented on Sep 10, 2014

    @fariza
    Member

    @blink1073 be aware of #3376

  7. blink1073 commented on Sep 11, 2014

    @blink1073
    MemberAuthor

    It would be nice to merge #3376 first so I can build on that.

  8. tonysyu commented on Sep 17, 2014

    @tonysyu
    Contributor

    I think what you did with image inspector is great, and a more unified API for selection widgets would be welcome. I agree with @tacaswell that small PRs would be much easier to review. Probably just the base SelectionWidget and one of the concrete classes in the first PR.

  9. petehuang commented on Jan 7, 2017

    @petehuang
    Contributor

    Seems like there was great work done here, thanks and props @blink1073!

    What is the status of this particular issue? I'm assuming there weren't any other PRs to submit, in which case we should mark this closed. Please do comment if otherwise.

  10. blink1073 commented on Jan 7, 2017

    @blink1073
    MemberAuthor

    Thanks, @petehuang! There is an open PR for the paint selector (#7411), to be followed by a PR for the line selector. I decided not to tackle the lasso selector integration after all. I'd say this particular PR can be closed.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions