Commit e8a5344
Fix ClipIntensityPercentiles metadata accumulation (Project-MONAI#9003)
### Description
`ClipIntensityPercentiles` stored returned clipping values on the
transform instance. Reusing the same transform therefore accumulated
values from earlier calls and also mutated the metadata of earlier
outputs.
This change keeps the clipping-value accumulator local to each
`__call__`. Each result now receives only its own clipping values, and
later calls cannot change metadata already returned to a caller.
Regression tests cover repeated channel-wise and non-channel-wise calls.
### 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).
- [x] 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.
### Testing
- `python -m unittest tests.transforms.test_clip_intensity_percentiles
tests.transforms.test_clip_intensity_percentilesd` — 96 tests passed
- `python -m ruff check monai/transforms/intensity/array.py
tests/transforms/test_clip_intensity_percentiles.py`
- `python -m black --check monai/transforms/intensity/array.py
tests/transforms/test_clip_intensity_percentiles.py`
Signed-off-by: Mohamed Abdeltawab <mohamed.abdeltawab@integrant.com>
Co-authored-by: Mohamed Abdeltawab <mohamed.abdeltawab@integrant.com>1 parent c1240a2 commit e8a5344
2 files changed
Lines changed: 34 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1128 | 1128 | | |
1129 | 1129 | | |
1130 | 1130 | | |
1131 | | - | |
1132 | | - | |
1133 | 1131 | | |
1134 | 1132 | | |
1135 | 1133 | | |
1136 | | - | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
1137 | 1137 | | |
1138 | 1138 | | |
1139 | 1139 | | |
| |||
1143 | 1143 | | |
1144 | 1144 | | |
1145 | 1145 | | |
1146 | | - | |
1147 | | - | |
| 1146 | + | |
| 1147 | + | |
1148 | 1148 | | |
1149 | 1149 | | |
1150 | 1150 | | |
| |||
1165 | 1165 | | |
1166 | 1166 | | |
1167 | 1167 | | |
| 1168 | + | |
1168 | 1169 | | |
1169 | 1170 | | |
1170 | 1171 | | |
1171 | | - | |
| 1172 | + | |
1172 | 1173 | | |
1173 | | - | |
| 1174 | + | |
1174 | 1175 | | |
1175 | 1176 | | |
1176 | | - | |
1177 | | - | |
| 1177 | + | |
| 1178 | + | |
1178 | 1179 | | |
1179 | 1180 | | |
1180 | 1181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
195 | 219 | | |
196 | 220 | | |
0 commit comments