You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix align_corners mismatch in AffineTransform (#8690)
## Summary
- Fixed inconsistent `align_corners` parameter in `AffineTransform`
- The `to_norm_affine` call was using hardcoded `align_corners=False`
while `affine_grid` and `grid_sample` used `self.align_corners` (default
`True`), causing half-pixel offset
- Changed to use `self.align_corners` consistently across the coordinate
transformation pipeline
## Changes
- Modified `monai/networks/layers/spatial_transforms.py` to use
`self.align_corners` instead of hardcoded `False`
- Updated test expected values to reflect correct behavior
- Added test cases to verify `align_corners` consistency
## Test Plan
- All existing tests pass with updated expected values
- New tests verify alignment behavior with both `align_corners=True` and
`align_corners=False`
- Identity affine transforms now produce pixel-perfect outputs
regardless of `align_corners` setting
---------
Signed-off-by: Soumya Snigdha Kundu <soumya_snigdha.kundu@kcl.ac.uk>
0 commit comments