Delaunay by class

Dear all,

May I ask you a question about Delaunay spatial analysis, please?
I have 4 different classes in cell detections. I would like to measure the distance between two specific classes. For example, the distance between “Tumor” and “Stroma”.

What should I add more in below, please?
Thanks a lot

selectDetections();
getDetectionObjects().findAll{it.getParent().getPathClass() == getPathClass("Tumor")}
runPlugin('qupath.opencv.features.DelaunayClusteringPlugin', '{"distanceThresholdMicrons": 0.0,  "limitByClass": false,  "addClusterMeasurements": true}');



You may be better off using the Spatial analysis → “Detect centroid distances 2D” and removing measurements you don’t want. It would likely be quicker. If you remove the measurements once, it does show up in the Workflow as code.
I vaguely recall there was a way to cluster specific sets (other than removing all cells of the other types and replacing them), but I am not sure where it is right now, and there are easier alternatives.

1 Like

Thanks for your prompt reply.
However, I have got a few annotations which has 4 different detection classes under.
I have just tried it but it is not something I would like to do.

Is there a way to measure the distance between tumour cells and stroma cells. Thanks a lot

The above mentioned way IS the way to measure the distance between tumor cells and stroma cells. If that is not working for you, you probably will need to explain why, and more clearly what you are trying to accomplish.
Maybe you are looking for distances within classes rather than between classes (you keep stating between classes)?

1 Like

Dear @Research_Associate

Thank you so much for your help.
I have resolved the hierachy and got the spatial analysis according to your advice.
Thanks again,

In Hwa

1 Like