Home > chronux_1_1 > spikesort > graphics > clusterXT.m

clusterXT

PURPOSE ^

clusterXT temporary utility to show clusters

SYNOPSIS ^

function clusterXT(spikes, useassigns, show, threed);

DESCRIPTION ^

    clusterXT  temporary utility to show clusters
       clusterXT(SPIKES, [USEASSIGNS], [SHOW], [THREE_D]);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function clusterXT(spikes, useassigns, show, threed);
0002 %    clusterXT  temporary utility to show clusters
0003 %       clusterXT(SPIKES, [USEASSIGNS], [SHOW], [THREE_D]);
0004 
0005 %   Last Modified By: sbm on Wed Aug 10 22:15:26 2005
0006 
0007 if (nargin < 2 || isempty(useassigns)),  useassigns = spikes.overcluster.assigns;  cmap = spikes.overcluster.colors;  end;
0008 if (nargin < 3 || isempty(show)),  show = unique(useassigns);  end;
0009 if (nargin < 4),  threed = 0; end;
0010 
0011 if (nargin > 1),
0012     if (isfield(spikes, 'overcluster') && all(ismember(useassigns, unique(spikes.overcluster.assigns))))
0013         cmap = spikes.overcluster.colors;
0014     else
0015         cmap = jetm(length(show));
0016     end
0017 end
0018 
0019 show(show == 0) = [];
0020 
0021 clustlist = unique(useassigns);
0022 t = ([0:size(spikes.waveforms,2)-1]-spikes.threshT)./spikes.Fs;
0023 
0024 %%%%%%%%%%%%%%%
0025 cla reset; hold on;
0026 for j = 1:length(clustlist)
0027     k = clustlist(j);
0028     members = find(useassigns == k);
0029     waves = spikes.waveforms(members,:);
0030 
0031     if (k == 0),                color = [0 0 0];
0032     elseif (ismember(k,show)),  color = cmap(k,:);
0033     else,                       color = Clgy;
0034     end
0035     
0036     if (~isempty(members))
0037         if (~threed)
0038             h = mplot(t, waves, 'Color', color);
0039             set(h, 'ButtonDownFcn', {@raise_me, h});
0040             if (k == 0), hout = h;
0041             else,        hndl(k) = h;
0042             end
0043         else
0044             [lh,ph] = errorarea(mean(waves,1), std(waves,1,1));
0045             set(lh, 'Color', brighten(color, -0.6), 'ZData', repmat(k, size(get(lh,'XData'))));
0046             set(ph, 'FaceColor', color, 'ZData', repmat(k, size(get(ph,'XData'))), 'FaceAlpha', 0.8);
0047         end
0048     end
0049 end
0050 hold off; axis tight; xlabel('Time (samples)');  ylabel('Voltage (A/D Levels)');
0051 
0052 if (~threed),  uistack(hndl(show), 'top');
0053 else, cameratoolbar('SetCoordSys', 'y');
0054 end
0055 
0056 if ((length(show) < 33) && ~threed)
0057     leg = cell(length(show),1);
0058     for k = 1:length(show),  leg{k} = num2str(sort(show(k)));  end;
0059     if (any(useassigns == 0))
0060         legend([hout, hndl(show)], cat(1, {'Outliers'}, leg), 0);
0061     else
0062         legend(hndl(show),leg,0);
0063     end
0064 end
0065

Generated on Sun 13-Aug-2006 11:49:44 by m2html © 2003