How to create several rectangles with uniform size as ROI and analyze particles



I have the following image downloadable here as TIFF (160MB).
It looks like this:

As indicated there, what I’d like to do is to make the macro that does the following:

  1. Create a square with a predefined dimension.
  2. Make 5 copies of that squares
  3. Position these squares manually (ask user)
  4. Turn it into 5 ROIs
  5. Count the white specks with Analyse Particles for each ROI
  6. Summarise for each ROI

What’s the way to do that?


Hi @gundalav, sorry for the long delay in reply to your question.

I would suggest to start by having the user use the multipoint tool to mark five points. Then in your macro, loop over these five points and for each one:

  • Make the selection into a rectangle ROI centered around the point. See drawRect.
  • Then go through a standard segmentation workflow as described on the wiki (and also in this workshop) to threshold, segment and measure what you want within the rectangle.

Happy to answer more specific questions if you get stuck.