BUG: division by zero for small arrays in iradon

This commit is contained in:
Emmanuelle Gouillart
2012-04-09 18:00:37 +02:00
parent 42b5e91b7c
commit 3c9ab47677
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():
"""