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

Annotation inheritance support #525

Merged
merged 5 commits into from
Feb 19, 2024
Merged

Conversation

Tom-TBT
Copy link
Contributor

@Tom-TBT Tom-TBT commented Nov 1, 2023

This PR is at a testing stage and relies on a changed function (api_annotations) from omero-web, inside a parallel PR.

Inherited annotations are decompressed, and the ann.link.parent is changed to the inheritor object. Like so, all further handling of the annotation is the same. No difference if the annotation was on the current image or on a parent object.

The implementation also checks that the query's result has the inherited annotations.

@will-moore
Copy link
Member

Hi Tom,
Apologies for the delay, but I'm just getting around to testing this now...

I'm finding that if I select multiple images from the same Dataset (and Project), and add labels from KVPs, the KVPs that are on the parents only get applied to one of the images.

E.g. here the 3 images are in the same Dataset, but the Project/Dataset KVPs are all only shown on 1 image. The colour and test_KVP are on the images themselves, but all the others are on the Project/Dataset.

Screenshot 2024-02-15 at 11 23 59

After a bit of digging, I worked out what's going on...
When you do:

let clone_ann = { ...ann };

this doesn't do a deep copy. Only a shallow copy.
So the clone_ann.link.parent is not copied. So when you do

clone_ann.link.parent.id = lineage[j].id;

each time in the loop, you are updating the same object.
You need to do a deep copy, and it looks like the easiest is to do:

let clone_ann = JSON.parse(JSON.stringify(ann));

@will-moore will-moore added this to the 6.2.0 milestone Feb 15, 2024
@Tom-TBT
Copy link
Contributor Author

Tom-TBT commented Feb 15, 2024

Thank you Will, I could reproduce the error and your solution fixed it.

Copy link
Member

@will-moore will-moore left a comment

Choose a reason for hiding this comment

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

Works now, thanks LGTM 👍

@will-moore will-moore merged commit e87afd1 into ome:master Feb 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants