function [shape] = shape2d(M); % SHAPE2(M,S,GIIDs) ---- This function calculates the the 'shape' of each group in % field 'M', and modifies the measure so that it will return 1 for a perfect circle, % and higher values the more the group diverges from a circle. % % See 'shape' for details on the shape index. d = diameter2d(M); [k A] = convhull(M(:,2),M(:,3)); shape = d^2/A; % Since the shape function returns (4/pi) for a circle, the index is now multiplied % by pi/4 to standardize it to a circle. shape = shape * (pi/4);