🩹 Support for np.ndarray and WSIReader in PatchPredictor#576
🩹 Support for np.ndarray and WSIReader in PatchPredictor#576blaginin wants to merge 25 commits intoTissueImageAnalytics:developfrom blaginin:feature-wsi-arguments
np.ndarray and WSIReader in PatchPredictor#576Conversation
# Conflicts: # tiatoolbox/wsicore/wsireader.py
Codecov Report
@@ Coverage Diff @@
## develop #576 +/- ##
========================================
Coverage 99.77% 99.77%
========================================
Files 63 63
Lines 6782 6794 +12
Branches 1352 1362 +10
========================================
+ Hits 6767 6779 +12
Misses 7 7
Partials 8 8
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
Hi @blaginin, Please can you break this down into smaller PRs? e.g., introducing blank sample can be a separate PR. Fixing documentation and support for np.ndarry can be separated as well. It will help with review. |
np.ndarray and WSIReader in PatchPredictor
- Pin Pandas Version to `>=2.0.0`
…into feature-wsi-arguments
@shaneahmed excluded extra stuff, as we discussed |
shaneahmed
left a comment
There was a problem hiding this comment.
Added some initial comments.
requirements.txt
Outdated
| pandas>=2.0.0 | ||
| pillow>=9.3.0 | ||
| pydicom>=2.3.1 # Used by wsidicom | ||
| pydicom>=2.3.1 # Used by wsidef test_store_reader_no_types(tmp_path, remote_sample):dicom |
There was a problem hiding this comment.
This is wsidicom dependency.
There was a problem hiding this comment.
Now requirements.txt is identical to develop
|
|
||
| def predict( | ||
| self, | ||
| imgs, |
There was a problem hiding this comment.
Please do not update these as these need to be consistent with SemanticSegmentor and other engines. This will be fixed in redesigned engines #578
tiatoolbox/wsicore/wsireader.py
Outdated
| size: IntPair, | ||
| resolution: Resolution, | ||
| units: str, | ||
| units: Units, |
There was a problem hiding this comment.
These are minor edits which can be done in a separate PR.
tiatoolbox/wsicore/wsireader.py
Outdated
| size: NumPair, | ||
| resolution: Resolution = 0, | ||
| units: str = "level", | ||
| units: Units = "level", |
There was a problem hiding this comment.
Same as above. These kind of edits can be suggested in a separate PR.
# Conflicts: # tests/test_wsireader.py
Co-authored-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
for more information, see https://pre-commit.ci
# Conflicts: # tiatoolbox/models/dataset/classification.py # tiatoolbox/models/engine/patch_predictor.py
|
#635 has restructured |
This PR fixes #532 and improves
PatchPredictorreadability and intuitiveness.What has changed
predictfunction used to disregard user-defined arguments, significantly impacting how the data is processed. Although it sent a warning, this warning can easily drown among the messages from pytorch/torchvision/wsireader/... especially when processing many files at once. Users' direct instructions should be changed only if we are 100% sure about the results. Since it's not the case here, instead of a warning user will receive an exception:I also refactored the code:
WSIPatchDatasetandVirtualWSIReaderboth operated on image-level data via OpenCV. Duplicated logic is removed, and nowWSIPatchDatasetworks with images throughWSIReaderabstraction.Depends on #583