Measuring accurate height of curved object

fiji
#1

Hello everyone,

My ImageJ knowledge is very basic at the moment, and I am trying to measure colour thresholded plant parts for my master’s thesis. I have a large amount of pictures, so I am trying to automate the process as much as possible. Each part is always in the same position on every picture. When analyzing particles, I found that objects with a curve, such as some stems, do not give an accurate width and height measurement.

Is it possible to measure the real length and width of these objects automatically and accurately? The width would ideally be measured around a cm from the right side of the object, but the width at the center of the object would also work.

Sample picture of the stem
Tulip Stem.tif (4.6 MB)

1 Like

#2

Howdy ThT,
Have you tried using the ‘Magic Wand’ tool then Analyze > Measure for starters?
Bob

1 Like

#3

Hello Bob,

Thank you for the reply! I have color thresholded the image and used the magic wand tool. However, I feel that the measurements of the length and width of the stem (in this orientation the width and height respectively), are not accurately measured.

In the case of the length of the stem, the feret actually comes close, but I would ideally have the same results as when I draw a segmented line along the length of the stem manually.

Mainly the width of the stem (in this orientation the height), does not get an accurate measurement when measuring the whole object using the magic wand. Here, it takes the height of the entire object, as it seems to just put a rectangle over the object and measures the height of that rectangle.

I may just be missing a set measurement option that measures what I want. Or perhaps there is some other way to measure what I want automatically?

Thank you!

What I want to measure:
What I want to measure.tif (1.2 MB)

Threshold Image:
Tulip Stem Threshold.tif (1.5 MB)

0 Likes

#4

Dear @ThT
Essentially you are trying to calculate:

a) length of the stem:
to do it you could analyse the so-called skeleton of the image:


in particular, you are interested in the “Longest Shortest Path”.
You can do it using Fiji:

  1. get the mask of the stem (you can use the magic wand, or with some efforts it could be possible to find a n automatic way to get it)

  2. skeletonize it, you can use the Fiji->Process->Binary->Skeletonize
    obtaining something like this

  3. analyze the skeleton with the tool above-mentioned: Analyze :arrow_forward: Skeleton :arrow_forward: Analyze Skeleton (2D/3D)
    25


    the length of your stem is well estimated by the Longest Shortest Path of the Skeleton.

b) width of the stem:
You could try evaluating the Distance Map (https://imagej.nih.gov/ij/docs/guide/146-29.html#toc-Subsection-29.8 Each foreground pixel in the binary image is replaced with a gray value equal to that pixel’s distance from the nearest background pixel (for background pixels the EDM is 0).
You can calculate it, using Fiji->Process->Binary->Distance Map… on the mask of the stem you obtained before, obtaining something like that:

The Maximum value will give you the half of the maximum width of your stem.
So the width is estimated as: Max * 2

It’s a very naive approach and I am sure someone here has a better way to estimate it and has developed something more robust and reliable for thickness estimation.
Here for example a plugin for 3d Thickness.

Hoping to being helpful,
Emanuele Martini

2 Likes

#5

Hello again ThT,
I may a posed my question incorrectly. I am wondering if you are just trying to obtain the area of the stem image, or is there a reason you actually need the H_W separately? I only ask because I am a bit of a stickler for details.
Bob

1 Like

#6

Just an add, I (we in the forum) could help you more on the automation part (automatic stem recognizing, automatic features like length, width, etc. extraction and analysis…) but it’s quite important to understand how much this is supposed to be part of your master’s thesis.
In other words, how much is supposed to be your job for thesis: is your thesis more about find an algorithm to get the data or is more a biological/scientific thesis about the plants themselves?

1 Like

#7

This was very helpful and seems to be exactly what I need. The local thickness plugin is also very interesting, and I will definitely look into that.

Regarding the purpose of the thesis, finding an algorithm for automatic measuring of multiple pictures in bulk is a significant part of the project. This means that at some point, all the data from multiple measurements from multiple pictures has to come together in an excel file. Therefore I will try to construct a macro which can measure an entire folder of pictures automatically, and can save the data in an ordered way.

Unfortunately I am quite busy at the moment, so I can’t reply very quickly. I greatly appreciate the help!

1 Like

#8

Hello Bob,

As the length and width of the stem are important traits for me to look at, simply measuring the area of the stem with the magic wand won’t really work for me.

0 Likes

#9

Hello again,
Firstly, the two images you supplied are scaled differently in a ratio of 1.69 in both the X and Y directions with the color image being the smaller, that would give you some very different measurements. You can rescale them to match in Edit > Scale and that should fix any main problems.
Bob

0 Likes