-
Notifications
You must be signed in to change notification settings - Fork 101
🩹 Support for np.ndarray and WSIReader in PatchPredictor
#576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🩹 Support for np.ndarray and WSIReader in PatchPredictor
#576
Conversation
# 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wsidicom dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now requirements.txt is identical to develop
|
|
||
| def predict( | ||
| self, | ||
| imgs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are minor edits which can be done in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to #598
tiatoolbox/wsicore/wsireader.py
Outdated
| size: NumPair, | ||
| resolution: Resolution = 0, | ||
| units: str = "level", | ||
| units: Units = "level", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above. These kind of edits can be suggested in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to #598
# Conflicts: # tests/test_wsireader.py
Co-authored-by: Shan E Ahmed Raza <[email protected]>
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