(self, patch_size, centroid, size)
| 112 | return d |
| 113 | |
| 114 | def bbox(self, patch_size, centroid, size): |
| 115 | x, y = centroid |
| 116 | m, n = size |
| 117 | |
| 118 | x_start = int(max(x - patch_size / 2, 0)) |
| 119 | y_start = int(max(y - patch_size / 2, 0)) |
| 120 | x_end = x_start + patch_size |
| 121 | y_end = y_start + patch_size |
| 122 | if x_end > m: |
| 123 | x_end = m |
| 124 | x_start = m - patch_size |
| 125 | if y_end > n: |
| 126 | y_end = n |
| 127 | y_start = n - patch_size |
| 128 | return x_start, x_end, y_start, y_end |
| 129 | |
| 130 | |
| 131 | class SplitLabeld(MapTransform): |