Created
March 4, 2022 13:57
-
-
Save jurgenizer/93816d828cb7c6605c439595fc13d3e3 to your computer and use it in GitHub Desktop.
A very simple script to add a name to each annotation in an image in QuPath. Each name is suffixed with an incrementing number.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Probably based on something from here: https://forum.image.sc/tag/qupath | |
OR | |
something from here: https://gist.github.com/Svidro | |
Thank You! | |
*/ | |
hierarchy = getCurrentHierarchy() | |
def imageName = getProjectEntry().getImageName() | |
int annotationNumber = 1 | |
for (annotation in getAnnotationObjects()) { | |
hierarchy.getSelectionModel().clearSelection(); | |
selectObjects{p -> p == annotation} | |
// name your annotation anything you like | |
def annotationName = 'TISSUE-' | |
// add the annotation's number as a suffix | |
annotation.setName(imageName + ' ' + annotationName + annotationNumber) | |
annotationNumber += 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment