Measuring circles touching and the interfacial area


I am trying to measure how many times the blue circles touch the red circles, as well as the interfacial area of where the blue and red circles are touching using image J. Does anyone have any idea how I may best achieve this?



That can be resolved with region connection calculus.

What you are looking for is the “external connection” (EC) relation between blue and red regions. That can be done with the RCC8D plugins.

Thats great, thanks for your help! I’m being told I need at least two binary images open? I’m only trying to analyse this one image, and if I make even one image binary, will this not remove the red/blue regions?

You can segment the colours of your image and make two binary images out of that.

Thank you again for your help…

You’ll have to forgive me, I’m completely new to image J and dont really understand how to do this/use your plugin. Are they any instructions which come with the plugin which I can work through?

Please read the blog instructions to install and run the plugin.
Your case is similar to the section called “Example – pairs of fragmented regions” but you are looking for the EC relation. One of your images (X image) should have the blue discs as white (on a black background) and the other (Y image) the red+black_border discs as white also on a black background.
The “Show” option of the plugin should be set to “RCC8D”, so it shows the EC entries in the RCC table in a dark green colour.
The RCC table will show all the relations between blue discs (x axis) and red discs (y axis). Depending exactly what you want to find out you will have to scan the table in different ways to count. One blue region can touch different red regions at the same time and viceversa, and some blue discs touch other blue discs (and those are detected a single region) and the same between some pairs of red disc (also detected as one region). You should think carefully what kind of information is that you are after.
Hope it helps.

Okay thank you, I’m going to keep plugging away with this and hopefully get it to work!

Hi @gabriel

I have successfully segmented the colours to produce two binary images and have been running your plugin on the RCC8D setting with the two binary images aligned and attribute and details checked. However, this is only producing the log message which I have attached and displaying no table, do you have any idea why this is and how I go about producing the actual table containing the EC data in?

I have also tried to run the R8CCD macro script but this also came to no avail. Any guidance you could offer me would be greatly appreciated.


Are you using Fiji? If so please follow the instructions on how to install it in the blog posted earlier:
Fiji : Activate the Morphology update site, download the file, expand its contents somewhere and copy the two .class files to the /plugins folder (do not copy the .java files). Restart Fiji.
Note that in Fiji you should not copy the java files, only the .class files into the plugins folder and the commands would appear in the plugins menu after restarting.

Please follow the section “Computing relations between multiple regions” running RCC8D_UF_Multi
That should generate a new image/table called RCC.
Post your two binary images and the table when you have it done so I can have a look at the result.

Yes, I am using Fiji, I have the two class files copied in and have restarted. I have downloaded the file and pasted in the morphology_collection.jar file to fiji in the plugins as well.

I ran the multi file RC8D_UF plugin and generated this table. Also attached are the two binary images which are directly aligned when I run the plugin.

Thank you again,

Binary SiO2.tif (2.4 MB) Binary CB.tif (2.4 MB)

Here are screenshots of the two binary images which are in .TIFF format

I just realised I ran the wrong option. Will redo now.

So I believe this is telling me there are 10 external connections which does sound about right.

The images you uploaded are not the same size. Can you please check that.
Please use tiff files 8bit.

I think that is just due to the screenshots which I took, here is a screenshot of the screenshots…

“I have downloaded the file and pasted in the morphology_collection.jar file to fiji in the plugins as well.”

Those were not exactly the instructions given in the blog:
Activate the Morphology update site.

When you activate the site via Update… and then Manage update sites it would upload all the required files and keep it up to date.
What you have done might work, (if you copied all the Morphology files to the plugins folder) but you won’t get any future updates.

Yes 10 EC counts sounds approximately correct given that the original image is antialiased (and the boundaries are therefore not unequivocal). I noted that your disks have always a black perimeter and the red discs too. If you could draw the circles in a single colour, the result would be more accurate.

Depending on whether you include that border, you might get a different result as the EC is strict with regards to the regions extents: if the 2 regions just are 1 pixel away, they are not EC anymore and if they overlap by as little as 1 pixel they are returned as PO instead.
Hope it is of some help.

Sorry, I didnt quite realise what you meant and am still getting my head around using Fiji, but have updated and activated the morphology website now.

Yes, I am going to look into the MATLAB code which I have used to produce the circles to see if I can remove the borders.

Out of interest, what is RCC window showing?

And thank you again for showing me how to use your software, it’s been very useful!

  • is the pink RCC window

The RCC table shows the relation between each region in image X and every other region in image Y. The colour indicates the type of relation held (please check the Legend option to see what each colour means).
The x position in the table is the index to the nth region in image X, and the y position is the index to the mth region in image Y. The order of these regions follows the raster scan order by which they are detected (e.g. by the Particle Analyzer or Particles8).
So e.g. by scanning a column in the table you get the relations between a given region in X and all the regions in Y. By scanning a row you get the relations held between a region in Y and all the regions in X and so on.
For example in the table above, the pixel value at (0,0) means the relation between region 0 in X and region 0 in Y (it is pink which means DC (they are disconnected from each other). The dark green is the EC relation you are after. So scanning this table you can find the relation between any two regions across the two images.
Here is another recent discussion using RCC which shows a different application.

That thread also covers how to find which are the regions addressed in the table by their x and y index/order.
Also might find useful reading about this in these papers:
specially refs 3, 6 and 20 (the latter explains the fast algorithm in detail).

Oh okay, and yes, I’ll have a look through the papers as well. Thank you!