コード例 #1
0
 def __init__(self, keys: KeysCollection, k: int = 1, spatial_axes: Tuple[int, int] = (0, 1)) -> None:
     """
     Args:
         k: number of times to rotate by 90 degrees.
         spatial_axes: 2 int numbers, defines the plane to rotate with 2 spatial axes.
             Default: (0, 1), this is the first two axis in spatial dimensions.
     """
     super().__init__(keys)
     self.rotator = Rotate90(k, spatial_axes)
コード例 #2
0
 def __init__(self, keys, k=1, spatial_axes=(0, 1)):
     """
     Args:
         k (int): number of times to rotate by 90 degrees.
         spatial_axes (2 ints): defines the plane to rotate with 2 spatial axes.
             Default: (0, 1), this is the first two axis in spatial dimensions.
     """
     super().__init__(keys)
     self.rotator = Rotate90(k, spatial_axes)
コード例 #3
0
    def __call__(self, data: Mapping[Hashable, np.ndarray]) -> Mapping[Hashable, np.ndarray]:
        self.randomize()
        if not self._do_transform:
            return data

        rotator = Rotate90(self._rand_k, self.spatial_axes)
        d = dict(data)
        for key in self.keys:
            d[key] = rotator(d[key])
        return d
コード例 #4
0
ファイル: dictionary.py プロジェクト: mvsaraiva/MONAI
    def __call__(self, data):
        self.randomize()
        if not self._do_transform:
            return data

        rotator = Rotate90(self._rand_k, self.spatial_axes)
        d = dict(data)
        for key in self.keys:
            d[key] = rotator(d[key])
        return d