Skip to content
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

Closed
wants to merge 5 commits into from
Closed

feat: add channel_wise option for ShiftIntensity #6789

wants to merge 5 commits into from

Conversation

SauravMaheshkar
Copy link
Contributor

@SauravMaheshkar SauravMaheshkar commented Jul 27, 2023

Fixes #6629

Description

This PR aims to add the option to perform the ShiftIntensity operation in a channel_wise manner.

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

"""

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:
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor Author

@SauravMaheshkar SauravMaheshkar Jul 28, 2023

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 ?

Copy link
Contributor

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!

@KumoLiu
Copy link
Contributor

KumoLiu commented Aug 8, 2023

Hi @SauravMaheshkar, do we have any update on this PR? :)

@SauravMaheshkar SauravMaheshkar deleted the saurav/channel-wise branch August 20, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add channel_wise option to RandShiftIntensity and RandScaleIntensity
3 participants