function showimage %SHOWIMAGE - Displays the current image in the mode set in the View menu. % % % Copyright (c) 1995 by Claudio Rivetti and Mark Young % claudio@alice.uoregon.edu, mark@alice.uoregon.edu % global H I Handleimg Handlebar Handleimgax Handlefig HandleIimg global Fname FontName FontSize FontWeight global FullFname LineSpace PlaneSpace ViewCoord MapSize map global ZoomFactor Center Oldzoomstatus nmax global img TVzrange D3zrange ContourLines SelObj msm edgem facem global tag B_frame T Fast3Dplot if isempty(I) return; end if isempty(Fast3Dplot) Fast3Dplot=1; end if isempty(PlaneSpace) PlaneSpace=0; end % T is the orientation matrix set by the viewer; if isempty(T) T=[0.7986 -0.6018 0 0; 0.3009 0.3993 0.8660 0; -0.5212 -0.6916 0.5000 0; 0 0 0 1.0000]; end ZAMPLITUDE=10; fig=watchon; set(Handlefig, 'nextplot', 'add'); if strcmp(getviewmode, 'TOPVIEW') if ~isimage tag=''; if ~ischildren(HandleIimg, Handleimgax) zrange(TVzrange); end D3zrange=zrange; [ss, units]=scansize(H);xo=xoffset(H);yo=yoffset(H); px=size(I); xlim=[xo+(ss/px(2))/2 xo+ss-(ss/px(2))/2]; ylim=[yo+(ss/px(1))/2 yo+ss-(ss/px(1))/2]; Handleimg=image(xlim, ylim, scaleimage(I, zrange)); setimagescale(Handleimgax,[xo xo+ss],[yo yo+ss], units); ViewCoord=[]; % closeviewer; setbarscale(zrange); if ~isempty(ZoomFactor) % zoom(ZoomFactor, Center); zoom(ZoomFactor); ZoomFactor=[]; setzoomstatus(Oldzoomstatus); end else set(Handleimg, 'Cdata', scaleimage(I, zrange)); setbarscale(zrange); end end if strcmp(getviewmode, 'TOPVIEW_INTERP') tag=''; if isimage [ZoomFactor, Center]=getzoom(Handleimgax); Oldzoomstatus=getzoomstatus; [img ViewCoord]=getview; img=flipud(img); if prod(size(img)) > 10000 & Fast3Dplot img=imresize(img, [100 100], 'bicubic'); end nmax = axis; else if ~ischildren(HandleIimg,Handleimgax) closebuttons; end end HandleIimg=pcolor(img);caxis(zrange);shading interp;axis off; % closeviewer; setbarscale(caxis); end if strcmp(getviewmode, 'LINEPLOT') if isimage [ZoomFactor, Center]=getzoom(Handleimgax); Oldzoomstatus=getzoomstatus; TVzrange=zrange; zrange(D3zrange); setzoomstatus(-1); [img ViewCoord]=getview(ViewCoord); img=flipud(img); end if strcmp(tag, 'Line Plot') ~= 1 tag=meshc_buttons('Line Plot'); end w=waterfall(PlaneSpace+img(1:LineSpace:size(img,1),:)); set(w, 'linewidth', getlinewidth); if get(edgem, 'value')==4, set(w,'EdgeColor', getpencolor); else, set(w,'EdgeColor', get(edgem,'userdata'));end if get(facem, 'value')<4, set(w,'FaceColor', get(facem,'userdata'));end if get(facem, 'value')==5, set(w, 'FaceColor', getfillcolor);end if get(facem, 'value')==4, set(w, 'FaceColor', 'none');end view(T); axis off; set(gca, 'zlim', zrange); setbarscale(caxis); viewer; SelObj=w; end if strcmp(getviewmode, 'MESH') if isimage [ZoomFactor, Center]=getzoom(Handleimgax); Oldzoomstatus=getzoomstatus; TVzrange=zrange; zrange(D3zrange); setzoomstatus(-1); [img ViewCoord]=getview(ViewCoord); img=flipud(img); if prod(size(img)) > 10000 & Fast3Dplot img=imresize(img, [100 100], 'bicubic'); end end if strcmp(tag, 'Mesh Plot') ~= 1 tag=meshc_buttons('Mesh Plot'); end m=mesh(PlaneSpace+img(1:LineSpace:size(img,1),1:LineSpace:size(img,2))); set(m, 'linestyle', getlinestyle, 'linewidth', getlinewidth, 'meshstyle', get(msm,'userdata')); if get(edgem, 'value')==4, set(m,'EdgeColor', getpencolor); else, set(m,'EdgeColor', get(edgem,'userdata'));end if get(facem, 'value')==5, set(m,'FaceColor', getfillcolor); else, set(m,'FaceColor', get(facem,'userdata'));end view(T); axis off; set(gca, 'zlim', zrange); setbarscale(caxis); viewer; SelObj=m; end if strcmp(getviewmode, 'MESHC') if isimage [ZoomFactor, Center]=getzoom(Handleimgax); Oldzoomstatus=getzoomstatus; TVzrange=zrange; zrange(D3zrange); setzoomstatus(-1); [img ViewCoord]=getview(ViewCoord); img=flipud(img); if prod(size(img)) > 10000 & Fast3Dplot img=imresize(img, [100 100], 'bicubic'); end end m=meshc(PlaneSpace+img(1:LineSpace:size(img,1),1:LineSpace:size(img,2))); view(T); ContourLines=m(2:length(m)); zpos=zrange; zpos=zpos(1); for i = 1:length(ContourLines) zz = get(ContourLines(i),'Zdata'); set(ContourLines(i),'Zdata',zpos*ones(size(zz)), 'linestyle', getlinestyle, 'linewidth', getlinewidth); end if strcmp(tag, 'Mesh/Contour Plot') ~=1 tag=meshc_buttons('Mesh/Contour Plot'); end set(m(1), 'linestyle', getlinestyle, 'linewidth', getlinewidth, 'meshstyle', get(msm,'userdata')); if get(edgem, 'value')==4, set(m(1), 'EdgeColor', getpencolor); else, set(m(1), 'EdgeColor', get(edgem,'userdata'));end if get(facem, 'value')==5, set(m(1), 'FaceColor', getfillcolor); else, set(m(1),'FaceColor', get(facem,'userdata'));end axis off; set(Handleimgax, 'zlim', zrange); setbarscale(caxis); viewer; SelObj=[ContourLines;m]; end if strcmp(getviewmode, 'SURFACE') if isimage [ZoomFactor, Center]=getzoom(Handleimgax); Oldzoomstatus=getzoomstatus; TVzrange=zrange; zrange(D3zrange); setzoomstatus(-1); [img ViewCoord]=getview(ViewCoord); img=flipud(img); if prod(size(img)) > 10000 & Fast3Dplot img=imresize(img, [100 100], 'bicubic'); end end if strcmp(tag, 'Surface Plot') ~= 1 tag=meshc_buttons('Surface Plot'); end m=surf(PlaneSpace+img); set(m, 'linestyle', getlinestyle, 'linewidth', getlinewidth); if get(edgem, 'value')==4, set(m,'EdgeColor', getpencolor); else, set(m,'EdgeColor', get(edgem,'userdata'));end if get(facem, 'value')==5, set(m,'FaceColor', getfillcolor); else, set(m,'FaceColor', get(facem,'userdata'));end view(T); axis off; set(gca, 'zlim', zrange); setbarscale(caxis); viewer; end if strcmp(getviewmode, 'SURFL') if isimage [ZoomFactor, Center]=getzoom(Handleimgax); Oldzoomstatus=getzoomstatus; TVzrange=zrange; zrange(D3zrange); setzoomstatus(-1); [img ViewCoord]=getview(ViewCoord); img=flipud(img); if prod(size(img)) > 10000 & Fast3Dplot img=imresize(img, [100 100], 'bicubic'); end end if strcmp(tag, 'SurfaceL Plot') ~= 1 tag=meshc_buttons('SurfaceL Plot'); end m=surfl(PlaneSpace+img); set(m, 'linestyle', getlinestyle, 'linewidth', getlinewidth); if get(edgem, 'value')==4, set(m,'EdgeColor', getpencolor); else, set(m,'EdgeColor', get(edgem,'userdata'));end if get(facem, 'value')==5, set(m,'FaceColor', getfillcolor); else, set(m,'FaceColor', get(facem,'userdata'));end view(T); axis off; set(gca, 'zlim', zrange); setbarscale([]); viewer; end watchoff(fig); set(Handlefig, 'nextplot', 'new'); return;