From 1caafd44516714cf5c4fd21b920a345036c5bab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jostein=20B=C3=B8=20Fl=C3=B8ystad?= Date: Wed, 19 Jun 2013 00:13:20 +0200 Subject: [PATCH] test_radon_transform: Test sinogram conversions. --- skimage/transform/tests/test_radon_transform.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/skimage/transform/tests/test_radon_transform.py b/skimage/transform/tests/test_radon_transform.py index 7884ef83..5a7ca963 100644 --- a/skimage/transform/tests/test_radon_transform.py +++ b/skimage/transform/tests/test_radon_transform.py @@ -243,6 +243,23 @@ def test_radon_circle(): assert np.all(relative_error < 3e-3) +def check_sinogram_circle_to_square(size): + from skimage.transform.radon_transform import _sinogram_circle_to_square + image = _random_circle((size, size)) + theta = np.linspace(0., 180., size, False) + sinogram_circle = radon(image, theta, circle=True) + sinogram_square = radon(image, theta, circle=False) + sinogram_circle_to_square = _sinogram_circle_to_square(sinogram_circle) + error = abs(sinogram_square - sinogram_circle_to_square) + print(np.mean(error), np.max(error)) + assert np.allclose(sinogram_square, sinogram_circle_to_square) + + +def test_sinogram_circle_to_square(): + for size in (50, 51): + yield check_sinogram_circle_to_square, size + + def check_radon_iradon_circle(interpolation, shape, output_size): # Forward and inverse radon on synthetic data image = _random_circle(shape)