Re: Moving an ROI [message #28403 is a reply to message #28325] |
Wed, 05 December 2001 13:55   |
Andre Kyme
Messages: 19 Registered: September 2001
|
Junior Member |
|
|
Thanks Pavel,
I had rewritten the move ROI program yesterday and it seems to be more robust. I
use the set_graphics_function argument (to the device), and set this equal to 6
(XOR mode) so that the ROI "floats" over the image. When a new position is
detected, the old position is replotted to make it disappear and the new position
plotted. This is all OK.
Now about the edges:
As you say, by defining a new ROI equal to (Xverts > 0)AND(Xverts < xMax), and
similarly for Y, we create a new ROI that fits in the draw widget and has its edge
along the draw widget boundary if there is any part of the ROI outside the allowed
region.
Another way would be to form a bit mask for the Xverts, setting equal to 1 wherever
the vertices are in the allowed region, and doing the same for the Yverts. If we
then AND these two masks and finally do a WHERE on the result, we can plot
Xverts[result], Yverts[result]. The problem I see with this is that if we are over
the boundary, the ROI stops at the point(s) of contact. I eventually want the total
counts inside the ROI, which means that I need to CLOSE it off first, before doing
a polyfillv. If I used this last method as is, the ROI would be truncated by simply
drawing a line from one point of contact to the other - what I really want is the
boundary to follow the edge of the draw widget where it has crossed the draw
boundary. Closing off the region isn't so simple as far as I can see. I think you
probably know what I'm talking about even if this explanation is incomprehensible!
Maybe I'll go for the first method.
Thanks for your reply Pavel,
Andre
|
|
|