Commit 03338b2
Improve Affine transform documentation and add compute_w_affine tests (#8727)
## Summary
This PR improves the documentation for the `Affine` transform and adds
unit tests for the `compute_w_affine` method.
Fixes #7092
## Changes
### Documentation improvements (`monai/transforms/spatial/array.py`)
- **Added Note section** to `Affine` class documenting the center-origin
coordinate system assumption
- **Clarified `normalized` parameter** documentation with user-friendly
explanation
- **Added comprehensive docstring** to `compute_w_affine` classmethod
(previously undocumented)
### Unit tests (`tests/transforms/test_affine.py`)
- Added `TestComputeWAffine` test class with focused tests:
- 2D/3D identity matrix with same input/output size
- Different input/output sizes with expected translation offsets
- Output shape validation
- Torch tensor input compatibility
## Verification
- All existing Affine tests pass (no regressions)
- All new `compute_w_affine` tests pass
- Documentation matches actual code logic
## Type of change
- [x] Documentation improvement
- [x] Test coverage improvement
- [ ] Breaking change
Signed-off-by: Mohamed Salah <eng.mohamed.tawab@gmail.com>
Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>1 parent 26326b5 commit 03338b2
2 files changed
Lines changed: 74 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2189 | 2189 | | |
2190 | 2190 | | |
2191 | 2191 | | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
2192 | 2199 | | |
2193 | 2200 | | |
2194 | 2201 | | |
| |||
2251 | 2258 | | |
2252 | 2259 | | |
2253 | 2260 | | |
2254 | | - | |
2255 | | - | |
2256 | | - | |
2257 | | - | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
2258 | 2267 | | |
2259 | 2268 | | |
2260 | 2269 | | |
| |||
2346 | 2355 | | |
2347 | 2356 | | |
2348 | 2357 | | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
2349 | 2377 | | |
2350 | 2378 | | |
2351 | 2379 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
202 | 244 | | |
203 | 245 | | |
204 | 246 | | |
| |||
0 commit comments