I have started Qupath for my master thesis. I know a little bit coding but I found coding for qupath little bit rough. Therefore, I have a problem to merge two code, not merging but converting.
I want to get overall cell number ( in percentage) in annotations, not in TMAs. I found the code for TMA ;
import qupath.lib.objects.PathCellObject
def hierarchy = getCurrentHierarchy()
def cores = hierarchy.getTMAGrid().getTMACoreList()
def list = ["foxp3", "dapi", "CD8", "CD8+Foxp3", "PDCD1", "PDCD1+CD8", "PDCD1+Foxp3", "PC1+fox+cd8"]
cores.each {
//Find the cell count in this core
def total = hierarchy.getDescendantObjects(it, null, PathCellObject).size()
//Prevent divide by zero errors in empty TMA cores
if (total != 0){
for (className in list) {
def cellType = hierarchy.getDescendantObjects(it,null, PathCellObject).findAll{it.getPathClass() == getPathClass(className)}.size()
it.getMeasurementList().putMeasurement(className+" cell %", cellType/(total)*100)
}
}
else {
for (className in list) {
it.getMeasurementList().putMeasurement(className+" cell %", 0)
}
}
}
SO, Could you help me to change the TMA parts into annotaions? Thank you for help and all the effort