Total Complexity | 2 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import SimpleITK as sitk |
||
2 | |||
3 | import torchio as tio |
||
4 | |||
5 | from ...utils import TorchioTestCase |
||
6 | |||
7 | |||
8 | class TestTranspose(TorchioTestCase): |
||
9 | def test_transpose(self): |
||
10 | transform = tio.Transpose() |
||
11 | image = tio.ScalarImage(self.get_image_path('image')) |
||
12 | transformed = transform(image) |
||
13 | sitk_image = sitk.GetImageFromArray(image.numpy()[0]) |
||
14 | from_sitk = tio.ScalarImage.from_sitk(sitk_image) |
||
15 | self.assert_tensor_equal(transformed.data, from_sitk.data) |
||
16 | |||
17 | def test_orientation_reversed(self): |
||
18 | transform = tio.Transpose() |
||
19 | image = tio.ScalarImage(self.get_image_path('image')) |
||
20 | transformed = transform(image) |
||
21 | self.assertEqual(transformed.orientation_str, image.orientation_str[::-1]) |
||
22 |