what is the right method to calculate branch length

7 views (last 30 days)
Hello everyone,
1st of all i know that there are some post on the related subject, but i looked them up and i didn't find any explanation about the right and true method which relevant to my case.
let me describe to you my conflict,
i am having this image:
this is a skeleton branch. i would like to calculate the length of the branch and i tried several methods. but i get different results for each method and i would like to know why and what is the correct method to calculate the length. On the 1st method i use the function bwconncomp which return structure and the length located under the .PixelIdxList field, by applying this method i'm getting the result of 74 (pixel's i assuming) On the 2nd method i use the function regionprops in that way:
if my image called vessel_3 :
perim = regionprops(vessel_3,'Perimeter');
perim = perim.Perimeter/2
and this is the result: 88.3259
i got the 2nd method from this post: http://blogs.mathworks.com/pick/2012/04/27/calculating-arclengths-made-easy/#respond
now i didn't able to understand how the perimeter option of regionprops func works on branch object with 1's pixel thickness. i looked up in the help of the func and the author gave example of large object. does the function add more pixels of 1's values around the object and that could explain the difference between my results?
Thanks again!
could someone explain me what is the right method and how

Answers (1)

Image Analyst
Image Analyst on 7 Apr 2014
It depends on what you define as length. If you have two pixels in this configuration
0 1
1 0
What's the length? Square root of 2 pixels long? Or 2 pixels long?
  2 Comments
daniel
daniel on 7 Apr 2014
Thanks for the quick replay, I'm assuming that since we have twisted curve and not straight line we the appropriate method to measure the branch is by counting is pixels?
fix me if i am correct?
eventually i am going to use the result to compare the length to other branches lengths, so does it really matter what method i use ? could you say that one more accurate than the other. all the branches in my project are twisted like vessel form , non of them is complete straight line.
Thanks again
Image Analyst
Image Analyst on 7 Apr 2014
Neither is right or wrong. It's just two different ways of considering it. You can go by pixel counting if you want, or use the "pixel center - to - pixel center" method. If you want to do pixel counting you can do
theArea = sum(binaryImage(:));
if there is just one object in the binary image, or if there are more than one:
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'Area');
allAreas = [measurements.Area];
The areas of skeletons will be their length via pixel counting.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!