コード例 #1
0
 def test_wrong_order_type(self):
     with self.assertRaises(TypeError):
         RandomBiasField(order='wrong')
コード例 #2
0
 def test_no_bias(self):
     transform = RandomBiasField(coefficients=0.)
     transformed = transform(self.sample_subject)
     self.assertTensorAlmostEqual(self.sample_subject.t1.data, transformed.t1.data)
コード例 #3
0
 def test_negative_order(self):
     with self.assertRaises(ValueError):
         RandomBiasField(order=-1)
コード例 #4
0
 def test_wrong_coefficient_type(self):
     with self.assertRaises(ValueError):
         RandomBiasField(coefficients='wrong')
コード例 #5
0
 def test_no_bias(self):
     transform = RandomBiasField(coefficients=0.)
     transformed = transform(self.sample)
     assert_array_equal(self.sample.t1.data, transformed.t1.data)
コード例 #6
0
 def test_with_bias(self):
     transform = RandomBiasField(coefficients=0.1)
     transformed = transform(self.sample)
     with self.assertRaises(AssertionError):
         assert_array_equal(self.sample.t1.data, transformed.t1.data)
コード例 #7
0
 def test_with_bias(self):
     transform = RandomBiasField(coefficients=0.1)
     transformed = transform(self.sample)
     self.assertTensorNotEqual(self.sample.t1.data, transformed.t1.data)