Radon transform error.

5 次查看(过去 30 天)
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!

采纳的回答

Walter Roberson
Walter Roberson 2020-10-1
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 个评论
Michael Agustin Mateo
I was staring at the script for so long, i did not even think about that being the problem. Thank you so much!

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by