-
Notifications
You must be signed in to change notification settings - Fork 0
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
45 Move the view of the viewbox to a given position #57
Conversation
…corner if zoomed out
…the_view_of_the_viewbox
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good! I tested the function as described with different coordinates in minimap_window, and the images are centered as expected. The code is well documented and structured. Running Cellpose does not produce any error messages, and the code does not cause any issues. I don't have any suggestions for changes anymore and would therefore approve it. Great job :)
The merge-base changed after approval.
The merge-base changed after approval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! The code has a very clear structure and is well commented, it reflects how the problem was broken down into smaller steps and makes it easy to understand whats happening. I also didn't encounter any bugs or errors while testing and would approve 👍
resolves #45
This draft PR will be transformed into a full pull request as soon as issue 10 is merged into main. Therefore, this can already be reviewed.
View of the viewbox can be moved using normalized coordinates
The following changes were implemented in the class MainW in cellpose/gui/gui.py:
center_view_on_position
was createdself.img.image.shape
and used to calculate new positionsself.p0.viewRange()
: used to calculate width and height of view range to maintain zoom levelInformation for testing
This issue is part of the former ticket 13. The extraction of the coordinates will be implemented in ticket 44. Ticket 46 will combine the two features.
For testing the functionality of this implementation, I recommend calling the function using
self.center_view_on_position(0.5, 0.5)
in the methodminimap_window
in gui.py.The parameters
0.5, 0.5
refer to normalized x- and y-coordinates; this will put the center of the current image at the center of the view box. When using theminimap_window
method, the minimap button in the menu will have to be (un)toggled to call this method.I suggest trying out different values (between 0 and 1) as well as different zoom levels.
Showcase
Zoom
For a picture zoomed out, this should look (when using 0.5, 0.5) similar to this:
And for a picture zoomed in, similar to this:
Coordinates
When using different values than 0.5, 0.5, other parts of the picture should be at the center:
E.g. for 0,0, the upper left corner should be at the center: