-
Notifications
You must be signed in to change notification settings - Fork 240
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
Add Mask transform #527
Add Mask transform #527
Conversation
Codecov Report
@@ Coverage Diff @@
## master #527 +/- ##
==========================================
+ Coverage 96.68% 96.83% +0.15%
==========================================
Files 120 122 +2
Lines 6279 6358 +79
==========================================
+ Hits 6071 6157 +86
+ Misses 208 201 -7
Continue to review full report at Codecov.
|
Hi, @Svdvoort. This looks good. I have added some changes. I suspect the labels features might not be working. I tried this code (also tried it before my changes) unsuccessfully: import torchio as tio
colin = tio.datasets.Colin27(2008)
mask = tio.Mask(masking_method='cls', labels=[1, 2, 3, 12])
masked = mask(colin)
masked.plot() I'll try to add a failing test. |
Is there maybe a copy-paste issue inside |
After some testing I think it's due to the way Is it intended that the returned mask is only boolean? If so what do you propose as an alternate solution to get the |
You are right, thanks for investigating.
I think it makes sense that |
With this However, if the underlying assumption is always that the function should return a binary image then I agree with the first approach. |
I think it's safe to assume that a binary image is returned. We can modify the behavior later on, if new use cases are needed. |
I've added an option to return a binary mask from only the requested labels, and updated this in the |
Thanks! I'll fix the conflict and merge ASAP. |
Thanks for your contribution, @Svdvoort! @all-contributors please add @Svdvoort for code |
I've put up a pull request to add @Svdvoort! 🎉 |
Fixes #521.
Description
Preprocessing option to set values outside of a LabelMap to a constant value (0 by default).
Also allows to select the specific Labels from the LabelMap that should be considered 'foreground' in case there are multiple Labels.
Checklist
CONTRIBUTING
docs and have a developer setup (especially important arepre-commit
andpytest
)pytest
make html
inside thedocs/
folder