Skip to content
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

[SDEV-1871] investigate gui software lag find proper fix #2752

Conversation

nandishjpatel
Copy link
Contributor

NOTE: #2726 must be reviewed first

@nandishjpatel nandishjpatel changed the title Sdev 1871 investigate gui software lag find proper fix [SDEV-1871] investigate gui software lag find proper fix May 6, 2024
@nandishjpatel nandishjpatel force-pushed the SDEV-1871-investigate-gui-software-lag-find-proper-fix branch from 44fb4d8 to e2f4d50 Compare May 6, 2024 06:10
@nandishjpatel nandishjpatel force-pushed the SDEV-1871-investigate-gui-software-lag-find-proper-fix branch 3 times, most recently from 1acd9b6 to a36d41f Compare May 23, 2024 06:57
src/odemis/gui/comp/overlay/shapes.py Outdated Show resolved Hide resolved
@nandishjpatel nandishjpatel force-pushed the SDEV-1871-investigate-gui-software-lag-find-proper-fix branch 2 times, most recently from 6664b7b to 25a03b4 Compare June 11, 2024 07:59
src/odemis/gui/comp/overlay/shapes.py Outdated Show resolved Hide resolved
src/odemis/gui/comp/overlay/shapes.py Outdated Show resolved Hide resolved
src/odemis/gui/comp/overlay/shapes.py Show resolved Hide resolved
src/odemis/gui/comp/overlay/shapes.py Outdated Show resolved Hide resolved
src/odemis/gui/comp/overlay/shapes.py Outdated Show resolved Hide resolved
src/odemis/gui/comp/overlay/rectangle.py Outdated Show resolved Hide resolved
src/odemis/gui/comp/overlay/rectangle.py Show resolved Hide resolved
src/odemis/gui/comp/overlay/rectangle.py Outdated Show resolved Hide resolved
src/odemis/gui/comp/overlay/shapes.py Show resolved Hide resolved
src/odemis/gui/comp/overlay/shapes.py Outdated Show resolved Hide resolved
src/odemis/gui/comp/overlay/rectangle.py Outdated Show resolved Hide resolved
…s edges, rotation point and shape's inside. Given this the selected VA can be found using is_point_in_shape.
…optimize _get_shape method by making use of cKDTree.

The cKDTree has data about the shape's center. When a on_left_down event occurs find 4 shapes whose centers are closest to the event position. Out of the 4 shapes check if the event position happened inside the shape and if that shape was selected by the user.
By doing so avoid iteration over all the shapes.
The shapes were drawn 2 times, this has been fixed by only allowing ShapesOverlay draw the shapes. A newly created shape is not added to the world overlay.
@nandishjpatel nandishjpatel force-pushed the SDEV-1871-investigate-gui-software-lag-find-proper-fix branch from 25a03b4 to c4a486d Compare July 18, 2024 07:26
if self.selected.value:
self.points.value = self._points
WorldOverlay.on_left_up(self, evt)
# If the Diagonal points are not the same means the rectangle has been created
Copy link
Contributor

Choose a reason for hiding this comment

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

This code is for ellipses, is "rectangle" a copy paste error? Otherwise I don't think I understand the comment :)

Same for rectangle_points on line 127 and 128

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, this is correct. We get the rectangle points 1, 2, 3, 4 first. Then the ellipse points are drawn inside the rectangle in the draw() method. You see this happening in line 140 where an ellipse circumference points are drawn based on rectangles points 1, 2, 3, 4 and finally the point VA value is assigned

Copy link
Member

Choose a reason for hiding this comment

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

Although the code uses internally a diagonal and a rectangle, here the comment mentions "the rectangle" as the ellipse shape. So it should be "rectangle" -> "ellipse".

I think the variable names are fine... though maybe it'd be less confusing if you pick a word different from the name of the other shape. Maybe something like "extrema_points" or "skeleton_points". (not "bounding box", because typically bounding box is aligned with the axes, while here, the "rectangle" can be rotated, right?)

src/odemis/gui/comp/overlay/shapes.py Outdated Show resolved Hide resolved
src/odemis/gui/cont/tabs/fastem_main_tab.py Outdated Show resolved Hide resolved
src/odemis/gui/comp/overlay/rectangle.py Outdated Show resolved Hide resolved
@nandishjpatel nandishjpatel force-pushed the SDEV-1871-investigate-gui-software-lag-find-proper-fix branch from c4a486d to 764d4b4 Compare July 19, 2024 06:32
if self.selected.value:
self.points.value = self._points
WorldOverlay.on_left_up(self, evt)
# If the Diagonal points are not the same means the rectangle has been created
Copy link
Member

Choose a reason for hiding this comment

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

Although the code uses internally a diagonal and a rectangle, here the comment mentions "the rectangle" as the ellipse shape. So it should be "rectangle" -> "ellipse".

I think the variable names are fine... though maybe it'd be less confusing if you pick a word different from the name of the other shape. Maybe something like "extrema_points" or "skeleton_points". (not "bounding box", because typically bounding box is aligned with the axes, while here, the "rectangle" can be rotated, right?)

src/odemis/gui/comp/overlay/polygon.py Show resolved Hide resolved
src/odemis/gui/comp/overlay/rectangle.py Show resolved Hide resolved
@nandishjpatel nandishjpatel force-pushed the SDEV-1871-investigate-gui-software-lag-find-proper-fix branch from 764d4b4 to 82d6858 Compare July 29, 2024 06:18
@nandishjpatel
Copy link
Contributor Author

Can we merge this PR? I wanna re-base my vEM GUI branch

@pieleric
Copy link
Member

Can we merge this PR? I wanna re-base my vEM GUI branch

It seems you've made the changes but pushed them as an amended commit. If you do extra changes to fix new comments, it's better to put them in a new commit, instead of amending the latest commit and rewriting the history. This helps to see only the most recent changes, and also I get notification in Github.

Also, please mark the comments as "resolved". That also hints me that something has changed!

@pieleric pieleric requested a review from tepals July 30, 2024 08:54
@pieleric pieleric merged commit 9012f43 into delmic:master Jul 30, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants