napari / napari

napari: a fast, interactive, multi-dimensional image viewer for python
https://napari.org
BSD 3-Clause "New" or "Revised" License
2.07k stars 410 forks source link

feat: Add right click menu position to copy spatial information #6862

Closed Czaki closed 3 weeks ago

Czaki commented 3 weeks ago

References and relevant issues

depends on https://github.com/pyapp-kit/in-n-out/pull/110

Description

Currently, we do not provide any mechanism to adjust spatial information from GUI. This PR add option to copy information from one layer to list of another one (selection).

https://github.com/napari/napari/assets/3826210/4152aa06-00cf-4360-826f-5f6959328e02

Currently, it only copies scale and translate, as I would like to ask if you are happy with such workflow.

This workflow requires opening a modal window to select the source layer.

It is part of #6780

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 31.81818% with 30 lines in your changes are missing coverage. Please review.

Project coverage is 92.35%. Comparing base (283be74) to head (c8ee411). Report is 1 commits behind head on main.

Files Patch % Lines
napari/_qt/_qapp_model/injection/_qproviders.py 26.92% 19 Missing :warning:
napari/layers/_layer_actions.py 26.66% 11 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6862 +/- ## ========================================== - Coverage 92.45% 92.35% -0.11% ========================================== Files 614 614 Lines 54862 54904 +42 ========================================== - Hits 50724 50706 -18 - Misses 4138 4198 +60 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

psobolewskiPhD commented 3 weeks ago

I dig it, I mean the contextual menu position should be moved down and I would add ... to mark that modal will open, but it looks cool.

Edit: with this I'd probably also suggest a Set scale.. which pops a modal to enter the scale, again the most common use case. Transform can be done in GUI now, but not setting scale.

Could consider putting this in a submenu along with reset scale & transform to go back to 1, 1, 1.

Thinking out loud about other approaches:

Czaki commented 3 weeks ago

Edit: with this I'd probably also suggest a Set scale.. which pops a modal to enter the scale, again the most common use case.

I have planned to do this in separate PR for editing spatial properties.

Transform can be done in GUI now, but not setting scale.

How?

could try to do a Copy action on a layer that would grab that info and then offer a Apply action you could use on any other layers. I think it could be a bit more handy if you have many layers, but not sure on the implementation side how tricky it would be.

It may be implemented using json (copy json to the clipboard and paste it back). But it may be difficult to discover. But maybe I have wrong image in my head and it could be obvious to to discover??

psobolewskiPhD commented 3 weeks ago

But it may be difficult to discover.

No more difficult to discover than any other layer list contextual menu item? I think right-click copy and then paste/apply are pretty common actions across OS's too-and MS Office apps for sure. 🤷

Czaki commented 3 weeks ago

Close in favor of #6864 base on feedback of community meeting