(self, data)
| 99 | self.kwargs = kwargs |
| 100 | |
| 101 | def __call__(self, data): |
| 102 | d = dict(data) |
| 103 | |
| 104 | centroid = d[self.centroid_key] # create mask based on centroid (select nuclei based on centroid) |
| 105 | roi_size = (self.patch_size, self.patch_size) |
| 106 | |
| 107 | for key in self.keys: |
| 108 | img = d[key] |
| 109 | x_start, x_end, y_start, y_end = self.bbox(self.patch_size, centroid, img.shape[-2:]) |
| 110 | cropped = img[:, x_start:x_end, y_start:y_end] |
| 111 | d[key] = SpatialPad(spatial_size=roi_size, **self.kwargs)(cropped) |
| 112 | return d |
| 113 | |
| 114 | def bbox(self, patch_size, centroid, size): |
| 115 | x, y = centroid |
nothing calls this directly
no test coverage detected