Commit 3b7f055
Fix RandomAnisotropy with copy=False producing wrong shape
Capture spatial_shape and affine as values before downsampling instead
of reading them from the (now-mutated) image reference afterward.
When copy=False, the downsample Resample modifies the image in-place,
so the previously captured reference already reflects the downsampled
state by the time the upsample target is constructed. This caused the
upsample to be a no-op, leaving images at the smaller shape.
Closes #1436
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 3318645 commit 3b7f055
2 files changed
Lines changed: 19 additions & 1 deletion
File tree
- src/torchio/transforms/augmentation/spatial
- tests/transforms/augmentation
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
121 | | - | |
| 123 | + | |
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
49 | 65 | | |
50 | 66 | | |
51 | 67 | | |
| |||
0 commit comments