function cp = cprops(label,image,icx,icr,ich,irx,irr,irh,ir1)
% cp = cprops(label,image,icx,icr,ich,irx,irr,irh,ir1)
%
%   properties: (1) # pixels, (2) # row peaks, (3) 16's, (4) 4-8's, 
%                (5) gray,  (6) col pk radii,(7) col pk hts, (8) row radii,
%                (9) row hts, (10) row avg
[m n] = size(label);
cp = zeros(max(max(label)),10);
for i1 = 1:m
  for j1 = 1:n
    l1 = label(i1,j1);
    if l1>0   % for all non-zero pixels
      cp(l1,1) = cp(l1,1)+1;     % pixel count
      cp(l1,10) = cp(l1,10)+i1;  % sum row values
      if irx(i1,j1)>0    % if there's a row peak detected here
        cp(l1,2) = cp(l1,2)+1;       % count number of row peaks detected
        cp(l1,8) = cp(l1,8) + irr(i1,j1);    % sum row peak radii
        cp(l1,9) = cp(l1,9) + irr(i1,j1);    % sum row peak heights
      end
      if ir1(i1,j1) == 16    %  if there's a relative max col peak height
        cp(l1,3) = cp(l1,3)+1;  % count col peak maxes
      elseif (j1+1<=n) & ir1(i1,j1)==4 & ir1(i1,j1+1)==8   % or a left up to right down
        cp(l1,4) = cp(l1,4)+1;                             % col peak height transition
      end
      cp(l1,5) = cp(l1,5) + image(i1,j1);  % sum gray levels
      cp(l1,6) = cp(l1,6) + icr(i1,j1);    % sum col peak radii
      cp(l1,7) = cp(l1,7) + ich(i1,j1);    % sum col peak heights
    end
  end
end
[mc nc] = size(cp);
for i1 = 1:mc
  pixct = cp(i1,1);
  rowct = cp(i1,2);
  cp(i1,5) = cp(i1,5)/pixct;
  cp(i1,6) = cp(i1,6)/pixct;
  cp(i1,7) = cp(i1,7)/pixct;
  cp(i1,10) = cp(i1,10)/pixct;
  if rowct>0
    cp(i1,8) = cp(i1,8)/rowct;
    cp(i1,9) = cp(i1,9)/rowct;
  end
end
