Change class of currently selected annotation in scripts

Is there an easy way to change/set the class of the currently selected annotation in a script? For example, the “dilate annotation” function (see below), creates a new annotation (not selected when done) and only the old annotation is selected after running the script. I wish to chose a different class name for the selected (old) annotation after running this script so that the new annotation is classified as ‘Tumor’ and the old is classified as eg. 'Tumor_not-dilated":

runPlugin('qupath.lib.plugins.objects.DilateAnnotationPlugin', '{"radiusMicrons": 5.0,  "lineCap": "Round",  "removeInterior": false,  "constrainToParent": true}');

You can try


Excellent, Pete, it worked. Thank you so much, again!

1 Like