tiatoolbox icon indicating copy to clipboard operation
tiatoolbox copied to clipboard

πŸ†• Use Annotations as a Filter for Patch Extraction

Open measty opened this issue 1 year ago β€’ 1 comments

This PR is something i've been thinking about from a conversation with Daan when he was here from Radboud doing a seminar a while back. His comment was that one thing some of his colleges felt was missing in TIAtoolbox was ability to get patches filtered by class/label.

Its not that hard to set up tiatoolbox patch extractor to allow this, which is what i've added in this PR.

it allows you to provide a path to an annotation store as the mask. By default the mask will then be built out of all the annotations, but you can also provide any filter that works in the annotation store, and have only those annotations make the mask. So for example, if you have some pathologist annotations with some regions, and you only want to extract patches which have some overlap with regions labelled 'tumor' or whatever, you would just have to provide the appropriate string ("props['label'] == 'tumor'" for example).

measty avatar Jun 13 '24 18:06 measty

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.86%. Comparing base (52792bc) to head (62f3566). Report is 17 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #822   +/-   ##
========================================
  Coverage    99.86%   99.86%           
========================================
  Files           69       69           
  Lines         8656     8664    +8     
  Branches      1653     1654    +1     
========================================
+ Hits          8644     8652    +8     
  Misses           4        4           
  Partials         8        8           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jun 13 '24 18:06 codecov[bot]

Check out this pull request onΒ  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Thanks @measty

@mostafajahanifar Please can you review this PR so we can merge this.

shaneahmed avatar Aug 21 '24 10:08 shaneahmed

@mostafajahanifar I have updated the file.

shaneahmed avatar Aug 23 '24 12:08 shaneahmed

View / edit / reply to this conversation on ReviewNB

mostafajahanifar commented on 2024-08-30T18:02:03Z ----------------------------------------------------------------

Link of documentaiotn is better to be to the main repo instead of the develop


View / edit / reply to this conversation on ReviewNB

mostafajahanifar commented on 2024-08-30T18:02:04Z ----------------------------------------------------------------

Line #3.    pip install git+https://github.com/TissueImageAnalytics/tiatoolbox.git@patch-extractor-filter | tail -n 1

Just make sure you change this installation back to the main repo before merging.


View / edit / reply to this conversation on ReviewNB

mostafajahanifar commented on 2024-08-30T18:02:05Z ----------------------------------------------------------------

if you want, you can also add a reference to tissue masking example notebook here in the paranthesis in the first sentence.

... wsi through a simple otsu threshold approach (for more information on tissue masking, please see tiatoolbox/examples/03-tissue-masking.ipynb at master Β· TissueImageAnalytics/tiatoolbox (github.com))