コード例 #1
0
ファイル: test_oneof.py プロジェクト: neuronflow/torchio
 def test_one_of(self):
     transform = OneOf({
         RandomAffine(): 0.2,
         RandomElasticDeformation(max_displacement=0.5): 0.8,
     })
     transform(self.sample)
コード例 #2
0
ファイル: test_oneof.py プロジェクト: neuronflow/torchio
 def test_negative_probabilities(self):
     with self.assertRaises(ValueError):
         OneOf({RandomAffine(): -1, RandomElasticDeformation(): 1})
コード例 #3
0
ファイル: test_oneof.py プロジェクト: neuronflow/torchio
 def test_zero_probabilities(self):
     with self.assertRaises(ValueError):
         OneOf({RandomAffine(): 0, RandomElasticDeformation(): 0})
コード例 #4
0
 def test_num_control_points(self):
     RandomElasticDeformation(num_control_points=5)
     RandomElasticDeformation(num_control_points=(5, 6, 7))
コード例 #5
0
 def test_max_displacement(self):
     RandomElasticDeformation(max_displacement=5)
     RandomElasticDeformation(max_displacement=(5, 6, 7))
コード例 #6
0
 def test_wrong_locked_borders(self):
     with self.assertRaises(ValueError):
         RandomElasticDeformation(locked_borders=-1)
コード例 #7
0
 def test_coarse_grid_removed(self):
     with self.assertRaises(ValueError):
         RandomElasticDeformation(
             num_control_points=(4, 5, 6),
             locked_borders=2,
         )
コード例 #8
0
 def test_max_displacement_no_num(self):
     with self.assertRaises(ValueError):
         RandomElasticDeformation(max_displacement=None)
コード例 #9
0
 def test_max_displacement_negative(self):
     with self.assertRaises(ValueError):
         RandomElasticDeformation(max_displacement=-1)
コード例 #10
0
 def test_num_control_points_small(self):
     with self.assertRaises(ValueError):
         RandomElasticDeformation(num_control_points=3)
コード例 #11
0
 def test_inputs_interpolation_string(self):
     with self.assertRaises(TypeError):
         RandomElasticDeformation(image_interpolation='linear')
コード例 #12
0
 def test_inputs_pta_lt_zero(self):
     with self.assertRaises(ValueError):
         RandomElasticDeformation(p=-1)
コード例 #13
0
 def test_inputs_pta_gt_one(self):
     with self.assertRaises(ValueError):
         RandomElasticDeformation(p=1.5)
コード例 #14
0
 def test_inputs_interpolation(self):
     with self.assertWarns(FutureWarning):
         RandomElasticDeformation(image_interpolation=Interpolation.LINEAR)