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

Add channel_wise option to RandShiftIntensity and RandScaleIntensity #6629

Closed
philnovv opened this issue Jun 19, 2023 · 3 comments · Fixed by #7025
Closed

Add channel_wise option to RandShiftIntensity and RandScaleIntensity #6629

philnovv opened this issue Jun 19, 2023 · 3 comments · Fixed by #7025

Comments

@philnovv
Copy link

philnovv commented Jun 19, 2023

It is very common practice to independently augment intensities of separate modalities. Yet currently RandShiftIntensity and RandScaleIntensity do not have this option, and instead randomly shift/scale along all channels at once.

It is noteworthy that RandStdShiftIntensity has a "channel_wise" option to do just this. I suggest we add a similar option to RandShiftIntensity and RandScaleIntensity.

@KumoLiu
Copy link
Contributor

KumoLiu commented Jun 28, 2023

Hi @philnovv, I think for RandScaleIntensity and RandShiftIntensity since we will randomly choose a factor or offset then no matter do it channel_wise or not, the result will be the same. Or do you mean randomly select a factor or offset for each channel?
If I have misunderstood, just correct me.
Thanks!

@philnovv
Copy link
Author

Hi @KumoLiu, the latter is what I mean. The option to randomly select and apply a factor/offset for each channel would be (I think) more closely aligned with standard practice.

@philnovv
Copy link
Author

BTW this applies to all intensity-based augmentation transforms. For example we may want to apply random blurring with an independent blurring kernel for each channel. This makes sense as an augmentation strategy because the different contrasts in real-world multi-contrast images are often acquired with very different resolutions/slice thicknesses etc...

wyli pushed a commit that referenced this issue Jul 28, 2023
Part of #6629 .

### Description
Add `channel_wise` in `RandScaleIntensity` and `RandScaleIntensityd`.


### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] 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.

---------

Signed-off-by: KumoLiu <yunl@nvidia.com>
KumoLiu added a commit to KumoLiu/MONAI that referenced this issue Sep 22, 2023
Signed-off-by: KumoLiu <yunl@nvidia.com>
wyli pushed a commit that referenced this issue Sep 22, 2023
Fixes #6629.

### Description

Add `channel_wise` in `RandShiftIntensity` and `RandShiftIntensityd`.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] 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.

---------

Signed-off-by: KumoLiu <yunl@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants