function [M, coord]=getview(c) % GETVIEW - returns the image submatrix corresponding to the current view. % % [M, COORD] = GETVIEW(C) % % inputs: % C - the current view, a vector of [xmin xmax ymin ymax]. % outputs: % M - the returned submatrix of I, the image matrix % COORD - the returned current view. % % Claudio spring of 1995 % % Copyright (c) 1995 by Claudio Rivetti and Mark Young % claudio@alice.uoregon.edu, mark@alice.uoregon.edu % global I H Handleimgax if nargin==0 c=[]; end if isempty(c) axes(Handleimgax); c=axis; ss=scansize(H); sl=size(I,1); xoff = xoffset(H); yoff = yoffset(H); c(1:2) = c(1:2) - xoff; c(3:4) = c(3:4) - yoff; c=round(c*sl/ss); end if c(3)<1, c(3)=1;end if c(1)<1, c(1)=1;end if c(4)>sl, c(4)=sl;end if c(2)>sl, c(2)=sl;end M=I(c(3):c(4), c(1):c(2)); coord=c; return