(self, data: Mapping[Hashable, torch.Tensor])
| 1250 | self.box_rotator = RotateBox90(k, spatial_axes) |
| 1251 | |
| 1252 | def __call__(self, data: Mapping[Hashable, torch.Tensor]) -> Mapping[Hashable, torch.Tensor]: |
| 1253 | d = dict(data) |
| 1254 | for key, box_ref_image_key in zip(self.box_keys, self.box_ref_image_keys): |
| 1255 | spatial_size = list(d[box_ref_image_key].shape[1:]) |
| 1256 | d[key] = self.box_rotator(d[key], spatial_size) |
| 1257 | if self.img_rotator.k % 2 == 1: |
| 1258 | # if k = 1 or 3, spatial_size will be transposed |
| 1259 | spatial_size[self.img_rotator.spatial_axes[0]], spatial_size[self.img_rotator.spatial_axes[1]] = ( |
| 1260 | spatial_size[self.img_rotator.spatial_axes[1]], |
| 1261 | spatial_size[self.img_rotator.spatial_axes[0]], |
| 1262 | ) |
| 1263 | self.push_transform(d, key, extra_info={"spatial_size": spatial_size, "type": "box_key"}) |
| 1264 | |
| 1265 | for key in self.image_keys: |
| 1266 | d[key] = self.img_rotator(d[key]) |
| 1267 | return d |
| 1268 | |
| 1269 | def inverse(self, data: Mapping[Hashable, torch.Tensor]) -> dict[Hashable, torch.Tensor]: |
| 1270 | d = dict(data) |
nothing calls this directly
no test coverage detected