Batch export measurement annotations

409 views
Skip to first unread message

Al

unread,
Feb 20, 2018, 2:12:15 PM2/20/18
to QuPath users
Hi, I've set up a project with slidescanner images which I have manually selected whole sections as annotations. I already have a script to detect positive cells but I want to export the annotation measurements into a single txt document where each line is a different annotation (from a different slide/image). Ideally each line will be labelled with the name of the slide/image also. Is this possible to do in Qupath?
Thanks, Al  
p.s. I already know how to make a txt file with the image name for each section/image annotation https://github.com/qupath/qupath/issues/25   
p.p.s. thanks for creating and sharing Qupath, its great!

micros...@gmail.com

unread,
Feb 20, 2018, 2:20:58 PM2/20/18
to QuPath users
I am not sure about QuPath scripting, but it is certainly possible to do using an R script run after the QuPath script. 
See: https://github.com/qupath/qupath/issues/79

Better yet, you can run both the R script and the QuPath script from the command line, if you want to automate the whole thing.  Or you could have a QuPath script that calls the R script on your data folder, and run it after the QuPath cell detection script is done.  There are several other posts here about running QuPath from the command line without opening it, and I have a few examples of calling python scripts from the command line within QuPath that could be modified to work on an R script.

Pete

unread,
Feb 20, 2018, 3:18:08 PM2/20/18
to QuPath users
I should really have done this a long time ago (sorry David!), but here's a script you can try:

Hopefully it does what you want.  It assumes that your annotation results tables have already been exported to a directory - there's a recipe for doing that at https://gist.github.com/petebankhead/a473b817eac36caabdffc21daf93231d

micros...@gmail.com

unread,
Feb 20, 2018, 4:53:00 PM2/20/18
to QuPath users
Something for the new version maybe? ^_^

Al

unread,
Feb 21, 2018, 5:30:57 AM2/21/18
to QuPath users
Perfect, Qupath script works a charm, thank you very much indeed Pete!
Reply all
Reply to author
Forward
0 new messages