Search code examples
imagematlabpixel

Getting pixel position of point in Matlab for MRI data


I can show the data from MRI in the figure. I used the source:

load mri
figure('Colormap',map)
load DCE_sec05_inp.mat
image(data2{1,1}) %i get 128*96 pixel picture
axis image

But I can´t find a solve how I can get the pixel position to workspace when I click to pixel in figure. I finded this code:

I = imread('cameraman.tif');  %read the image in I
imshow(I);                    %display I
[c,r,P] = impixel(I)

but I can´t get the mri data to imshow mode. Thanks for whatever help


Solution

  • You don't necessarily need imshow, try this:

    image(data2{1,1}) %i get 128*96 pixel picture
    axis image
    [u v]=getpts;
    

    The coordinates of the points you clicked will be stored in u and v.