can someone help me to measure the avgferet, avgminferet and area of the edges in my image in this code
Show older comments
edges = edge(imgContrast,'Canny');
se = strel('disk', 1);
edgesClean = imclose(edges, se);
edgesClean = imfill(edgesClean, 'holes');
zoneMask = zoneMask .* im2double(edgesClean) .* DD;
% Calculate connected components
cc = bwconncomp(zoneMask);
% Calculate region properties for each connected component in this zone
statscc = regionprops(cc, 'Area', 'Centroid', 'Eccentricity', 'Perimeter', 'MajorAxisLength', 'MinorAxisLength','Circularity');
% Calculate features for this zone
numObjects = cc.NumObjects;
if numObjects > 0
areas = [statscc.Area];
profileCounts(k) = numObjects;
totalArea(k) = sum(areas) * pixelSize^2;
zoneArea(k) = sum(zoneMask, 'all') * pixelSize^2;
% Calculate average size of mitochondria for this zone
avgSize(k) = mean(areas) * pixelSize^2;
circularities = [statscc.Circularity];
circularities(circularities > 1) = 1; % Cap circularities greater than 1 at 1
avgCircularity(k) = mean(circularities(isfinite(circularities)));
ferets = [statscc.FeretDiameter];
avgFeret(k) = mean(ferets) * pixelSize;
minFerets = [statscc.MinFeretDiameter];
avgMinFeret(k) = mean(minFerets) * pixelSize;
end
Does this function work? Is this how you properly calculate feret diameters and the other features? Can someone please confirm? Thank you!
3 Comments
Chanille
on 27 Apr 2023
John D'Errico
on 27 Apr 2023
Please don't post the same question repeatedly.
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
