Neighbour analysis with Biovoxxel toolbox

Hello all,

I try to perform a neighbour Analysis with the Bio Voxxel Toolbox for ImageJ. I try to figure out the number of nearest neighbours of grains of a specific Phase (black-white Image)
To this end, I applied the neighbour Analysis for particle neighbours with a radius of 2 Pixels. I get a result, but I dont get the number of grains with zero neighbours. They seem to be counted for grains with 1 neighbour. Furthermore, in the resulting colorcoded (blue grains 1 neighbour, red grains two neighbours) Image some particels disappear. Can anybody help?

3054neuMap1qtz.tif (4.9 MB)

P-NbHood_2_3054neuMap1qtz.jpg-1.tif (4.9 MB) .

Hi @mkemperl,

I can reproduce the problem.
Will look into it, seems to be a bug. Try to solve this till next week.

Dear @mkemperl,

I did a bugfix for the Neighbor Analysis in the bioVoxxel Toolbox and tested again. Everything works EXCEPT the neighborhood with 2 pixels :scream: :persevere:
And I could confirm that on another artificial example image.
… but I have no clue :thinking: why that is the case. If you try 3 pixels it works well. I think even 1 pixel does the job.
For now you can update to the new version of the toolbox and test it and I will see, if I can somehow figure out what is the problem with a 2 pixel neighborhood.

Thank you very much!

Hello again,

the neighbour Analysis with 3 Pixels radius works fine now. thanks a lot. But here another Question also regarding neighbour Analysis. When trying to apply the neighbour Analysis on another Image (attached) i get the following macro error: “This command requires an area selection in line 2879 - run (“Enlarge…”, “enlarge=” + hoodradius + “Pixel” <(>”. I dont know what this means. I tried to enlarge the Image under “Edit - Selection - Enlarge” and typed in the neighbourhood radius but it doens´t work. And I dont know what is meant with "hoodradius + “Pixel”. I understand that I have to adjust the Image size but I dont know how.

Many thanks for answers

2997D2Si-1.tif (14.4 MB)

Dear @mkemperl,

Sorry, my mistake. There was a problem with scaled image units and since your image is scaled to inches, it couldn’t find the particles.
I uploaded a new version, which fixes that bug.
Please let me know if against all expectations, it still makes some problems.

Great! Now it works. Thank you :slight_smile:

Hello there again!

I have again some troubles withe the neighbour analysis with BioVoxxel. Just as before there are still some grains missing in the resulting colour-coded map (see attachement). I tested it with neighbour pixel distance of 1-10 pixels but there are always some grains missing, apart that a too big neighbour distance distorts the result.
Furthermore, I could figure out, that the missing grains seem to be assigned to grains with 0 neighbours in the results table, but are included in the counting for neighbour grains (see example yellow grains).

Can anybody help me?

original.tif (5.3 MB)
result map.tif (5.3 MB)
Values.csv (71 Bytes)

Sorry, here with values

Dear @mkemperl,

I cannot exactly reproduce the issue you see in your image but I can reproduce the problem, that a few particles are indicated as having no neighbors while they are in the range of the specified 10 pixel particle neighbor distance.

One additional thing which is important is that the distance can only be defined as a single number not as a range. So, 1-10 will not work. you can just test 5 or 8, or 10, etc. But that is not related to the issue of incorrectly classified particles.

I will have a look into this and see, if I can find the solution for it. On all my previous test images, I did not run into such a problem. :thinking:

many thanks for the answer. I did not test a range but the distance as a single number.

Dear @mkemperl,

so, I found the problem. ImageJ was not respecting its own setting for the wand tool when the “8-connected” setup was set in the main menu and the wand tool was used in a macro like the “Neighborhood Analysis”. This seems to have changed in one of the last IJ-versions.

I uploaded a new version of the toolbox, which fixes (actually circumvents) this bug.

Please test it again on your image. For me it worked now.
thanks for reporting this issue :grinning:

Now it works!
Thank you so much :smile:

1 Like

Hello there!
Again, I have some troubles with the neighbour analysis of BioVoxxel. This time the number of neighbours does not fit to the assigned colours. In my example image the isolated red grains within the big light blue grain are assigned to have 2 neighbours referring to the colour coding (red= 2 neighbours). But I cannot find the second neighbour. As far as I can see this concerns also grains with different amounts of neighbours. I tried this for different pixel distances (1, 2, 3) and the results are never correct. Can anybody help? Attached you will find also the original binary image.

Many thanks in advance!

P-NbHood_3_29973D1.jpg-1.tif (2.4 MB) Calibration_29973D1.jpg-1.tif (36.5 KB) 29973D1.tif (2.4 MB)

Thanks for reporting @mkemperl,

I will look into this asap. Which will be by next t week.

Kind regards

Thanks a lot!

Kind regards

Dear @mkemperl,

It is related to how ImageJ creates ROIs for particles. In your case I just looked at this for the indicated red particles in the big light blue one. The small included particle in the big one (below indicated by the arrow) makes the problem, because it is completely included in the big one and when ImageJ is counting the neighbor particles, this one is included and cannot be excluded from the count.

Initially, I tried to do the counting different but then particles with cavities made problems and were counted multiple times.

So, this is currently an ImageJ related limitation, I cannot overcome :cry:

I tried to overcome this by eliminating included particles during the analysis by filling holes but then those included particles will not be analyzed themselves (see the red arrows).


So, there will always be a drawback. I will upload this Toolbox version by now and you can test the additional function “exclude inclusion particles” (a new checkbox) and see, if this serves you. Unfortunately, some of those problems will not be avoidable.

Hope it helps anyway