Skip to content

Add ellipse selection widget to the new Instrument View#40841

Open
jclarkeSTFC wants to merge 8 commits intomantidproject:mainfrom
jclarkeSTFC:40757_ellipse_instrument_view
Open

Add ellipse selection widget to the new Instrument View#40841
jclarkeSTFC wants to merge 8 commits intomantidproject:mainfrom
jclarkeSTFC:40757_ellipse_instrument_view

Conversation

@jclarkeSTFC
Copy link
Contributor

@jclarkeSTFC jclarkeSTFC commented Feb 6, 2026

This adds a new elliptical widget for selecting detectors in the new Instrument View. You can resize both axes of the ellipse, and rotate it.

Closes #40757 .

image

To test:

Check all three widgets still work for selection, circle, rectangle, ellipse. Resize and rotate the ellipse, try dragging the edges over each other, ellipse should reverse.

I recommend you zoom in a bit before drawing shapes, otherwise you'll end up picking loads of detectors.


Reviewer

Your comments will be used as part of the gatekeeper process. Comment clearly on what you have checked and tested during your review. Provide an audit trail for any changes requested.

As per the review guidelines:

  • Is the code of an acceptable quality? (Code standards/GUI standards)
  • Has a thorough functional test been performed? Do the changes handle unexpected input/situations?
  • Are appropriately scoped unit and/or system tests provided?
  • Do the release notes conform to the guidelines and describe the changes appropriately?
  • Has the relevant (user and developer) documentation been added/updated?
  • If the PR author isn’t in the mantid-developers or mantid-contributors teams, add a review comment rerun ci to authorize/rerun the CI

Gatekeeper

As per the gatekeeping guidelines:

  • Has a thorough first line review been conducted, including functional testing?
  • At a high-level, is the code quality sufficient?
  • Are the base, milestone and labels correct?

@jclarkeSTFC jclarkeSTFC added this to the Release 6.16 milestone Feb 6, 2026
@jclarkeSTFC jclarkeSTFC added the Epic Used for issues and PRs that are managed under the ISIS Epic Workstream label Feb 6, 2026
@jclarkeSTFC jclarkeSTFC marked this pull request as ready for review February 6, 2026 11:10
@github-actions github-actions bot added the Has Conflicts Used by the bot to label pull requests that have conflicts label Feb 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

👋 Hi, @jclarkeSTFC,

Conflicts have been detected against the base branch. Please rebase your branch against the base branch.

@jclarkeSTFC jclarkeSTFC removed the Has Conflicts Used by the bot to label pull requests that have conflicts label Feb 9, 2026
@andy-bridger andy-bridger self-assigned this Feb 11, 2026
Copy link
Collaborator

@andy-bridger andy-bridger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I've had a good try at breaking it and nothing catastrophic has fallen out - comments are mainly aesthetic

self._ellipse_mesh = self._create_ellipse_mesh(cx, cy, rx, ry, z, angle=self._angle)
self._ellipse_actor = self._plotter.add_mesh(
self._ellipse_mesh,
color="yellow",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that all the widgets are different colours (circle - red, box -white, ellipse - yellow)? An argument could be made for them all being the same colour so they all look a bit more unified?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ellipse is now white to match the rectangular bounding box

jclarkeSTFC and others added 5 commits February 12, 2026 15:42
Co-authored-by: andy-bridger <71634246+andy-bridger@users.noreply.github.com>
This helps with selecting the rectangle grab point when it's close to
the rotation handle.
Copy link
Collaborator

@andy-bridger andy-bridger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making those changes, sorry to be annoying with some final comments - especially because I wouldn't be committed to what I have requested as the best option (I get quite a noticeable grid illusion https://en.wikipedia.org/wiki/Grid_illusion from the handles on the black background which is quite distracting - I've played with a few options to make it better but haven't had much luck)

So feel free to either make the changes and I'll approve or say you disagree and I'll also approve!

render_lines_as_tubes=False,
pickable=False,
show_edges=False,
name=f"ellipse_widget_{id(self)}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally think having point_size = 0 looks nicer and neater than seeing the individual points along the ellipse (matches the rectangle better as well)

Image


x, y, _z = self.display_to_world_coords(width / 2 + 0.15 * width, height / 2, 0)
cylinder_repr.SetRadius(np.sqrt((x - cx) ** 2 + (y - cy) ** 2))

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also make this white:

Suggested change
cylinder_repr.SetEdgeColor(1, 1, 1)

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

Labels

Epic Used for issues and PRs that are managed under the ISIS Epic Workstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ellipse in new Instrument View

2 participants

Comments