Radon transform error.

5 ビュー (過去 30 日間)
Michael Agustin Mateo
Michael Agustin Mateo 2020 年 9 月 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
Michael Agustin Mateo 2020 年 10 月 1 日
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