def test_mean_value_difference_range_value(space): I0 = odl.util.testutils.noise_element(space) I1 = odl.util.testutils.noise_element(space) max0 = np.max(I0) max1 = np.max(I1) min0 = np.min(I0) min1 = np.min(I1) assert fom.mean_value_difference(I0, I1) <= max(max0 - min1, max1 - min0) assert fom.mean_value_difference(I0, I0) == pytest.approx(0) assert fom.mean_value_difference(10 * I0, I0, normalized=True) <= 1.0
def test_mean_value_difference_sign(): space = odl.uniform_discr(0, 1, 10) I0 = space.one() assert np.abs(fom.mean_value_difference(I0, -I0)) == pytest.approx(2.0)
haarpsi = [] # Create mask for ROI to evaluate blurring and false structures. Arbitrarily # chosen as bone in Shepp-Logan phantom. mask = (np.asarray(phantom) == 1) for stddev in np.linspace(0.1, 10, 100): phantom_noisy = phantom + odl.phantom.white_noise(reco_space, stddev=stddev) mse.append(fom.mean_squared_error(phantom_noisy, phantom, normalized=True)) mae.append(fom.mean_absolute_error(phantom_noisy, phantom, normalized=True)) mvd.append( fom.mean_value_difference(phantom_noisy, phantom, normalized=True)) std_diff.append( fom.standard_deviation_difference(phantom_noisy, phantom, normalized=True)) range_diff.append( fom.range_difference(phantom_noisy, phantom, normalized=True)) blur.append( fom.blurring(phantom_noisy, phantom, mask, normalized=True, smoothness_factor=30))