ome / omero-figure

An OMERO.web app for creating Figures from images in OMERO
http://figure.openmicroscopy.org
GNU Affero General Public License v3.0
15 stars 30 forks source link

Edit ID on z-stacks - displayed slice set to middle one #512

Closed Rdornier closed 8 months ago

Rdornier commented 11 months ago

Bug report

Describe the bug The displayed slices of z-stacks are set to by-default values when you copy-paste the stack and edit its id (the new image has the same number of xyczt). Related issue https://github.com/ome/omero-figure/issues/511

To Reproduce

  1. Open a new figure
  2. Import an z-stack
  3. Select some slices
  4. Copy-Paste the slices
  5. Edit their ID with the ID of a new stack (with same number of xyczt => can be the same image ID as well)
  6. All slices are set to the middle slice => it does not take into account the slice number previouslly set.

Expected behavior For each stack with the same number of slices, the displayed slice number should be kept and the slice displayed when editing the ID with another stack ID.

Screenshots OMERO-figure-bug-slice

Desktop :

ping @romainGuiet

will-moore commented 10 months ago

Thanks for the feedback. That behaviour was a conscious decision. I thought that the particular Z-index of the existing panel would be quite particular to that Image (e.g. focus on a certain feature of that image) and not be relevant to any new image that you add. This is in contrast to the T index which is preserved, so if you have a series of Time-points for a movie, you could set a new ID for those and see the same time-points for a new Image. But I see that you want the same behaviour for Z, which is fair enough, and I'm happy to change the behaviour accordingly.

I think this would just need to remove this line: https://github.com/ome/omero-figure/blob/eb6c3ead527d79584d41d0a6f8580562522c304a/src/js/views/modal_views.js#L284

and then handle theZ of the original image being greater than sizeZ of the new image as we do for T-index at: https://github.com/ome/omero-figure/blob/eb6c3ead527d79584d41d0a6f8580562522c304a/src/js/views/modal_views.js#L366

Rdornier commented 10 months ago

Thanks Will for your feedback !

But I see that you want the same behaviour for Z, which is fair enough, and I'm happy to change the behaviour accordingly.

It would be very nice 👍, thanks a lot !

Rdornier commented 9 months ago

Hello @will-moore,

I open a PR #518 with the necessary changes to make it work. However, I couldn't remove the line setting theZ because I always got a black image. Instead, I keep it like this and add json.newImg['theZ'] = json.selImg['theZ'] if the number of slices matches between the two images.