def test_inverse_transform(self):
     image, coords, h, w = self.randomData(h=5, w=8)
     rot = RotationTransform(h, w, 90, expand=True, center=None)
     rot_image = rot.apply_image(image)
     self.assertEqualsArrays(rot.inverse().apply_image(rot_image), image)
     rot = RotationTransform(h, w, 65, expand=True, center=None)
     rotated_coords = rot.apply_coords(coords)
     self.assertEqualsArrays(rot.inverse().apply_coords(rotated_coords),
                             coords)
 def test90_expand(self):  # non-square image
     image, coords, h, w = self.randomData(h=5, w=8)
     rot = RotationTransform(h, w, 90, expand=True, center=None)
     self.assertEqualsArrays(rot.apply_image(image), image.T[::-1])
     rotated_coords = [[c[1], w - c[0]] for c in coords]
     self.assertEqualsArrays(rot.apply_coords(coords), rotated_coords)
 def test180(self):
     image, coords, h, w = self.randomData(6, 6)
     rot = RotationTransform(h, w, 180, expand=False, center=None)
     self.assertEqualsArrays(rot.apply_image(image), image[::-1, ::-1])
     rotated_coords = [[w - c[0], h - c[1]] for c in coords]
     self.assertEqualsArrays(rot.apply_coords(coords), rotated_coords)