コード例 #1
0
 def test_output_shape(self, class_args, img_shape):
     key = "img"
     bias_field = RandBiasFieldd(keys=[key], **class_args)
     img = np.random.rand(*img_shape)
     output = bias_field({key: img})
     np.testing.assert_equal(output[key].shape, img_shape)
     np.testing.assert_equal(output[key].dtype, bias_field.rand_bias_field.dtype)
コード例 #2
0
ファイル: test_rand_bias_fieldd.py プロジェクト: Nic-Ma/MONAI
 def test_one_range_input(self, class_args, expected):
     key = "img"
     bias_field = RandBiasFieldd(keys=[key], **class_args)
     img = np.ones([1, 2, 2])
     output = bias_field({key: img})
     np.testing.assert_allclose(output[key],
                                expected.astype(
                                    bias_field.rand_bias_field.dtype),
                                rtol=1e-3)
コード例 #3
0
ファイル: test_rand_bias_fieldd.py プロジェクト: Nic-Ma/MONAI
 def test_zero_prob(self):
     key = "img"
     bias_field = RandBiasFieldd(keys=[key], prob=0.0)
     img = np.random.rand(3, 32, 32)
     output = bias_field({key: img})
     np.testing.assert_equal(output[key], img)
コード例 #4
0
ファイル: test_rand_bias_fieldd.py プロジェクト: Nic-Ma/MONAI
 def test_zero_range(self, class_args, img_shape):
     key = "img"
     bias_field = RandBiasFieldd(keys=[key], **class_args)
     img = np.ones(img_shape)
     output = bias_field({key: img})
     np.testing.assert_allclose(output[key], np.ones(img_shape))