Repository navigation
Commit e0cee14
Fix unspecified spatial size for rank-one resampling and add NIfTI regression tests (#9191)
Related to #9166.
### Description
The current dev branch already includes the image writer spatial-rank
fix.
This PR handles the remaining rank-one case in spatial_resample:
when spatial_size is None, use the input spatial size instead of
passing None to the size validation predicate.
Regression tests cover:
- Writing channel-less 2D and 3D NIfTI images without an original
affine or output spatial shape, checking shape, voxel values,
and affine.
- Eager and lazy rank-one resampling with spatial_size=None and -1.
### Types of changes
- [x] Non-breaking bug fix.
- [x] New tests added to cover the changes.
### Validation
Ran the following related test modules:
python -B -m unittest tests.data.test_nifti_rw
tests.transforms.test_spatial_resample
tests.transforms.spatial.test_spatial_resampled
tests.transforms.test_resample_to_match
tests.transforms.test_resample_to_matchd
Result: 195 tests run, OK (6 skipped).
Full integration and quick test suites were not run.
AI assistance: OpenAI Codex assisted with implementation,
testing, and preparation of this description.
---------
Signed-off-by: moonbirdyang <kirito168888@gmail.com>
Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>1 parent 08dedf9 commit e0cee14
3 files changed
Lines changed: 39 additions & 2 deletions
File tree
- monai/transforms/spatial
- tests
- data
- transforms
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
166 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
167 | 170 | | |
168 | 171 | | |
169 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
252 | 272 | | |
253 | 273 | | |
254 | 274 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
225 | 239 | | |
226 | 240 | | |
227 | 241 | | |
| |||
0 commit comments