Number of Grains Along a Linear Line

Having used ImageJ previously in your module, I know it is good at finding the area and number of grains for different phases but if I want to find out the total number of grains, including all phases and orientations, along a line - can I do that on ImageJ?

There are different light and dark grains in the image and as the dark grains have very similar shades it is difficult to define boundaries.

Would you have any advice on how to go about finding the number of grains along a straight line, please?

Thanks in advance.

Hi and welcome to the forum,

could you provide an example image for us to understand your problem?

I understand the distinction between grains isn’t great which is because it is an external surface and not taken under a microscope.

Could you please provide a .png and not a .jpg since .jpgs come with lossy compression. Which is problematic for most image processing/ analysis.

Could you point out the grains, or the objects you would like to segment (separate?).

Thank you!

I feel I am able to use ImageJ for separation but im wondering if it has its own method similar to mean linear interception for finding the number of grains in a line

Looking at your image I think Weka Segmentation would be a good shot: Maybe you can also look into ilastik which provides similar features with more costumization:

I am not aware of an in-built feature that would count along a LineROI. But I think it would be relatively easy to get the number of objects that would touch a line ROI. But this might need a macro.

Why do you require the measurement along a line? Maybe one can find a easier solution.

Thank you for your reply, I will delve into those links deeper.

I think your Line ROI method matches that of the mean line intercept method if im not mistaken?

I’m trying to find how the size and number of grains varies between segments of a part and compared to other parts. I can do this manually through more traditional methods but am intrigued as to whether there is a quicker and easier way using software.

Thanks again.

Ah it has a name. Cool, so if you search for mean linear intercept you find some references. Some videos how to implement that in Fiji and including a macro:

Maybe you can adapt some of these methods for your needs. But if I were you could just go the standard image analysis route.

  1. I would segment your grains, by for example the means I pointed out.

  2. Depending on your question you can then perform the analysis in a ROI or the entire image. For the ROI I would draw rectangle selections in the segmented image (the binary mask) of a fixed size. Position of the rectangle is either random or depends on your research question. You can crop this ROI or do the analysis restricted in the ROI.

  3. Using then the Particle Analyzer ( - with excluding segments on the edge - would allow you to measure the number and size of grains.

Such an analysis could be also easily automated.

Okay, that’s brilliant thank you very much.

I will try using ImageJ and the rectangle selections you have suggested and use the standard mean linear intercept to make a comparison between the two methods.

Hopefully this will provide sufficient information.