⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sliceomatic.m

📁 matlab源代码,适用于开发研究,带来很好的学习效果.
💻 M
📖 第 1 页 / 共 3 页
字号:
       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;        slowset(s,'facealpha',1,d.animincrement);       case 'setalphapoint5'        [a s]=getarrowslice;        slowset(s,'facealpha',.5,d.animincrement);       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 'slicecontourfullauto'        [a s]=getarrowslice;        d = getappdata(gcf, 'sliceomatic');        minmax = get(d.axiso,'clim');        levels = minmax(1):(minmax(2)-minmax(1))/10:minmax(2);        setappdata(s, 'contourlevels', levels);        localcontour(s, getappdata(s,'contour'),levels);               case 'slicecontour_setauto'        [a s]=getarrowslice;        setappdata(s, 'contourlevels', []);        localcontour(s, getappdata(s,'contour'));       case 'slicecontour_setfullauto'        [a s]=getarrowslice;        minmax = get(d.axiso,'clim');        levels = minmax(1):(minmax(2)-minmax(1))/10:minmax(2);        setappdata(s, 'contourlevels', levels);        localcontour(s, getappdata(s,'contour'),levels);       case 'slicecontour_select'        [a s]=getarrowslice;        d = getappdata(gcf, 'sliceomatic');        xl = get(d.axiso,'xlim');        levels = selectcontourlevels(get(s,'cdata'), xl(1), xl(2));        setappdata(s, 'contourlevels', levels);        localcontour(s, getappdata(s,'contour'),levels);       case 'slicecontour_setlevels'        [a s]=getarrowslice;        d = getappdata(gcf, 'sliceomatic');        xl = get(d.axiso,'xlim');        levels = selectcontourlevels(get(s,'cdata'), xl(1), xl(2));        setappdata(s, 'contourlevels', levels);        localcontour(s, getappdata(s,'contour'),levels);       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        temp=getappdata(s);        try           temp.contourlevels;          setappdata(s,'contourlevels',[]);        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 'slicecontoursmooth'        [a s]=getarrowslice;        c = getappdata(s,'contour');        onoff = get(gcbo,'checked');        switch onoff         case 'off'          set(c,'linesmoothing','on');         case 'on'          set(c,'linesmoothing','off');        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          slowset(c,'edgecolor',uisetcolor(inputcolor),d.animincrement);        end       case 'slicecontourlinewidth'        [a s]=getarrowslice;        c = getappdata(s,'contour');        if ~isempty(c)          if isa(p2,'char')            slowset(c,'linewidth',str2num(p2),d.animincrement);          else            slowset(c,'linewidth',p2,d.animincrement);          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 'defaultcontoursmooth'        d.defaultcontoursmooth='on';       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');       case 'annotationtoolbar'        if propcheck(d.toolbar,'visible','on')          set(d.toolbar,'vis','off');        else          set(d.toolbar,'vis','on');        end        %        % 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');          slowset([d.pxx d.pxy d.pxz] , 'facealpha',val,d.animincrement);          slowset(iso,'alphadata',val,d.animincrement);        end       case 'toggleanimation'        if d.animincrement == 0          d.animincrement = 10;        else          d.animincrement = 0;        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          slowset(gcf,'colormap',feval(val),d.animincrement);        end       case 'alphamap'        str=get(gcbo,'string');        val=alphamap(str{get(gcbo,'value')});        slowset(gcf,'alphamap',val,d.animincrement);        %        % Commands        %       case 'copy'        copyobj(gca,figure);set(gca,'pos',[.1 .1 .9 .8]);       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);       otherwise        error('Bad slice-o-matic command.');      end    catch      disp(get(0,'errormessage'));    end    setappdata(gcf,'sliceomatic',d);  else    disp('Sliceomatic data must be DOUBLE');  endfunction dragprep(arrowtodrag)  arrows=findall(gcf,'tag','sliceomaticarrow');  pushset(arrows,'facecolor',[1 0 0]);  pushset(arrows,'facealpha',.2);  pushset(arrowtodrag,'facecolor',[0 1 0]);  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 up');  pushset(gcf,'windowbuttonmotionfcn','sliceomatic motion');  % Doing this makes the tip invisible when visible is on.  showarrowtip(arrowtodrag);  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');    if isnan(d.xmesh)==1    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  else    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);        realvolume={d.xmesh d.ymesh d.zmesh};        localisosurface(realvolume,d.data,d.smooth,...                        getappdata(isosurfs(i),'isosurfacevalue'),...                        isosurfs(i));      end    end  end  popset(gcf,'windowbuttonupfcn');  popset(gcf,'windowbuttonmotionfcn');  showarrowtip([]);    % Make sure whatever buttonupfcn on the figure is run now to "turn  % off" whatever was going on before we got our callback on the  % arrow.  buf = get(gcf,'windowbuttonupfcn');  if ~strcmp(buf,'')    eval(buf);  endfunction movetipforarrow(arrow, ax, value, position, va, ha)% Setup the current data tip for a slice arrow, and show it's% control value    tipdata.parentaxes = ax;  tipdata.value = value;  tipdata.position = position;  tipdata.verticalalign = va;  tipdata.horizontalalign = ha;    setappdata(arrow, 'tipdata', tipdata);    showarrowtip(arrow);% Put it onto d.axisiso so that% it always appears on top.%set(t,'parent',d.axiso);function p=arrow(parent,dir,pos)%   21012    21012      12345     12345% 5  *-*   5   *     2   *     2   *  % 4  | |   4  / \    1 *-*\    1  /*-*% 3 ** **  3 ** **   0 |   *   0 *   |% 2  \ /   2  | |   -1 *-*/   -1  \*-*% 1   *    1  *-*   -2   *    -2   *    switch dir   case 'down'    pts=[ 0 1; -2 3; -1 3; -1 5; 1 5; 1 3; 2 3 ];    mp = 'SOM leftright';   case 'up'    pts=[ 0 5; 2 3; 1 3; 1 1; -1 1; -1 3; -2 3; ];    mp = 'SOM leftright';   case 'right'

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -