Yes, it looks weird. I don't have access to the corresponding toolbox in Matlab either. I could "symmetrize" the result by the following change in radon: - shift0 = np.array([[1, 0, -w/2.], - [0, 1, -h/2.], + shift0 = np.array([[1, 0, -w/2. + 0.5], + [0, 1, -h/2. + 0.5], [0, 0, 1]]) - shift1 = np.array([[1, 0, w/2.], - [0, 1, h/2.], + shift1 = np.array([[1, 0, w/2. - 0.5], + [0, 1, h/2. - 0.5], [0, 0, 1]]) but then I'm not sure whether the behavior of iradon is correct either, so I haven't committed this change yet. Pieter, if you're around, would you mind having a quick look? Also, iradon crashes for arrays with less than 64 lines (due to an int that should be a float, resulting in a division by zero error -- I just made a small pull request to correct that). I also noticed that for the array used in test_radon_transform.test_radon_iradon, applying radon and then iradon does not give back the correct original array, but an array that looks shifted by one line and one column. Try for example
from skimage.transform import radon, iradon size = 70 image = np.tri(size) + np.tri(size)[::-1] reconstructed = iradon(radon(image), filter="ramp", interpolation="linear") close('all') plt.matshow(image)
plt.matshow(reconstructed)
I very much suspect that the center of rotation is not correct either in radon, or in iradon, or maybe in both... I started having a look at the code, but maybe it would be easier for Pieter than for me to fix it... Cheers, Emmanuelle On Wed, Apr 04, 2012 at 03:53:38PM -0700, St�fan van der Walt wrote:
On Wed, Apr 4, 2012 at 2:31 PM, Emmanuelle Gouillart
wrote: � � � �I have the impression that the center of rotation used for computing the radon transform (skimage.transform.radon) is not correct:
In [8]: tf.radon(z, theta=[0, 90]) Out[8]: array([[ 0., 0.], [ 0., 0.], [ 0., 1.], [ 0., 0.], [ 0., 0.], [ 0., 0.], [ 1., 0.], [ 0., 0.], [ 0., 0.], [ 0., 0.]])
Hrm, you're right; that looks fishy. I wonder if this has to do with the padding that happens beforehand? I don't have access to MATLAB--does their "radon" give similar results?
St�fan
participants (1)
-
Emmanuelle Gouillart