Cell type classification with QuPath

285 views
Skip to first unread message

lingd...@tempus.com

unread,
Nov 14, 2017, 3:28:34 PM11/14/17
to QuPath users
Hi All,

I'm working on a project doing cancer cell type classification.

I have used QuPath to detect cells and generate 34 features for each cell, later, I used sklearn packages to train and validate on those data and got a pretty good classifier.

My Question is:
Is it possible to load this classifier as a feature into QuPath? I would like to generate heat map on testing slides in qupath based on this classifier.

If not, can I load the testing probability into QuPath to generate heat map?

Thanks

micros...@gmail.com

unread,
Nov 14, 2017, 5:54:07 PM11/14/17
to QuPath users
I can't do a great job of answering this question, but I can address some parts!
First of all, everything I know about using sklearn I read at: https://github.com/qupath/qupath/wiki/Working-with-Python
And second of all, you can definitely create and use any value you want with the heatmap function, you just need to use something like:

import qupath.lib.scripting.QP
for (def cell : QP.getDetectionObjects()) {

def ml = cell.getMeasurementList()

ml
.putMeasurement("Measurement1", 0)
ml
.putMeasurement("Measurement2", SomeNumericVariable)            
ml
.closeList()

}
QP
.getCurrentHierarchy().fireHierarchyChangedEvent(this)
println
("Done")


Which cycles through all of the cells and adds your measurement to the cell.  Loading the correct measurement from outside of QuPath into the correct cell in QuPath might be slightly trickier, but if you just created a new measurement called "Count" and used putMeasurement to increment over all cells, you shouldn't have any trouble matching the cells back up with their probabilities.  XY centroids could also be used.

lingd...@tempus.com

unread,
Dec 6, 2017, 2:52:37 PM12/6/17
to QuPath users
Thanks for helping. This helps a lot in my second question.

David

unread,
Dec 7, 2017, 1:00:07 PM12/7/17
to QuPath users
Hi,

i am not so shure if i got the question right.
But if yes, this might help. To get a heatmap for Cancer probability, to to menu "Measure" then "Show measurement maps".
Scroll down to the entry "Class probability". Select it and observe the heatmap in the image.



Is it that what you look for?

Here an example:
   

right image is the class probability for tumor. Red means, the classifier is 100% shure it is tumor.




Auto Generated Inline Image 1
Auto Generated Inline Image 2
Auto Generated Inline Image 3
Auto Generated Inline Image 4
Reply all
Reply to author
Forward
0 new messages