-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: add channel_wise
option for ShiftIntensity
#6789
feat: add channel_wise
option for ShiftIntensity
#6789
Conversation
Signed-off-by: Saurav Maheshkar <[email protected]>
Signed-off-by: Saurav Maheshkar <[email protected]>
""" | ||
|
||
backend = [TransformBackends.TORCH, TransformBackends.NUMPY] | ||
|
||
def __init__(self, offset: float, safe: bool = False) -> None: | ||
def __init__(self, offset: float, safe: bool = False, channel_wise: bool = False) -> None: |
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.
Thank you, please also update the corresponding APIs in https://github.com/Project-MONAI/MONAI/blob/dev/monai/transforms/intensity/dictionary.py and add test cases to the existing unit tests such as https://github.com/Project-MONAI/MONAI/blob/dev/tests/test_shift_intensity.py
return out | ||
if self.channel_wise: | ||
for i, d in enumerate(img): | ||
out = d + offset |
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.
Thanks, but if you don't randomize offset here, the output won't make any difference since offset is a constant.
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.
Ahh yes good catch, any suggestions on how I do this ?
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.
Hi @SauravMaheshkar, I would suggest you refer to this PR.
Thanks!
Hi @SauravMaheshkar, do we have any update on this PR? :) |
Fixes #6629
Description
This PR aims to add the option to perform the
ShiftIntensity
operation in achannel_wise
manner.Types of changes
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests --disttests
.make html
command in thedocs/
folder.