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 sample_std parameter to RandGaussianNoise #7425

Closed
bakert1 opened this issue Jan 30, 2024 · 0 comments
Closed

Add sample_std parameter to RandGaussianNoise #7425

bakert1 opened this issue Jan 30, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request Feature request

Comments

@bakert1
Copy link
Contributor

bakert1 commented Jan 30, 2024

Is your feature request related to a problem? Please describe.
The documentation for RandGaussianNoise does not make clear that the standard deviation is sampled uniformly from 0 to std. (at least in my opinion; the doc-string of std reads "Standard deviation (spread) of distribution'). Additionally, it may be useful to have the option to not sample the standard deviation, and just use std as the spread every time.

Describe the solution you'd like
Add a sample_std parameter to RandGaussianNoise. When True, the noise's standard deviation is sampled uniformly from 0 to std (i.e., what is currently done). When False, the noise's standard deviation is non-random and set to std. The default for sample_std would be True for backwards compatibility.

Describe alternatives you've considered
Updating the documentation of RandGaussianNoise to make more clear that the std is being sampled.

Additional context

  • Possible use case of sample_std=False: Adding different levels of random Gaussian noise to images to test the robustness of a registration algorithm to varying levels of Gaussian noise.
  • RandRicianNoise is similar to RandGaussianNoise in concept and implementation. RandRicianNoise already has the proposed sample_std parameter.
  • I'd like to implement this feature request and think it would be a good first issue. I would base the implementation off of RandRicianNoise's implementation.
@KumoLiu KumoLiu added enhancement New feature or request Feature request labels Jan 31, 2024
KumoLiu pushed a commit that referenced this issue Feb 26, 2024
Fixes issue #7425

### Description

Add a `sample_std` parameter to `RandGaussianNoise` and
`RandGaussianNoised`. When True, the Gaussian's standard deviation is
sampled uniformly from 0 to std (i.e., what is currently done). When
False, the noise's standard deviation is non-random and set to std. The
default for sample_std would be True for backwards compatibility.

Changes were based on RandRicianNoise which already has a `sample_std`
parameter and is similar to RandGaussianNoise in concept and
implementation.

### 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).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Timothy Baker <bakertim@umich.edu>
@bakert1 bakert1 closed this as completed Feb 26, 2024
juampatronics pushed a commit to juampatronics/MONAI that referenced this issue Mar 25, 2024
Fixes issue Project-MONAI#7425

### Description

Add a `sample_std` parameter to `RandGaussianNoise` and
`RandGaussianNoised`. When True, the Gaussian's standard deviation is
sampled uniformly from 0 to std (i.e., what is currently done). When
False, the noise's standard deviation is non-random and set to std. The
default for sample_std would be True for backwards compatibility.

Changes were based on RandRicianNoise which already has a `sample_std`
parameter and is similar to RandGaussianNoise in concept and
implementation.

### 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).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Timothy Baker <bakertim@umich.edu>
Signed-off-by: Juan Pablo de la Cruz Gutiérrez <juampatronics@gmail.com>
Yu0610 pushed a commit to Yu0610/MONAI that referenced this issue Apr 11, 2024
Fixes issue Project-MONAI#7425

### Description

Add a `sample_std` parameter to `RandGaussianNoise` and
`RandGaussianNoised`. When True, the Gaussian's standard deviation is
sampled uniformly from 0 to std (i.e., what is currently done). When
False, the noise's standard deviation is non-random and set to std. The
default for sample_std would be True for backwards compatibility.

Changes were based on RandRicianNoise which already has a `sample_std`
parameter and is similar to RandGaussianNoise in concept and
implementation.

### 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).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [x] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Timothy Baker <bakertim@umich.edu>
Signed-off-by: Yu0610 <612410030@alum.ccu.edu.tw>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Feature request
Projects
None yet
Development

No branches or pull requests

2 participants