# Counting number of pores in 3D

Hi all,

I am trying to count the number of pores in a 3D stack of a soil column. I have a binary image and I want to filter out pores less than 4 voxels. For some reason, both the object counter and particle analyzer in Bonej are showing only 11 particles in my image which is incorrect. Can anyone assist me with this? My voxel size is 0.35 * 0.35 * 0.625mm(z-axis).

I also wanted to make sure if removing anything less than 4 voxels, in my case, will eliminate all the pores<0.75mm(which is my intention).

I have uploaded 50 slices out of my stack for reference, can anyone please help me count the white pores in the 3D?

Any kind of help will be greatly appreciated!

Thanks,
Sumancropped stack.tif (7.3 MB)

I think you have a problem with units. Size filtering is done using calibrated volumes, in your case mmĀ³.

1 pixel = 0.35 Ć 0.35 Ć 0.625 mmĀ³ = 0.0765625 mmĀ³
4 pixels = 4 Ć 0.0765625 = 0.30625 mmĀ³

Try setting your cutoff to 0.30625 mmĀ³ and report back.

Filtering on particle length or diameter is a bit more difficult and would have to be done after all the particles have been measured: basically apply the filtering criteria to the results table, get the list of remaining particle labels then apply that to the particle label stack.

1 Like

Thanks for the suggestion, Michael.

I tried using the same cutoff and it shows that only 11 particles are detected. Even if I do not provide any cutoffs, it only detects 13 particles for my image. I do not know where I went wrong.
In 2D slice, if I remove particles smaller than 4 pixels using analyze particles, which is equivalent to 0.35 * 0.35 * 4 = 0.49 m^2, then corresponding equivalent cylindrical diameter (ECD) = 0.79 mm will be removed. (i mean particles less than this ECD)
So, itās difficult to apply the same thing in the particle analyzer or 3D object counter, right? I have read some papers where they mentioned that removing 4 voxels was done to remove any particles less than around 1 mm and this is creating more confusion in my understanding.

Thanks,
Suman

Hi @Suman56,

It seems that you have a pb of inverted lut, your pores are displayed in white but their value is 0, so 3D Object counter will not detect them but instead will detect the background. You need to invert your selection so pores are displayed with non-zero values.

Hope this helps

Best

Thomas

2 Likes

True for BoneJās Particle Analyser too. It works only on the foreground pixels (255), regardless of what LUT you are displaying.

1 Like

I tried both ways and I am getting the same count irrespective of what LUT I am using.

Hi @mdoube,
tried both ways but didnāt work. I am getting the same result.

Hi @mdoube and @ThomasBoudier,

I got your point now. Even if I am inverting the image, it was always assigning a zero value to my pores. Thanks for the help.

Sounds like you were only inverting the look-up table (LUT) with Image > Lookup tables > Invert LUT, rather than inverting the underlying pixel values with Edit > Invert. Itās helpful to hover your cursor over images and look at the status bar to see what the actual pixel value is, which can be totally different than how it appears to your eyes.

1 Like

Exactly, that was my problem. I didnāt know that inverting LUT and just doing the āInvertā was different thing. Thanks for the help.

Hi Michael,

I could get the porosity values after filtering out particles that are less than 4 voxels. Next, I am trying to figure out the Equivalent Cylindrical diameter (ECD) of those pores. For that, I need to obtain the length of those pores and divide the volume by that length, and get the area that gives me the ECD, right? As long as I do not know how elongated those pores are, it wonāt make any sense how big the diameter is, for a particular voxel.

Do you think thereās any better way to do this? Please let me know.

Thanks,
Suman

Turn on Feret diameter in the dialog box, which will give you the maximal distance between two points on each poreās surface. Volume is always calculated and reported. Then you can do the calculation based on an assumption of a cylinder-shaped pore with l = Feret diameter. Bear in mind that many pores will not be particularly cylindrical in nature. You may find it interesting to compare your ECD with local thickness (turn on thickness in the dialog).

1 Like

Hi Michael,

Thanks, for the suggestion. Thatās so helpful.

I have a concern regarding the Feret diameter calculation for pores with branches. Some pores might have connected branches for which the Feretās diameter might be underestimated. Volume is reported after combining all the connected branches as well, right? I believe imagej treats the pores with several branches as a single pore. In such cases, length based on Feret will be underestimated and I will have overestimation of ECD, right?

Thanks,
Suman

An alternative approach is to run Skeletonize and Analyze Skeleton, then add up the skeleton branch lengths for each skeleton to get a total pore ālengthā. Skeleton lengths are easily contaminated by small branches, so you have to be careful to check that itās working as you expect. Iām also not sure exactly how to correlate the volume of each particle with its length using existing tools.

Particle Analyser doesnāt (yet) do this on a per-particle basis, but it could relatively easily with a bit of a hack on the analysis class. I raised an issue on our bug tracker that you can keep an eye on if you like.

1 Like