Beispiel #1
0
 def test_downsample(self):
     transform = RandomAnisotropy(axes=1, downsampling=(2., 2.))
     transformed = transform(self.sample_subject)
     self.assertEqual(
         self.sample_subject.spacing[1],
         transformed.spacing[1],
     )
Beispiel #2
0
 def test_2d_rgb(self):
     image = ScalarImage(tensor=torch.rand(3, 4, 5, 6))
     RandomAnisotropy()(image)
Beispiel #3
0
 def test_below_one_downsampling(self):
     with self.assertRaises(ValueError):
         RandomAnisotropy(downsampling=0.2)
Beispiel #4
0
 def test_wrong_downsampling_type(self):
     with self.assertRaises(ValueError):
         RandomAnisotropy(downsampling='wrong')
Beispiel #5
0
 def test_wrong_axes_type(self):
     with self.assertRaises(ValueError):
         RandomAnisotropy(axes='wrong')
Beispiel #6
0
 def test_out_of_range_axis_in_tuple(self):
     with self.assertRaises(ValueError):
         RandomAnisotropy(axes=(0, -1, 2))
Beispiel #7
0
 def test_out_of_range_axis(self):
     with self.assertRaises(ValueError):
         RandomAnisotropy(axes=3)