from Region of Interest analysis by Florence Kussener
This example has been developed to add capabilities in ROI analysis: add, delete, change location,

changement
function changement
global im
global xi
global yi
I=get(im,'CData');

[x,y]=ginput(1);

[m,ind]=min(sqrt((xi-x).*(xi-x)+(yi-y).*(yi-y)));
hold on
p=plot(xi(ind),yi(ind),'ro')
hold off
[xp,yp]=ginput(1);
xi(ind)=xp;
yi(ind)=yp;

[Mask,xj,yj]=roipoly(I,xi,yi);

I(:,:,3)=255*Mask;
set(im,'CData',I);
delete(p)

Contact us at files@mathworks.com