Closed Tom-TBT closed 9 months ago
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.
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));
Thank you Will, I could reproduce the error and your solution fixed it.
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.