Height measurement

  • What is the image about? Provide some background and/or a description of the image. Try to avoid field-specific “jargon”.sam3.for imageJ.tif (66.2 KB)
    Hello Everyone,
    I hope you all will be healthy. I have a question regarding length and height measurement (Please see the attached file).
    The image got from the textile product and contains a lot of protruding fibers.
    Goal:
    I want to measure the length and height of protruding fibers. Length, I have already measured via the “Ridge detection” technique. but am not able to measure the height (how high the fibers are from the surface).

is there any way to measure the fiber height automatically via any plugin. Because manually can do it for every individualö fibers but want to measure via plugin similar as did via “Ridge detection”. (perpendicular distance from the surface).
I will be very thankful if anyone of you can help me in this regard. Many Thanks

BR
Ahsan

I think it can be done. Here my suggestion:

You need two components.
A) the objects of your fibers which you might have already if you detected them with the ridge detection.

B) a measure of distance from the surface. This can be easily implemented using an euclidean distance map. It just needs a definition of where this surface is.
Based on the image you provided you can generate for instance a white empty image. The surface would be at the bottom. So you create a background stripe at the bottom. Then you generate an euclidian distance map.
Now you can measure the distance of each pixel of the objects from A) from the surface on this EDM. Take the largest value thats your height.

Here a macro for generating the EDM:

setForegroundColor(0, 0, 0);
run("Options...", "iterations=1 count=1 black edm=32-bit");

newImage("Untitled", "8-bit white", 777, 87, 1);
makeRectangle(0, 77, 777, 10);
run("Fill", "slice");
run("Distance Map");

Easiest is if your surface definition stays the same or you have a way of locating the surface automatically. Otherwise it is of course possible to define the rectangle manually.

2 Likes

Agree with @schmiedc about the approach.

Keep in mind when analyzing the data that your fibers do seem to be closer or farther away from where the image is being taken, which will change their apparent size. A sample with more fibers close to the camera (like the large one in the center) will appear to be larger than a sample with larger actual fibers that are farther away (and maybe more in focus).

2 Likes

Hello Christopher, Thank you very much for your support. I stuck at one point. As you provided me the macro of EDM. I can get the white image when running the macro. But I am confused that how to bring my image into it. I tried it according to my knowledge but unfortunately, I did not get success. Kindly can you help me that how I have to run this macro on my new image? I am attaching another image and there I want to run the macro that you provided to measure the heights of fibers in the image.

Many many thanks for your support.

Yes, you are right. I observed this point… Many Thanks.

Do you have idea about any other way to measure the height? Because now I observed that the images that am getting from the system have different references.

I tried to do via “Dynamic profiler” to measure the height of the pixel and converted the pixels into the required unit. But am not sure that is the correct approach.

Thanks in advance for your time and advice.

It would be helpful to provide examples for both of these problems.

Hello, @schmiedc thanks for the reply.
In the attached image you can see the protruding fibers below and above the surface.
I have to measure how far the fibers are from the surfaces. For the above side, my reference will be the top of the surface and for the bottom side, my reference will be the bottom surface. (I mentioned in the image).
Please see the excel file just to explain to you how am doing. Here are the steps that am following:
run(“Ridge Detection”, “line_width=7 high_contrast=230 low_contrast=50 correct_position estimate_width extend_line displayresults method_for_overlap_resolution=NONE sigma=1.51 lower_threshold=0 upper_threshold=15 minimum_line_length=0 maximum=0”);
saveAs(“Results”);
makeRectangle(0, 1440, 5568, 528);
run(“Dynamic ROI Profiler”);(Here am stuck. How the measure the height)

The second two images have to investigate. Many many thanks for your time. Your suggestions will really help me. I hope I explain to you in the correct way. If you need any questions then please let me know. Thanks.
Fiber A1.tif (8.1 MB) ImageJ-Fiber Height measurement.csv (1.1 MB)

Once again Thanks
Best Regards
AA

If the images are taken differently, without some sort of reference ruler there is no way to judge the actual size of anything. A picture of the moon and a picture of a building taken with the same camera will have very different effective “pixel sizes.” There is no default value for pixels, everything is relative.

2 Likes

That said, if something like the green line length were 100% constant between images, you might be able to use that thickness as an estimate… maybe.
image

1 Like

Yes, the thickness mostly remain same.

Hi
@ahsanali

I use your image Fiber A1.tif.(From the first thread)

selectWindow("Fiber A1.tif");
run("Set Scale...", "distance=0 known=0 unit=pixel");
run("Duplicate...", " ");
close("\\Others");
run("Duplicate...", " ");
run("Invert");
imageCalculator("Subtract create 32-bit", "Fiber A1-2.tif","Fiber A1-1.tif");
selectWindow("Result of Fiber A1-2.tif");
run("Gaussian Blur...", "sigma=20");
wait(100);
setAutoThreshold("Default");
//run("Threshold...");

run("Create Selection");
selectWindow("Fiber A1-2.tif");
run("Restore Selection");
setBackgroundColor(255, 255, 255);
run("Clear", "slice");
run("Select None");
setAutoThreshold("Default");
//run("Threshold...");
//setThreshold(0, 173);
setOption("BlackBackground", false);
run("Convert to Mask");
run("Dilate");
run("Dilate");
run("Analyze Particles...", "  circularity=0.00-0.30 show=[Overlay Masks] exclude overlay add");
roiManager("Show None");
roiManager("Measure");
selectWindow("Result of Fiber A1-2.tif");

run("Create Selection");
selectWindow("Fiber A1-2.tif");
run("Restore Selection");
close("Fiber A1-1.tif");
close("Result of Fiber A1-2.tif");
1 Like

Hi Mathew,
Thanks for a great macro. I just have a question:
How did you get the image that you showed? because am getting different wih your macro.
The second point is, here you are measuring the area but I need to measure the length that I did via ridge detection. Is it possible to measure the length instead of area.

Many Thanks for time and support.

I got that image from your macro (I know due to Overlay Mask). But your image is bit different.

BR
Ahsan

@ahsanali
Open a new original image and click on “show all” of ROI Manager.

Thanks for the quick reply.
Got this image but still the only area.

BR
Ahsan

If you increase the size threshold to eliminate all of the points, and then use the Skeletonize functions, you also might get what you are looking for, though again, it will be in pixels, and if you don’t know the size of the pixels or the pixel sizes are changing, it won’t do you much good.

You showed the same processed image again, not the original image.

2 Likes