plotparw.m
来自「细胞生长结构可视化工具箱-MATLAB Toolbox1999.zip」· M 代码 · 共 142 行
M
142 行
% plot reference vectors of GCS for a 2d ip space when applied to training data data
% Using parzen windows in n-D space for visualisation map generation
function GcsProj = plotparw(GcsProj);
%UpdateStatus('Plotting Frquencies',[ 0 1 0 ]);
GcsProj.Gcs.Status = 'Plotting Frquencies';
GcsProj.Gcs.StatusColour = [0 1 0];
UpdateGUI;
Gcs = GcsProj.Gcs; % Only need to work with this section!
if strcmp(Gcs.Trained,'Yes')
Noc = size(colormap,1);
extent; %Calculate min and max values of x and y
xi=minx:(maxx-minx)/Gcs.NoPts:maxx;
yi=miny:(maxy-miny)/Gcs.NoPts:maxy;
if isempty(Gcs.cmap1)
visnorm = 'separate'
%visnorm = 'combined';
% figure;
% clf;
% whitebg('white');
% hold on;
% view(45,30);
% Axis([minx,maxx,miny,maxy]);
% for i = 1:size(Gcs.wvis,1)
% for j = i+1:size(Gcs.wvis,1)
% if (Gcs.C(i,j) == 1)
% plot([Gcs.wvis(i,1),Gcs.wvis(j,1)],[Gcs.wvis(i,2),Gcs.wvis(j,2)],'k');
% plot([Gcs.wvis(i,1),Gcs.wvis(j,1)],[Gcs.wvis(i,2),Gcs.wvis(j,2)],'k');
% end
% end
% end
% Now add no of associations data - just total, separate classes difficult to implement in colour
% offset=0.02; % offste used to prevent bars overwritting each other
% for i = 1:size(Gcs.wvis,1)
% plot3([Gcs.wvis(i,1),Gcs.wvis(i,1)],[Gcs.wvis(i,2),Gcs.wvis(i,2)],[0,Gcs.ztotal(i)],'r');
% end
% title('GCS Network with frequency counts');
% if vers >= 5
% eval(['rotate3d on;']);
% end
for cindex = 1:Gcs.NoClasses
eval(['Gcs.cmap' int2str(cindex) ' =zeros(Gcs.NoPts+1);']);
end
hwait = waitbar(0,'Calculating Frequency Distibutions ...');
Act=[];
ii=0;
for i=minx:(maxx-minx)/Gcs.NoPts:maxx
ii=ii+1;
jj=Gcs.NoPts+2;
for j=maxy:-(maxy-miny)/Gcs.NoPts:miny
jj=jj-1;
Ip=[i,j];
figure(hwait);
waitbar( ((ii-1)*Gcs.NoPts + Gcs.NoPts-jj+1)/(Gcs.NoPts.^2) );
% Find enclosing triangle
tri = findtri(Ip,Gcs.wvis,Gcs.C);
if ~isempty(tri)
% Transform pt to N-D space
Ipn = trans2n(Ip,Gcs.wvis(tri(1),:),Gcs.wvis(tri(2),:),Gcs.wvis(tri(3),:), Gcs.w(tri(1),:),Gcs.w(tri(2),:),Gcs.w(tri(3),:));
for k = 1:size(Gcs.wvis,1)
Act(k) = exp(-((norm( (Ipn-Gcs.w(k,:)) ,Gcs.metric)^2)./(Gcs.sigmav(k)).^2));
end
for cindex = 1:Gcs.NoClasses
eval(['Gcs.cmap' int2str(cindex) '(jj,ii) =Act*Gcs.z' int2str(cindex) ';']); % Do not adjust for priors!
end
else
for cindex = 1:Gcs.NoClasses
eval(['Gcs.cmap' int2str(cindex) '(jj,ii) = 0;']);
end
end
end
end
close(hwait);
end
normfac=0;
for cindex=1:Gcs.NoClasses
eval(['normfac = max(max(max(Gcs.cmap' int2str(cindex) ')),normfac);']); %normalisation factor = highest value within either map
end
for cindex=1:Gcs.NoClasses
figure
%subplot(2,2,3);
colormap(Gcs.c);
clf;
eval(['imagesc(xi,yi,Gcs.cmap' int2str(cindex) './max(max(Gcs.cmap' int2str(cindex) ')));']);
set(gca,'YDir','normal');
colorbar;
plotv2(Gcs);
colormenu;
if isempty(GcsProj.ClassLabels)
title(['Frequency of class ' int2str(cindex)]);
else
title(['Frequency of class ' GcsProj.ClassLabels(cindex,:)]);
end
drawnow;
end
figure;
[x,y] = meshgrid(minx:(maxx-minx)/Gcs.NoPts:maxx,miny:(maxy-miny)/Gcs.NoPts:maxy);
colormap(Gcs.c);
cla;
hold on;
for cindex=1:Gcs.NoClasses
eval(['mesh( x,y, (Gcs.cmap' int2str(cindex) './max(max(Gcs.cmap' int2str(cindex) ')) ) );']);
end
axis([minx,maxx,miny,maxy,0,1]);
view(45,30);
title('Frequency meshes for all classes');
if vers >= 5
eval(['rotate3d on;']);
end
drawnow;
% Colourmaps are stored in Gcs structure passed into function, so no more need to write to disk
% Save colourmaps to network file so that they can be used by post.m
%eval(['save ', filename]);
colormenu;
else
uiwait(errordlg('Network Must be trained before visualisation plots are created!'));
end
GcsProj.Gcs = Gcs; % Store calculated frequencies in structure
SaveGcs(GcsProj.Gcs);% And save to file
%UpdateStatus('Idle','default');
GcsProj.Gcs.Status = 'Idle';
GcsProj.Gcs.StatusColour = 'default';
UpdateGUI;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?