📄 sliceomatic_mia.m
字号:
set(s,'facelighting','phong'); case 'isocolor' [a s]=getarrowslice; c=uisetcolor(get(s,'facecolor')); set(s,'facecolor',c); case 'isoalpha' [a s]=getarrowslice; if nargin ~= 2 error('Not enough arguments to sliceomatic.'); end set(s,'facealpha',eval(p2)); case 'isocaps' [a s]=getarrowslice; cap=getappdata(s,'isosurfacecap'); if isempty(cap) new=localisocaps(s); set(new,'uicontextmenu',d.uiciso); else delete(cap); setappdata(s,'isosurfacecap',[]); end % % Now for slice context menu items % case 'togglevisible' [a s]=getarrowslice; switch get(s,'visible') case 'on' set(s,'visible','off'); pushset(a,'facealpha',.2); case 'off' set(s,'visible','on'); popset(a,'facealpha'); end case 'setfaceted' [a s]=getarrowslice; set(s,'edgec','k','facec','flat'); if ischar(get(s,'facea')) & strcmp(get(s,'facea'),'texturemap') set(s,'facea','flat'); end textureizeslice(s,'off'); case 'setflat' [a s]=getarrowslice; set(s,'edgec','n','facec','flat'); if ischar(get(s,'facea')) & strcmp(get(s,'facea'),'texturemap') set(s,'facea','flat'); end textureizeslice(s,'off'); case 'setinterp' [a s]=getarrowslice; set(s,'edgec','n','facec','interp'); if ischar(get(s,'facea')) & strcmp(get(s,'facea'),'texturemap') set(s,'facea','interp'); end textureizeslice(s,'off'); case 'settexture' [a s]=getarrowslice; set(s,'facecolor','texture','edgec','none'); if ischar(get(s,'facea')) set(s,'facealpha','texturemap'); end textureizeslice(s,'on'); case 'setnone' [a s]=getarrowslice; set(s,'facecolor','none','edgec','none'); textureizeslice(s,'off'); case 'setalphanone' [a s]=getarrowslice; set(s,'facealpha',1); case 'setalphapoint5' [a s]=getarrowslice; set(s,'facealpha',.5); case 'setalphaflat' [a s]=getarrowslice; set(s,'facealpha','flat'); if ischar(get(s,'facec')) & strcmp(get(s,'facec'),'texturemap') set(s,'facecolor','flat'); textureizeslice(s,'off'); end case 'setalphainterp' [a s]=getarrowslice; set(s,'facealpha','interp'); if ischar(get(s,'facec')) & strcmp(get(s,'facec'),'texturemap') set(s,'facecolor','interp'); textureizeslice(s,'off'); end case 'setalphatexture' [a s]=getarrowslice; set(s,'facealpha','texturemap'); if ischar(get(s,'facec')) set(s,'facecolor','texturemap'); textureizeslice(s,'on'); end case 'slicecontour' [a s]=getarrowslice; localcontour(s, getappdata(s,'contour')); case 'deleteslice' [a s]=getarrowslice; if prod(size(a))==1 delete(getappdata(a,'arrowedge')); end if ~isempty(getappdata(s,'contour')) delete(getappdata(s,'contour')); end delete(s); delete(a); case 'deleteslicecontour' [a s]=getarrowslice; if ~isempty(getappdata(s,'contour')) delete(getappdata(s,'contour')); end setappdata(s,'contour',[]); case 'slicecontourflat' [a s]=getarrowslice; c = getappdata(s,'contour'); if ~isempty(c) set(c,'edgecolor','flat'); end case 'slicecontourinterp' [a s]=getarrowslice; c = getappdata(s,'contour'); if ~isempty(c) set(c,'edgecolor','interp'); end case 'slicecontourblack' [a s]=getarrowslice; c = getappdata(s,'contour'); if ~isempty(c) set(c,'edgecolor','black'); end case 'slicecontourwhite' [a s]=getarrowslice; c = getappdata(s,'contour'); if ~isempty(c) set(c,'edgecolor','white'); end case 'slicecontourcolor' [a s]=getarrowslice; c = getappdata(s,'contour'); if ~isempty(c) inputcolor = get(c,'edgecolor'); if isa(inputcolor,'char') inputcolor=[ 1 1 1 ]; end set(c,'edgecolor',uisetcolor(inputcolor)); end case 'slicecontourlinewidth' [a s]=getarrowslice; c = getappdata(s,'contour'); if ~isempty(c) if isa(p2,'char') set(c,'linewidth',str2num(p2)); else set(c,'linewidth',p2); end end % % Menu All Slices % case 'allfacet' s=allSlices; set(s,'facec','flat','edgec','k'); textureizeslice(s,'off'); case 'allflat' s=allSlices; set(s,'facec','flat','edgec','none'); textureizeslice(s,'off'); case 'allinterp' s=allSlices; set(s,'facec','interp','edgec','none'); textureizeslice(s,'off'); case 'alltex' s=allSlices; set(s,'facec','texturemap','edgec','none'); textureizeslice(s,'on'); case 'allnone' s=allSlices; set(s,'facec','none','edgec','none'); textureizeslice(s,'off'); case 'alltnone' s=allSlices; set(s,'facea',1); textureizeslice(s,'off'); case 'alltp5' s=allSlices; set(s,'facea',.5); textureizeslice(s,'off'); case 'alltflat' s=allSlices; set(s,'facea','flat'); textureizeslice(s,'off'); case 'alltinterp' s=allSlices; set(s,'facea','interp'); textureizeslice(s,'off'); case 'allttex' s=allSlices; set(s,'facea','texturemap'); textureizeslice(s,'on'); % % Menu Defaults callbacks % case 'defaultfaceted' d.defcolor='faceted'; case 'defaultflat' d.defcolor='flat'; case 'defaultinterp' d.defcolor='interp'; case 'defaulttexture' d.defcolor='texture'; if strcmp(d.defalpha,'flat') | strcmp(d.defalpha,'interp') d.defalpha='texture'; end case 'defaultinterp' d.defcolor='none'; case 'defaulttransnone' d.defalpha='none'; case 'defaulttransflat' d.defalpha='flat'; case 'defaulttransinterp' d.defalpha='interp'; case 'defaulttranstexture' d.defalpha='texture'; d.defcolor='texture'; case 'defaultlightflat' d.deflight='flat'; case 'defaultlightsmooth' d.deflight='smooth'; case 'defaultcontourflat' d.defcontourcolor='flat'; case 'defaultcontourinterp' d.defcontourcolor='interp'; case 'defaultcontourblack' d.defcontourcolor='black'; case 'defaultcontourwhite' d.defcontourcolor='white'; case 'defaultcontourlinewidth' if isa(p2,'char') d.defcontourlinewidth=str2num(p2); else d.defcontourlinewidth=p2; end % % Camera toolbar Toggling % case 'cameratoolbar' cameratoolbar('Toggle'); % % Controler Preferences % case 'controlalpha' val=str2num(p2); iso=findobj(d.axiso,'type','image'); if val == 0 set([d.pxx d.pxy d.pxz iso],'visible','off'); else set([d.pxx d.pxy d.pxz iso],'visible','on'); set([d.pxx d.pxy d.pxz] , 'facealpha',val); set(iso,'alphadata',val); end case 'controllabels' l = get(d.axx,'xticklabel'); if isempty(l) set([d.axx d.axiso],'xticklabelmode','auto'); set([d.axy d.axz],'yticklabelmode','auto'); else set([d.axx d.axiso],'xticklabel',[]); set([d.axy d.axz],'yticklabel',[]); end case 'controlvisible' objs=findobj([d.axiso d.axx d.axy d.axz]); if strcmp(get(d.axx,'visible'),'on') set(objs,'visible','off'); set(d.axmain,'pos',[.1 .1 .9 .8]); else set(objs,'visible','on'); set(d.axmain,'pos',[.2 .2 .6 .6]); end % % UICONTROL callbacks % case 'colormap' str=get(gcbo,'string'); val=str{get(gcbo,'value')}; size(val); if strcmp(val,'custom') cmapeditor else colormap(val); end case 'alphamap' str=get(gcbo,'string'); alphamap(str{get(gcbo,'value')}); % % Commands % case 'copy' currmap = colormap;%BL copyobj(gca,figure);set(gca,'pos',[.1 .1 .9 .8]); colormap(currmap);%BL case 'print' newf=figure('visible','off','renderer',get(gcf,'renderer')); copyobj(d.axmain,newf); set(gca,'pos',[.1 .1 .9 .8]) printdlg(newf); close(newf); case 'close'%BL d=getappdata(gcf,'sliceomatic');%BL if d.UseGenericOpenGL%BL closereq;%BL feature('UseGenericOpenGL',1);%BL else%BL closereq;%BL end%BL otherwise error('Bad slice-o-matic command.'); end catch disp(get(0,'errormessage')); end setappdata(gcf,'sliceomatic',d); endfunction dragprep(arrowtodrag) arrows=findall(gcf,'tag','sliceomaticarrow'); pushset(arrows,'facecolor','r'); pushset(arrows,'facealpha',.2); pushset(arrowtodrag,'facecolor','g'); pushset(arrowtodrag,'facealpha',.7); slices=allSlices; for i=1:length(slices) fa=get(slices(i),'facea'); if isa(fa,'double') & fa>.3 pushset(slices(i),'facealpha',.3); pushset(slices(i),'edgecolor','n'); else pushset(slices(i),'facealpha',fa); pushset(slices(i),'edgecolor',get(slices(i),'edgec')); end end isosurfs=allIsos; for i=1:length(isosurfs) fa=get(isosurfs(i),'facea'); if isa(fa,'double') & fa>.3 pushset(isosurfs(i),'facealpha',.3); pushset(isosurfs(i),'edgecolor','n'); else pushset(isosurfs(i),'facealpha',fa); pushset(isosurfs(i),'edgecolor',get(isosurfs(i),'edgec')); end cap=getappdata(isosurfs(i),'isosurfacecap'); if ~isempty(cap) pushset(cap,'visible','off'); end end ss=getappdata(arrowtodrag,'arrowslice'); if isempty(ss) ss=getappdata(arrowtodrag,'arrowiso'); end popset(ss,'facealpha'); popset(ss,'edgecolor'); pushset(gcf,'windowbuttonupfcn','sliceomatic_mia up'); pushset(gcf,'windowbuttonmotionfcn','sliceomatic_mia motion'); d=getappdata(gcf,'sliceomatic'); % Doing this makes the tip invisible when visible is on. set(d.tip,'string',''); pushset(d.tip,'visible','on'); function dragfinis(arrowtodrag) arrows=findall(gcf,'tag','sliceomaticarrow'); popset(arrowtodrag,'facecolor'); popset(arrowtodrag,'facealpha'); popset(arrows,'facecolor'); popset(arrows,'facealpha'); ss=getappdata(arrowtodrag,'arrowslice'); if isempty(ss) ss=getappdata(arrowtodrag,'arrowiso'); end % These pushes are junk which will be undone when all slices or % isosurfs are reset below. pushset(ss,'facealpha',1); pushset(ss,'edgecolor','k'); slices=allSlices; if ~isempty(slices) popset(slices,'facealpha'); popset(slices,'edgecolor'); end isosurfs=allIsos; if ~isempty(isosurfs) popset(isosurfs,'facealpha'); popset(isosurfs,'edgecolor'); end d=getappdata(gcf,'sliceomatic'); for i=1:length(isosurfs) cap=getappdata(isosurfs(i),'isosurfacecap'); if ~isempty(cap) popset(cap,'visible'); localisocaps(isosurfs(i),cap); end if getappdata(isosurfs(i), 'reduced') setappdata(isosurfs(i),'reduced',0); localisosurface({},d.data,d.smooth,... getappdata(isosurfs(i),'isosurfacevalue'),... isosurfs(i)); end end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -