Coordinates for detected cells QuPath

Hi! I have made a classifier to detect certain cell types (tumor cells, inflammatory cells) and I wonder if it is possible to get the coordinates for the detected cell types to analyse the distribution or growth pattern?

Best regards


Here are some ways to export measurements for detections

In the GUI
Measure->-Show detections measurements->Copy to clipboard->Paste in your preferred data table program (like excel)

Script via built in function

def  pathToOutput = "where you want to put it"
saveDetectionMeasurements(pathToOutput, )

If you are in a project pathToOutput could be QPEx.PROJECT_BASE_DIR in order to output in the project base directory. You could also build your own subfolders from the base directory.

Custom script

def detections = getAllObjects().findAll{it.isDetection() && it.getPathClass()==getPathClass("your desired class")}
//perform some operations on all detections to build an output

Obviously the custom script gives the most flexible output, but is also the most involved when it comes to scripting.


Yep! One other thing that has helped me keep the detection export files a bit cleaner is selecting only the columns of interest for export, as below.

def path = buildFilePath(PROJECT_BASE_DIR, 'detections.txt')
saveDetectionMeasurements(path, "Class", "Centroid X µm", "Centroid Y µm")

And since I was at Pete’s blog for something else, here is his post that shows using the image name to generate the output file name. For annotations, but you can adapt per the scripts above.