Counting the Number of ROIs After Adding an ROI Overlay on a Specific Area

Hi everyone!

I was wondering if anyone knew how to count the number of ROIs within an are specified by a large ROI overlay?

I wrote this piece of code that will take a predrawn large ROI that covers a certain area, for example, 50/3000 smaller ROIs, and clears the outside of all ROIs that are outside of the overlay. Any ideas on how I can count the number of mini ROIs within the larger overlay ROI? I tried “analyze particles”, but the image needs to be thresholded/8-bit.

Thanks for the help!

Hi @jchen,
Are your smaller rois separated (not overlapping/touching each other) ? If that is the case, you can do the following:

  1. Combine (OR) the small rois with the help of the roi-Manager (this can be long for a large number of rois)
  2. Create Mask 1 from them (Edit>Selection>Create Mask)
  3. Create Mask 2 from the big roi.
  4. Use the Image-calculator to AND the Mask 1 and Mask 2, creating Mask 3
  5. Use the particle analyzer on Mask 3 to get the remaining rois and their number.


1 Like

Hi Volker!

Yes my ROIs are all distinctly separated, so I will try that! I also realized that I could just use the split function and then use the roiManager(“count”); function to get the number of ROIs. I’ll try both ways to see which one woks better.

Thanks for the help!