Error with part of code for MRI enhancement.

Hello,
I have code for an MRI enhancement that I know has been verified and works. However when I try and run it I get an error at 'im plc 3 4'. Does anyone know why Matlab doesn't recognize that and what its doing? Thank you!
% fig_brain_fft2
x = imread('Brainweb.jpg')';
f = fftshift(fft2(x));
im plc 3 4
im(1, x)
axis off, title ''
%colormap(gca, hot)
tmp = abs(f); tmp = tmp / max(tmp(:));
im(2, log(0.0001 + tmp))
axis off, title ''
cmap = colormap(jet);
cmap(1,:) = 0;
colormap(cmap)
im subplot 3
plot(200*tmp(:,end/2+[-10 1 10]), 'r')
axis([0 256 0 200])
xtick([1 256])
ytick([0 200])
axis off

 Akzeptierte Antwort

Image Analyst
Image Analyst am 9 Mär. 2018

0 Stimmen

You forgot to include the im() function. Maybe try calling it like you do the second time, with parentheses.
% Call im()
im(plc, 3, 4); % I have no idea what this function does.
Make sure plc is defined in advance. I also have no idea how this could possibly work:
im subplot 3
subplot() is a function, and you're trying to pass it to your im() function - is that right??? Explain what is going on there.

1 Kommentar

Westin Messer
Westin Messer am 9 Mär. 2018
I'm just as confused as you are. I'm really just trying to get the code to run.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 9 Mär. 2018

0 Stimmen

That code is part of a package available at http://web.eecs.umich.edu/~fessler/irt/fessler.tgz . If you download and expand that, and look in the graph subdirectory, then you will find im.m . So you should be loading the entire package and using pathtool to add the directory with all of its subdirectories.

6 Kommentare

Westin Messer
Westin Messer am 9 Mär. 2018
Okay thank you I now have the im.m code but could you explain further how to use the pathtool to get my code to work? That is all new to me.
Walter Roberson
Walter Roberson am 9 Mär. 2018
Invoke pathtool . At the upper left, click on "Add folder with subdirectories". Navigate to the folder that you expanded fessler.tgz into. Click on "Open" or whatever term the user interface for your operating system gives. This will add the directories to your MATLAB path. Then in pathtool click on Save, and then Close.
Westin Messer
Westin Messer am 9 Mär. 2018
Unfortunately it still isn't working. I must be doing something incorrectly.
Walter Roberson
Walter Roberson am 9 Mär. 2018
You have not posted the error message.
Westin Messer
Westin Messer am 9 Mär. 2018
I'm sorry, This is the error I'm getting:
Error: File: im.m Line: 1 Column: 2 Unexpected MATLAB operator.
Error in MRI (line 6) im plc 3 4
What is currently showing up for
which -all im

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by