Merge pull request #171 from emmanuelle/modif_radon

BUG: Division by zero for small arrays in iradon.
This commit is contained in:
Stefan van der Walt
2012-04-09 14:01:33 -07:00
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -135,7 +135,7 @@ def iradon(radon_image, theta=None, output_size=None,
img = radon_image.copy()
# resize image to next power of two for fourier analysis
# speeds up fourier and lessens artifacts
order = max(64, 2 ** np.ceil(np.log(2 * n) / np.log(2)))
order = max(64., 2 ** np.ceil(np.log(2 * n) / np.log(2)))
# zero pad input image
img.resize((order, img.shape[1]))
# construct the fourier filter
@@ -30,6 +30,9 @@ def test_radon_iradon():
reconstructed = iradon(radon(image), filter="ramp", interpolation="nearest")
delta = np.mean(abs(image - reconstructed))
assert delta < 0.05
size = 20
image = np.tri(size) + np.tri(size)[::-1]
reconstructed = iradon(radon(image), filter="ramp", interpolation="nearest")
def test_iradon_angles():
"""