11-04-2014 09:55 AM
Good day,
in my application i set a certain number of ROIs in specific regions defined programmatically. Unfortunately they could overlap each other. Since that the ROIs that i set are regions of analysis overlapping two ROIs means analyze the same region two time. So i need to delete one of the two overlapping ROIs. I can't figure out how i can detect the overlapping ROIs. Note that the ROIs may not completely overlap but they could overlap each other only in undefined percentage.
Thank you in advance,
Francesco
Solved! Go to Solution.
11-04-2014 10:09 AM
What shape are the ROIs? Rectangles would be fairly easy to check for overlap, but random shapes would be more difficult.
You could check rectangles by generating a list of left, right, top, bottom coordinates. For each rectangle, check if its left or right is between any other left/right pairs AND top or bottom is between the top/bottom of the same ROI.
For random shapes, I might consider converting each ROI to a mask, then adding all the masks together. If any pixels have a value greater than 1, you have overlap. You would have to use each mask to figure out which one it is.
Bruce
11-04-2014 10:10 AM
What shape are the ROIs? Rectangles would be fairly easy to check for overlap, but random shapes would be more difficult.
You could check rectangles by generating a list of left, right, top, bottom coordinates. For each rectangle, check if its left or right is between any other left/right pairs AND top or bottom is between the top/bottom of the same ROI.
For random shapes, I might consider converting each ROI to a mask, then adding all the masks together. If any pixels have a value greater than 1, you have overlap. You would have to use each mask to figure out which one it is.
Bruce
11-05-2014 02:52 AM
Thank you, Bruce. Your second advice hit the spot.
Francesco