Creating tiles misses part of annotation

My goal is to convert all annotated areas to tiles. As seen in the above picture, creating tiles misses many edges of the annotation. I need to make squares even if there is only a little bit of annotation in it. I can’t use Trim to ROI because I need all the tiles to be the same square size. Thank you for your help.

Perhaps a better approach would be to tile the whole slide. For example, the whole picture shown above would be cut into tiles from left to right and top to bottom fully. Then I would check for annotation tiles that overlap with the hand drawn annotations, converting the overlapping annotation tiles into a new category of annotation.

1 Like

The Create tiles command includes a text for whether the centroid of the tile falls inside the annotation before deciding whether to keep/discard it.

It’s questionable whether this test is always a good idea, and perhaps the command should be replaced in a future version… but at least that explains the current behavior.

I’m not totally sure what your question is, because I don’t really know what your end goal is. Can you clarify this?

Okay, that is good to know thank you. The goal is to make a dataset of tiles that have a certain type of tissue, found from hand drawn annotations.

My biggest issue right now is to figure out the best way to make the tiles. If I tile the whole tissue slide from left to right and top to bottom, it may cause some tiles at the right edge and bottom edge to not be the same size as all the others or get lost.

My current thought is to tile the desired tissue first and then tile the inverse, to make sure to pick up all the wanted areas. If I remove the centroid test do you think it should work properly? Thanks again.

@path check out https://qupath.readthedocs.io/en/latest/docs/advanced/exporting_annotations.html

This would allow you to export tiles across the image at any resolution and corresponding masks of the annotations. From this you could then calculate elsewhere (e.g. in Python) the proportion of each tile with a corresponding class annotation – and decide at that point whether or not the tile is positive for the class.

Lots of options to adjust the script depending upon what you want, e.g. to include/exclude incomplete tiles, overlap tiles, exclude tiles that contain no annotated pixels.

It works properly now, depending upon your definition of ‘properly’ :wink:
Your definitions will need to be very precise: e.g. if you exclude the centroid test, what is a single pixel of a tile is annotation – should it be classified or not? Somewhere you will need to apply some logic to this.

I’d suggest trying the above suggestion with the tile exporter first.

2 Likes