Measure particles within a TWS segment or class respectively / Automatic selection

Hi! Before i start, this is a wonderful forum and i already learned a lot so far!

But at the moment i’m stuck…

I am trying to measure the number and area of the small black “round” particles in the image below, but
only within the red area (desired selection). I also have to measure the exact area of the selected area.
Manually no problem. But i have to automate it for a lot of pictures like the one below. The “red area” will always be different in each picture.

So i found “Trainable Weka Segmentation” (TWS) and i was excited like a little boy on christmas when i got it working and doing what i wanted, namely automatically select a quite similar area like i would do it!

My problem now >> How can i create a “Selection” out of one of my TWS created classes (class 1; red area)?

Original picture and TWS-result are below.
Thanks in advance!

Desired selection

TWS Selection
Classified image_3.tif (1.5 MB)

Original Picture (will be TIFF in the future)


Ok. At what stage are you in the process? Because I’m not sure what you mean by…

If you have a .model classifier all ready-to-go for your ‘red’ region… you can apply that to multiple images using this Beanshell macro script. Once you get your probability maps… you can then segment the regions using a ‘classic’ protocol and built-in ImageJ commands:

  1. Set Threshold (using Auto-thresholding method… whichever is best for your region)
  2. Create Selection (clear outside if you want to then ‘find’ your black spots within)
  3. Add to ROI Manager…
  4. You can even then segment your black spots and add to ROI Manager as well

These steps can also be automated using macro scripts as well. Here are some helpful links you can use as resources:

Also - you can check out the links in the following old post:

1 Like