function [labout,truelab] = combinecells(a,w)

imlab = getident(a,'image');
ll = unique(imlab);
n = length(ll);
lab = zeros(n,1);
truelab = [];
for i=1:n
   I = find(imlab==ll(i));
   out = a(I,:)*w;
   %o2 = mean(out);
   %o2 = median(out);
   o2 = prod(out);
   [tmp,lab(i)] = max(o2);

   truelab(i,:) = getlab(a(I(1),:));
end

classll = getlabels(w);

labout = classll(lab,:);
truelab = char(truelab);

