Radon transform error.

8 vues (au cours des 30 derniers jours)
Michael Agustin Mateo
Michael Agustin Mateo le 30 Sep 2020
Hi Community,
Here is the script I have written:
f_sample = @(x) double(2*(x(1)^2 + x(2)^2) < 1);
x = -1:0.1:1;
[X,Y] = meshgrid(x);
Z = zeros(size(X));
for i = 1:length(x)
for j = 1:length(x)
Z(i,j) = f_sample([X(i,j);Y(i,j)]);
end
end
New_Phantom = Z;
R = radon(New_Phantom,0:0.1:179);
BackProjected_Radon = iradon(R,0:0.1:179);
R = R - min(min(R));
R = R/max(max(abs(R)));
BackProjected_Radon = BackProjected_Radon - min(min(BackProjected_Radon));
BackProjected_Radon = BackProjected_Radon/max(max(abs(BackProjected_Radon)));
When I run the script, I get the following error:
Attempt to execute SCRIPT radon as a function:
C:\Users\micha\Documents\MATLAB\radon.m
Error in radon (line 19)
R = radon(New_Phantom,0:0.1:179);
I understand that the radon function takes a 2-D image and outputs the image transform. I do not see where I am going wrong. Unless i am misinterpreting the format of my input, it should be able to perform this without issue.
Thank you in advance!

Réponse acceptée

Walter Roberson
Walter Roberson le 1 Oct 2020
You named your script radon.m but inside the script named radon.m you expect radon() to refer to MATLAB's toolbox/images/images/radon.m .
You need to rename your script so that it is not the same as any function that needs to be called in computing your script.
  1 commentaire
Michael Agustin Mateo
Michael Agustin Mateo le 1 Oct 2020
I was staring at the script for so long, i did not even think about that being the problem. Thank you so much!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by