function cimg=copyimage %COPYIMAGE Copy from a specified position in the current image an area, % defined with the mouse, to the global variable CutPaste. % % Claudio 28 Sept. 1995 % % % Copyright (c) 1995 by Claudio Rivetti and Mark Young % claudio@alice.uoregon.edu, mark@alice.uoregon.edu % global H I CutPaste; if nargin>0 error('Too many input arguments.'); end if ~isimage setviewmode('TOPVIEW'); showimage; end [qq, rect]=imcrop; ss=scansize(H); px=size(I,1); rect(1)=rect(1)-xoffset(H); rect(2)=rect(2)-yoffset(H); rect=rect*px/ss; rect=round(rect); CutPaste=I(rect(2):rect(2)+rect(4), rect(1):rect(1)+rect(3)); set(findobj('tag', 'PASTEITEM'), 'Enable', onoff(~isempty(CutPaste))); if nargout == 1 cimg=CutPaste; end return;