returns point location from last click, in mm $Id: get_pos.m,v 1.1 2005/04/20 15:05:36 matthewbrett Exp $
0001 function mmpos = get_pos(obj) 0002 % returns point location from last click, in mm 0003 % 0004 % $Id: get_pos.m,v 1.1 2005/04/20 15:05:36 matthewbrett Exp $ 0005 0006 mmpos=[]; 0007 pos = get(gca, 'CurrentPoint'); 0008 u = get(gca, 'UserData'); 0009 if mars_struct('isthere', u, 'type') 0010 if strcmp(u.type, 'slice') % is slice panel 0011 mmpos = (pos(1,1:2)'-1).*obj.slicedef(:,2)+obj.slicedef(:,1); 0012 mmpos = inv(obj.transform) * [mmpos; u.no; 1]; 0013 mmpos = mmpos(1:3,1); 0014 end 0015 end 0016 return