Exporting Tiles as Images

Hey all,
I am trying to script in groovy with the newest QuPath version (0.2.0-m9) and ran into an issue when trying to simply loop through annotations. I have a project with 2 test images. One of these has 2 annotations and one of the annotations has cell detections in it. I want to loop through the hierarchy and print something as a test that it does go through the annotations (see below):

def project = getProject()
i = 0;
for (entry in project.getImageList()) {
    def hierarchy = entry.readHierarchy();
    def annotations = hierarchy.getAnnotationObjects();
    for (annotation in hierarchy.getAnnotationObjects()){

Instead of getting print results I get nothing, indicating that the hierarchy is not detected for some reason:

INFO: Project: test-project
INFO: Hierarchy: 0 objects
INFO: Hierarchy: 0 objects

Am I missing something trivial? It doesn’t seem to work both if the annotations are selected and not. Any help with resolving this would be much appreciated!

Random check, but is there any chance you are currently working on the image with the two annotations, and you have not saved it yet? The temporary data you are accessing through the viewer will not, I think, show up when you try to use project.getImageList() if no data is saved yet.

Thank you so much, seems to work fine after saving!

1 Like