I have two binary images of the same size and each of them contains multiples objects. Something like:
I need to create a new binary image consisting only of the objects from the first image that intersect with some objects from the second image. Getting just the intersection is not enough. So my result need to look like
I cannot find any combination of operations from “Image Calculator” that would work. Is there any way this could be done by build-in functions or some plug-ins?
If not and I need to write some code then how to go about this problem? I thought about grouping positive pixels’ coordinates (from Analyze>Tools>Save XY coordinates) belonging to a single object into a list and thus getting a list of lists for each image and then comparing those between images object by object but that seems to be quite complicated and time consuming as my actual images are approx. 10 000 x 10 000px and contain thousands of objects. Is there a simple way to do this?