How to make a macro that filters out x and y coordinates outside a certain range

dear all,

I have a list of ROIs, each with a x and y coordinate. What I am trying to do is make a macro which:

1.lets me select a certain area in my image
2.Uses the coordinates of this selection to find all the ROI coordinates that fall within this selection
3. tells me the number of ROI found in the selection or outputs a list of the ROIs with the ones outside of the area filtered out

I feel like this shouldn’t be to hard since all the necessary information for it to work (the coordinates of the specified area and the ROIs) are known. But since I don’t have any programming experience I am still struggling to find a way.
Any help or ideas would be greatly appreciated.

Hi @Ruben,

Programming with ImageJ is designed to be easy… at least easier than some other platforms. I highly recommend it! Take a look at the introduction and play with bits of code others have contributed.

Thinking about strategies to solve the problem – I think you mentioned on an earlier thread that you want to divide your image into several parts and count ROIs in each one. If so, how do you want to deal with the ROIs that cross the borders? Is it ok to count them twice (once in each partial image)?

And are these line ROIs or freehand?

Hope this helps.

2 Likes