How to count things in a given area

Good morning,

Let’s say I have a photo with 3 particles and each of these particles have some nodules on them that I have to count. Is there any way to count the number of particles and to get the number of nodules per particle in the same time ?

I saw here : https://forum.image.sc/tag/ilastik , that it would maybe be possible by using an atlas mask but I don’t manage to do it.

In the data table that we have at the end of the classification, what the AtlasMapping refers to ?

Best regards

Hi @Antoine_Cure,

the atlas mapping will refer to the object_id in the atlas image.

Maybe this illustration explains it better than I can do it using words:

Okay, in that image, the top left square represents the first round of pixel and subsequent object classifications, where you export the label id image. The numbers represent the ids of the objects in that image. Meaning all pixels in this image that belong to the respective object have that value (colors are here randomly assigned).
Top right, you have the result of the pixel and subsequent object classification with the “smaller”, container objects (nodules in your case I guess). These have ids, to, indicated by the red numbers.

What you will get in the table column Atlas mapping is the id of the atlas objects that contain your small objects. The rule is, that if the center of the objects is in a specific atlas object, it gets assigned this id in the Atlas mapping column.

Does this answer your question?

Hello Dominik,

Thank you for your answer It’s perfectly clear !

However for me it doesn’t seem to work as you say. I first made the classification of the big particles, then I made the classification of the small nodules using the classification of the big particles as the Atlas. The problem I have is that each nodule is not assigned to a specific particle id but is only given a value between 0 and 2 in the AtlasMapping. In fact these value correpond to the features I used in the object classification applet, I colored in yellow the particles in the image (2) and in blue the ones that touched the border (1) and 0 was the background.
Therefore I have no way to tell which nodule belongs to which particle, I can only know if they are in a particle I keep or not. Am i missing a step here ?

Kind regards,

Antoine

Hey @Antoine_Cure,

I think I now see the issue there. The Object classification will take whatever you give it as an atlas image and simple check the pixel values of that image at certain positions. I think you might have given it the Object Classification result for the big objects as an atlas image. In order to get the ids, export the Object Identities from your project with the “big” objects, and use that one as an atlas image. Then I think you’ll get what you expect.
If you later want to do some filtering based on the predicted class of those “big” objects, you have to combine the tables. So the object classification table from the “big” objects will match up with the Object IDs in the atlas image.

Hope this gets you the result you expect. If not, just drop another comment!

Cheers
Dominik

Hello Dominik,

Thank you so much it works perfectly now !

I hope you have a wonderful day,

Antoine

1 Like

Awesome, great day to you, too! :slight_smile: