Hi all!
I’m new to QuPath and am struggling with a couple of specific things. The first of these is selecting specific annotations by name. I can use selectAnnotations() to select all annotations on an image, however haven’t worked out what I need to input in the brackets to select, for example, annotations named “Tile 3” and “Tile 47”.
I hope that makes sense so far, but in case it doesn’t some context which will hopefully clarify. I have an IHC stained breast tissue slide, have checked the image type is H-DAB and changed the stain vectors. I then use simple tissue detection, which produces one annotation outlining the whole area of tissue. I then create tiles within this annotation, making each of these tiles an annotation in itself. Then, I’m using this:
n=nObjects()-1
Random rnd = new Random()
a=("Tile “+rnd.nextInt(n)+”; Tile “+rnd.nextInt(n)+”; Tile “+rnd.nextInt(n)+”; Tile “+rnd.nextInt(n)+”; Tile “+rnd.nextInt(n)+”; Tile “+rnd.nextInt(n)+”; Tile “+rnd.nextInt(n)+”; Tile “+rnd.nextInt(n)+”; Tile “+rnd.nextInt(n)+”; Tile "+rnd.nextInt(n))
print(a)
to count the number of annotations and subtract 1 (giving me the number of tiles, by subtracting the annotation of the whole tissue section) and generate 10 random integers between 1 and this maximum value (the number of tiles). a therefore is a list, which ends up looking something like:
Tile 772; Tile 565; Tile 473; Tile 558; Tile 860; Tile 1356; Tile 480; Tile 806; Tile 452; Tile 810
What I need to do from here, is create a script which selects only these annotations. I think the issue I’m having is I don’t know how to specify that when I type “Tile 772” this is the name of the annotation.
From here, I am going to run positive cell detection in only these selected tiles (saving me from running it on the whole slide - and I have ~500 slides in total…my laptop wouldn’t survive!) to give % positive cells for each image.
I hope this all makes sense - please ask me to clarify anything if needed! As I say, I’m new to QuPath, and I’m not the most technologically literate, but I’m trying my best!
Morven