Hello,
I'm trying to write a small masking tool using Matlab's ROI tool. I would like to save multiple objects to crop different regions of data. I'm struggling, however, to save the position data of multiple and different objects.
For example:
fighandle =figure();axshandle = axes('Parent',fighandle);imshow('cameraman.tif','Parent',axshandle)roi(1).handle = imrect(axshandle);roi(2).handle = imellipse(axshandle);roi(3).handle = impoly(axshandle);for i =1:3 addNewPositionCallback(roi(i).handle,@(pos) getpos(pos,roi(i).handle,i));end
Function to call back position of objects.
function getpos(pos, handle, i)getPosition(handle)end
The script works in that it calls back the position data of the three objects, even if they are moved. However, how do I save this position data to a variable (even if the objects are moved after placing them)?
Any help would be much appreciated.
Best Answer