Simple tissue detection and annotations

Hi all,

I’m doing a simple tissue detection, then I detect cells and finally classify them in 2 classes (to get the density of each class per square mm² of tissue).
My expected workflow would be to analyse whole slides and then to let anatomopathologists select regions of interest (either by selecting an area inside tissue detection, either by removing non-analysable artefacts).
But I have two issues.

  • When I substract an annotation to the detected tissue annotation, detected cells inside the substracted area are not removed. Is there something to do ?
    (In fact all cells are considered outside the remaining annotation)
    The same happens when I intersect 2 annotations (my ROI and the Tissue) : cells outside the intersection are not deleted. (and all cells are considered outside).
  • When I draw an annotation inside the tissue detected area, detected cells inside this new annotation are not counted in it (even if they are totally included in).

Did I missed something or is it actually impossible to do ?

Thanks

Nico

Which version are you using?

I’m using milestone 8 version

From a workflow point of view, is there any reason to generate the cells prior to the intersection?
*though that code should work in M8 as well… I think.

Well, I was thinking that if cell detection was not OK, pathologist could exclude the area.
In addition, I think it’s impossible to run simple tissue detection inside an annotation (because to ease the process, Ihad in mind that pathologist could draw only a big rectangle and every tissue inside would be detected automatically).

1 Like

I tested with simple annotations.
I draw one rectangle, detected cells inside and then add a new annotation rectangle completely included inside the first one. Detected cells were kept by the first one and in the hierchy, the second annotation is not a daughter of the first one.
@petebankhead Is this respecing the things said on that page ?

Nico

That is correct as of M6*, I think. The first line of the code deals with that by resolving the hierarchy.
resolveHierarchy()
The second bits remove cells that are outside of them.

toRemove = getCellObjects().findAll{it.getLevel() == 1}
removeObjects(toRemove, true)

It relates to a performance improvement in one of the more recent versions.

1 Like

Ok, that’s it.
I missed this post of Pete.
Maybe a link at the bottom of page https://github.com/qupath/qupath/wiki/Object-hierarchies could be a good thing ?

Regarding the new hierarchy, it’s a good thing, but it may be puzzling in the GUI.
For example, I draw a ROI and classified cells inside. Then I substracted a ROI. The number of cells inside my first ROI disapeared, but it is still in the annotation measurements (and it is correct)

Surprisingly, it didn’t worked. But I didn’t understand why, because I fell the code it correct. Weird !

Anyway, thank you again !

Nico

Level 1 would get rid of all of the cells with no parent objects. If there is yet another annotation above it for some reason, it would need to be Level 2.


So running the script for the above image gives:

However, if I put a box around it, it will do nothing.


Unless I change the script from ==1 to ==2. And then I get:

None of it will work without all three lines of code, though.

Note that v0.2.0 has a ‘selection mode’, which means that detections can be selected (and subsequently deleted) using drawing tools, but without a need to create new annotations: https://www.youtube.com/watch?v=G2ZqLE5QDyk

I think this may be a better way to remove cells corresponding to artifacts, which avoids the need to resolve lots of complex hierarchical relationships (although drawing an annotation & inserting it into the hierarchy remains an option).

The new https://qupath.readthedocs.io/ will be the documentation for v0.2.0 and beyond - I plan to leave the wiki as a reference for v0.1.2.

The new docs are being extensively rewritten and updated. Haven’t had time to re-write the hierarchy bit yet, but will do…

1 Like

I got it. They are not cells anymore, they are detections. That’s why it didn’t work.

1 Like

I know a website that will become my next most-readed site :slight_smile:
It’s true I missed the message on the main page of QuPath’s gitHub with the adress of the docs. Google is still sending to the old version in 1st position when you search for QuPath docs.

Nico

1 Like

@petebankhead , I’m sorry but after seeing this video

I didn’t catch how to select detections with the drawing tools. When I’m doing it, it just draws an annotation…

You have to first click the ‘Selection mode’ button and then select the desired drawing tool to ‘select something’ in the image instead of ‘annotate something’:

3 Likes

This is really a cool tool ! Thanks

Nico

3 Likes