Sharing Groovy Scripts

162 views
Skip to first unread message

smca...@lji.org

unread,
Oct 17, 2018, 7:10:51 PM10/17/18
to QuPath users
Hi Pete,
Thank you so much for this software- it's amazing. I've been using it for different types of analysis, and I've written a few little Groovy scripts that others may find helpful, so I wanted to share. 

Cropper.groovy is an easy way to output tifs of small ROIs from a larger slide. QuPath does this faster than some microscope companies' native software. :) For Z stacks, it (optionally) attempts to find the best focused slice (by implementing the Fiji plug-in FindFocusedSlices) and outputs those as a tiff as well. It also renames the ROIs to match the file names, so that it is easy to go back to a specific area. 
DetectionAreaSummary.groovy is a small script to summarize the total area of each classification by adding the cell detection areas by class. It puts the total cell areas in the 1st annotation object (intended to be the tissue detection area).  

The current version of each is attached here, and I will make any updates to my github (https://github.com/saramcardle/Image-Analysis-Scripts/tree/master/QuPath%20Groovy%20Scripts)


Thank you again for this awesome software!
Sara
DetectionAreaSummary.groovy
Cropper.groovy

micros...@gmail.com

unread,
Oct 17, 2018, 8:56:47 PM10/17/18
to QuPath users
Nice!

A couple of things on the detection area:
You might want to make use of the getParent() or getChildObjects() functions.  In the case of getParent(), you could check if they have a class (in the case of building a training set for a classifier) or get the next parent.  That would allow you to generalize it to the first unclassified parent annotation, or go from each annotation to look for cell objects.  TMAs and multiple tissue sections per slide/image can benefit from this.

Using detectionObjects will include both tiles (usually not a problem since tiles and cells don't mesh) and subcellular detections (frequently a problem if looking at cytoplasmic stains).  Subcellular detections are incredibly helpful, and you can avoid including them by using getCellObjects() instead of detections in the first coding line.

I need to spend more time looking into useful ImageJ plugins that can be called in a script.  That looks very useful!

Pete

unread,
Oct 22, 2018, 3:34:27 AM10/22/18
to QuPath users
Thanks for sharing these!
Reply all
Reply to author
Forward
0 new messages