New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scripting: export tiles within annotation? #62
Comments
You should get null for any tiles or annotations with no class set, and Tumor, or whatever class is set for any annotations with a set class. If the tiles do not have a class, they will return null. If the tiles are detections, and have a parent annotation with a class name, you should be able to use something like for all detections, p= detection.getParent() followed by p.getPathClass() being assigned to a value in order to find out what the parent annotation's class was. I am not sure this works if you have converted all of the tiles to annotations (maybe it does!). |
Peter also had an imageJ script which might be useful to you in his fourth option on one of the lower responses in this topic. I have run into some issues handling names as well, apparently the names are frequently dynamically generated based on the class, so the getName function behaves oddly. Please let me know if you find a workable solution! |
Thanks Svidro, the getParent() idea seems to be working. I will update this thread with the full script once I have tile export working. |
I have it all working now, here is the full script for future reference:
The one remaining minor issue is that, in addition to the tiles, the containing annotation region is saved. |
It seems like the easiest way to resolve the minor issue would be swapping the for loop/tiles to detections, if that works with the imagewritertools. |
I modified the body of the loop as follows, which seems to work for now:
I guess you could also explicitly check the enclosing annotation type, like:
|
I'd like to use QuPath to generate training data for a deep learning model. I am annotating various features (let's say, tumor and stroma), and generating tiles within the annotated regions via Analyze -> Region identification -> Tiles & superpixels -> Create tiles. So far so good. Next I want to export the tiles as separate images, generating a file name according to the enclosing annotation name (e.g. "tumor_tile01.tiff"). I would have thought the following code would give me the enclosing annotation name:
for (annotation in getAnnotationObjects()) {
pathClass = annotation.getPathClass()
print(pathClass)
}
But instead the console prints (a bunch of times):
INFO: null
Any suggestions would be appreciated.
The text was updated successfully, but these errors were encountered: