Subcellular detection - exporting results per cell type

Hello everyone,
Thanks to m9 Qupath I was able to detect particles in 3 cell classes by following: cell segmentation-pixel classification -subcellular detection. My goal is to check a total number of particles in each cell type, and mean number of particles per cell. The results show only total number of detected particles and number of cells per type.
Is there any way to set up these parameters in the QuPath results?

I don’t think there is built in, but there are many examples scattered about the forums for creating scripts that will accomplish something similar to what you want. You will have to adjust them yourself or provide more information on your workflow, but the method is relatively straightforward. Cycle through each cell, sum up the total number of subcellular detections, and divide by the number of cells. You will need somewhere to store that information, and I have usually made that the parent annotation (tissue, TMA, etc)

There are other posts related more specifically to subcellular detection scripts to do things like classify cells as 1,2,3,4,5+ depending on the number of spots estimated, which can allow for some interesting summary statistics, especially when combined with location/distance data.

Thank you for your pointers. I managed to get what I needed with some extra scripting.

Here is the script in case it may be of help to others

    def myMatrix = new Integer[3][20]              
    for (detection in getDetectionObjects()) {
        String cellClass = detection.getPathClass().toString()
        int singleCells = measurement(detection, "Subcellular: Channel 4: Num single spots")
        switch (detection.getPathClass().toString()) {
            case "Tumor":
                if (myMatrix[0][singleCells] == null) {
                    myMatrix[0][singleCells] = 0
                myMatrix[0][singleCells] = myMatrix[0][singleCells] + 1
            case "CD19":
                if (myMatrix[1][singleCells] == null) {
                    myMatrix[1][singleCells] = 0
                myMatrix[1][singleCells] = myMatrix[1][singleCells] + 1
            case "Other":
                if (myMatrix[2][singleCells] == null) {
                    myMatrix[2][singleCells] = 0
                myMatrix[2][singleCells] = myMatrix[2][singleCells] + 1

println("Tumor " + myMatrix[0])            
println("CD19 " + myMatrix[1])            
println("Other " + myMatrix[2]) 

If you have three classes of cells that do not include the subcellular objects, you can go through only cell objects by using getCellObjects() rather than getDetectionObjects().

For each cell object, you can cycle through subcellular objects by using getChildObjects()