0001 function plot_cylinder_anime(p, h, Q, id)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 global cancel;
0015
0016
0017 [Z, I] = movie_current_load(id, p);
0018
0019 if isfield(p,'abs_mode') && p.abs_mode==1
0020 Z = abs(Z);
0021 end
0022
0023 if isfield(p,'max_norm') && p.max_norm==1
0024 Zmax = max(abs(Z),[],2);
0025 Z = vb_repmultiply(Z, 1./Zmax);
0026 else
0027 Zmax = max(abs(Z(:)));
0028 Z = Z./Zmax;
0029 end
0030
0031 Zmax = max(Z(:));
0032 Zmin = min(Z(:));
0033 caxis([Zmin Zmax*p.show_max]);
0034
0035
0036 if isfield(p,'wmulti') && p.wmulti==1
0037 load(p.conn_file, 'mar');
0038
0039 mar = mar(id.Index);
0040 Z = vb_repmultiply(Z,mar);
0041 end
0042
0043 [ND, T]= size(Z);
0044
0045 angle = p.angle;
0046 alpha_val = p.alpha(1);
0047 alpha_area = p.alpha_area(1);
0048
0049 view(angle);
0050 alpha(h.hf, alpha_val);
0051
0052
0053 if p.video==1
0054 writerObj = video_prepare(p.video_dir);
0055 end
0056
0057
0058
0059 Nstep = ceil(abs(p.alpha(2)-p.alpha(1))/p.alpha(3));
0060 zoom_factor = nthroot(p.zoom_factor, Nstep);
0061 k = 0;
0062 while alpha_val > p.alpha(2)
0063 if p.video==1
0064 writeVideo(writerObj, getframe(1));
0065 end
0066 alpha_val = alpha_val - p.alpha(3);
0067 alpha(h.hf, alpha_val);
0068
0069 if p.roi==1
0070 alpha_area = alpha_area - p.alpha_area(3);
0071 alpha_area = max(alpha_area, p.alpha_area(2));
0072
0073 alpha(h.h_area, alpha_area);
0074 end
0075 if p.face_on
0076 alpha(h.h_face, p.alpha_face*(1-(k/Nstep)));
0077 camzoom(zoom_factor);
0078 k = k+1;
0079 end
0080 pause(p.pause1)
0081 end
0082 if p.face_on
0083 alpha(h.h_face, 0);
0084 end
0085
0086 set(h.hf , 'FaceColor',p.faceclr0)
0087
0088 set(h.hf, 'SpecularStrength', 0, 'AmbientStrength', 1.0);
0089 if p.roi==1
0090 set(h.h_area, 'SpecularStrength', 0, 'AmbientStrength', 1.0);
0091 end
0092
0093 for n=1:p.Ntime
0094 if p.video==1
0095 writeVideo(writerObj, getframe(1));
0096 end
0097
0098 angle = angle + p.dang;
0099 view(angle);
0100
0101 pause(p.pause1)
0102
0103
0104 if cancel == true
0105 break;
0106 end
0107 end
0108
0109 if p.pmove==0, return; end;
0110
0111
0112 if p.roi==1
0113 alpha(h.h_area, p.alpha_area(2));
0114 end
0115 t = 0; ts = 0; r0 = 0.01;
0116
0117 while ts <= T
0118 [az, el] = view;
0119
0120 title(h.ax_time, sprintf('%.1f[ms]', p.Timefrom + ts*1000/p.Tfreq), 'Color', 'w', 'FontSize', 20);
0121
0122
0123 if ts > p.Tstay
0124 if ~isempty(p.Tstop) && ts > p.Tstop
0125
0126 else
0127
0128 angle = angle + p.dang;
0129 end
0130 end
0131 view(angle);
0132
0133 t = t + 1;
0134 ts = ts + 1;
0135
0136
0137 tc = mod(t-1 , T) + 1;
0138
0139
0140 for m=1:ND
0141 n = I(m);
0142
0143
0144 [J, Q{n}, tp] = set_cylinder_val(Q{n}, Z(m,tc), t, p.dN);
0145
0146
0147 set(h.hp(n), 'FaceVertexCData',J);
0148
0149
0150 if p.vertex_show > 0
0151 val1 = Q{n}(tp(1));
0152 val2 = Q{n}(tp(end));
0153 col1 = get_col_from_val(val1,[Zmin Zmax],p.cmap2);
0154 col2 = get_col_from_val(val2,[Zmin Zmax],p.cmap2);
0155
0156 if val1 >= p.th_show*Zmax,
0157 switch p.vertex_show
0158 case 1
0159 rd1 = p.Msize*(val1-Zmin)/(Zmax-Zmin);
0160 case 2
0161 rd1 = p.Msize;
0162 end
0163 else
0164 rd1 = r0;
0165 end
0166
0167 if val2 >= p.th_show*Zmax,
0168 switch p.vertex_show
0169 case 1
0170 rd2 = p.Msize*(val2-Zmin)/(Zmax-Zmin);
0171 case 2
0172 rd2 = p.Msize;
0173 end
0174 else
0175 rd2 = r0;
0176 end
0177
0178 set(h.hp1(n), 'MarkerFaceColor',col1,...
0179 'MarkerEdgeColor',col1,...
0180 'MarkerSize',rd1);
0181 set(h.hp2(n), 'MarkerFaceColor',col2,...
0182 'MarkerEdgeColor',col2,...
0183 'MarkerSize',rd2);
0184
0185 end
0186 end
0187
0188 if p.video==0
0189 pause(p.pause2)
0190 end
0191
0192
0193 if cancel == true
0194 break;
0195 end
0196
0197 if p.video==1
0198 writeVideo(writerObj, getframe(1));
0199 end
0200 end
0201
0202 if p.video==0, return; end;
0203
0204 close(writerObj);
0205 return