Beispiel #1
0
def test_mean_absolute_error(space):
    true = odl.phantom.white_noise(space)
    data = odl.phantom.white_noise(space)

    result = fom.mean_absolute_error(data, true)
    expected = np.mean(np.abs(true - data))

    assert result == pytest.approx(expected)
Beispiel #2
0
blur = []
false_struct = []
ssim = []
psnr = []
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,