Best inverse of IDLanROI::ComputeMask [message #60688] |
Tue, 10 June 2008 21:18 |
Robbie
Messages: 165 Registered: February 2006
|
Senior Member |
|
|
Hi,
I've been trying to find the best way to determine verticies from a
mask. The reason why I want to do this is because my regions are
persisted in the database as a mask, yet my users want to edit their
regions as a polygon.
I've empirically determined that the following following code is
nearly consistent:
; Compute the mask from the verticies
mask = oROI -> ComputeMask(DIMENSIONS=s[1:2])
; Compute the verticies from the mask
contour, mask, PATH_XY=xy, LEVELS=255, NLEVELS=1, /PATH_DATA_COORDS
; Re-display the new verticies
oROI -> SetProperty, DATA=xy
I re-display the verticies because I want the user to visualise any
difficulties the contour procedure may encounter. It seems to work
better than I would expect but it is certainly not infallible.
Is contour the right thing to use here or is there something better?
Any recommendations?
Snapshot and example available from
http://barnett.id.au/idl/ComputeMaskInverse.html
Thanks,
Robbie
|
|
|