0001 function repaint_inho(mat,mat_ref,vtx,simp, thresh, clr_def);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 if nargin<5
0019 thresh = [];
0020 end
0021 if nargin<6
0022 clr_def = [];
0023 end
0024 if strcmp(mat_ref, 'use_global')
0025 img.calc_colours.ref_level = mat_ref;
0026 end
0027
0028 if isempty(thresh)
0029 thresh = 1/4;
0030 end
0031
0032
0033 [colours,scl_data] = calc_colours( mat, clr_def, 0);
0034 ii=find( abs(scl_data) > thresh);
0035 this_x = simp(ii,:);
0036
0037 colours= permute(colours(ii,:,:),[2,1,3]);
0038 ELEM= vtx';
0039
0040 Xs= zeros(3,length(ii));
0041 Ys= zeros(3,length(ii));
0042 Zs= zeros(3,length(ii));
0043 switch(size(this_x,2))
0044 case 3
0045 idx_ = [1;2;3];
0046 case 4
0047 idx_ = [[1;2;3], ...
0048 [1;2;4], ...
0049 [1;3;4], ...
0050 [2;3;4]];
0051 end
0052 for idx=idx_
0053 Xs(:)=vtx(this_x(:,idx)',1);
0054 Ys(:)=vtx(this_x(:,idx)',2);
0055 Zs(:)=vtx(this_x(:,idx)',3);
0056
0057 if exist('OCTAVE_VERSION');
0058
0059 cmap = colormap;
0060 for i=1:size(colours,2);
0061 patch(Xs(:,i),Ys(:,i),Zs(:,i),cmap(colours(i),:));
0062 end
0063 else
0064 if size(colours,1)==1 && size(colours,2)==3
0065
0066
0067 hh= patch(Xs(:,[1:3,1]), ...
0068 Ys(:,[1:3,1]), ...
0069 Zs(:,[1:3,1]), ...
0070 colours(:,[1:3,1]), ...
0071 'EdgeColor','none','CDataMapping','direct');
0072 else
0073 hh= patch(Xs,Ys,Zs,colours, ...
0074 'EdgeColor','none','CDataMapping','direct');
0075 end
0076 end
0077 end