Ensure projection parameters are within bounds in loadJSON and setID#665
Conversation
|
Also I must say I am unsure the code is in the right place for loadJSON. I don't think it's a bug tied to a specific OMERO.figure model version, so I instead check that the z-projection parameters are always in bound when figure is loaded from JSON. |
There was a problem hiding this comment.
Pull request overview
This PR addresses an issue where z-projection parameters (z_start, z_end, z_projection) can be out of bounds when loading figures from JSON or switching to images with fewer Z slices, causing panels to become unresponsive. The fix adds bounds checking in two locations to ensure these parameters are always valid.
Changes:
- Added bounds checking logic in
load_from_JSONto sanitize z-projection parameters when loading figures - Added bounds checking logic in
setIdto handle switching to images with different Z dimensions - Removed trailing whitespace in multiple files
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/js/models/figure_model.js | Adds bounds checking for z_start, z_end, z_projection when loading panels from JSON; handles sizeZ=1 case and ensures start<=end; also removes trailing whitespace |
| src/js/models/panel_model.js | Adds bounds checking for z_start, z_end, z_projection in setId function when switching images; also removes trailing whitespace |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Conflicting PR. Removed from build OMERO-plugins-push#41. See the console output for more details.
--conflicts |
|
Conflicting PR. Removed from build OMERO-plugins-push#42. See the console output for more details.
--conflicts |
|
Just tried testing on merge-ci before I realised this didn't get merged! Certainly managed to reproduce bugs anyway... |
|
Conflicting PR. Removed from build OMERO-plugins-push#56. See the console output for more details.
--conflicts |
|
Conflicting PR. Removed from build OMERO-plugins-push#67. See the console output for more details.
|
A figure from 2022 on my server had an issue when loaded. I found that
z-end == sizeZin the JSON.TLDR to reproduce:
z-end>=sizeZAlso
projectionwas set totrue, but out of boundz-endis enough to make the panel fail (not the whole figure fails. Just the panel is greyed out, guessing this comes frompanel_model.validate).What's curious is that these images have a single Z-slice, so weird that
projection == true.I added code in the JSON loading to set bounds to
z-startandz-endso that it never goes out. Also tried to do it in a conservative way that:z-startandz-endunchanged, unless it's out of bounds.Writting the PR, I realize that I could reproduce the issue by setting the ID of a stack to a smaller stack. So I also added the bounding logic to setId.