0

I am currently working on code which takes a stack of images and calculates the intensity profiles of these stacks to compare them with another stack of images.

Here's my code:

for i = 1:c_frames
    d_Img(:,:) = d_I(i,:,:);
    c_Img(:,:) = c_I(i,:,:);
    c_d = improfile(d_Img);
    c_c = improfile(c_Img); 
end

These are the set of errors (all pertaining to one error of course) that I get:

enter image description here

When I whos d_I and c_I, this is what I get:

enter image description here

So what exactly does the error mean, I tried to look into the documentation, but I wasn't sure as to what the N meant.

Thank you for your answers and please do not hesitate to ask any questions that will further clarify the question.

SDG
  • 2,260
  • 8
  • 35
  • 77

1 Answers1

2

Granted that this is a cryptic error message, I think the set of inputs you are providing to the improfile function isn't complete. If you look clearly at https://www.mathworks.com/help/images/ref/improfile.html, you see that the improfile(n) syntax needs a scalar 'n' (not an image), which is the number of points to include, in the profile.

There is no syntax that allows passing in only an image. You'd have to also include the x and y coordinates of the endpoints of the line segments you want to generate a profile on. For example,

load mri
D = squeeze(D)
dSlice = D(:,:,16);
x = [19 35 65 77];
y = [96 45 27 33];
improfile(dSlice, x, y)  % x and y are required inputs.

works. As for the error message, if you're really curious, try

edit improfile

I believe N stands for the number of points you've specified, the way you call it chokes this logic.

akamath
  • 570
  • 2
  • 9
  • Out of curiosity, I'm wondering the actual use of `squeeze()` for your `mri`'s. Why does `improfile` need two line segments? – SDG Feb 03 '16 at 06:18
  • squeeze is used to remove all the leading singleton dimensions in your > 2D image, and the two arrays are corresponding coordinates for the line. I picked this up the example in the improfile documentation page. – akamath Feb 05 '16 at 21:15