Commit 49b1012
authored
fix(apps/nuclick): replace np.random.choice with self.R.choice in Add… (#8836)
Fixes #6888 (partial) - follow-up to #8798
### Description
In `AddPointGuidanceSignald.exclusion_map`
(`monai/apps/nuclick/transforms.py`), two calls used `np.random.choice`
(global NumPy random state) instead of `self.R.choice`. Since
`AddPointGuidanceSignald` already inherits from `Randomizable`, this is
a straightforward replacement that ensures reproducibility when
`set_determinism()` or manual seeding is used.
**Before:**
```python
if np.random.choice([True, False], p=[drop_rate, 1 - drop_rate]):
```
**After:**
```python
if self.R.choice([True, False], p=[drop_rate, 1 - drop_rate]):
```
PR #8798 already fixed `np.random.*` calls in transforms and data
utilities. This PR continues that work for the two remaining calls in
`apps/nuclick/transforms.py` mentioned in #6888.
### Types of changes
- [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: Zeeshan Modi <92383127+Zeesejo@users.noreply.github.com>1 parent 71f16ed commit 49b1012
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
377 | | - | |
| 377 | + | |
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
| |||
0 commit comments