Masking with patches

Hi,

I’m making a masking function that can mask out certain areas of an image using different types of masks, and display them using patches. I want to add a function where a user can move a mask that has already been created.

I can use the picker = True to have it return the patch being clicked on… but how do I know which mask was clicked on if I have two identical masks? or even worse, if I have two identical masks almost lying ontop of each other… returning both patches at the same time?? I’ve tried different things using == to compare… but that didn’t work… any suggestions??

Soren

Søren,
Why wouldn't you allocate a 'zorder' to each mask, corresponding to a layer
nb. That way, if a same pixel is shared by 2 masks or more, you take the one
with the highest zorder.
That could be done as easily as definind a `maskstack` list, with element `i`
the mask with zorder `i`.
Now, the global mask is simply
np.logical_or.reduce(maskstack).
That way, you could leave any masked data in the original dataset alone and
not mix it with your stack of patches.
Let me know how it goes.

···

On Wednesday 29 October 2008 21:10:34 Søren Nielsen wrote:

Hi,

I'm making a masking function that can mask out certain areas of an image
using different types of masks, and display them using patches. I want to
add a function where a user can move a mask that has already been created.

I can use the picker = True to have it return the patch being clicked on..
but how do I know which mask was clicked on if I have two identical masks?
or even worse, if I have two identical masks almost lying ontop of each
other.. returning both patches at the same time?? I've tried different
things using == to compare.. but that didn't work.. any suggestions??

Soren