confused about usage of IDLanROI in Itools [message #88563] |
Mon, 12 May 2014 13:49  |
TonyLanz
Messages: 4 Registered: January 2012
|
Junior Member |
|
|
OK folks, I admit I'm a little confused about my implementation of IDLanROi within an Iimage window. Something silly on my part I'm sure.
What I have done is display an image in Iimage, draw a freehand ROI and then I'm grabbing the vertices of this roi to compute a mask and grab coordinates. This seems to work fine, something like this:
oSys = _IDLitSys_GetSystem()
oVertices = oSys -> GetByIdentifier('/DATA MANAGER/VERTICES')
fSuccess = oVertices -> GetData(Vertices)
roi = obj_new('IDLanROI', Vertices)
mask = roi-> computemask(dimensions=size(picture,/dimensions),mask_rule=2 )
index_points = where(mask gt 0)
coords=array_indices(picture,index_points)
That works, but if I now want to go to the open Iimage window, delete that roi by selecting it and hitting delete, then draw a new freehand roi and repeat the process on a new area, I have the coordinates of the first Vertex drawn , not the new one. I think I understand this...Iimage gives the 1st OI drawn a variable name of "Vertices" and each subsequent roi drawn (in the session) becomes Vertices_1, Vertices_2, etc.
I hope I'm not being confusing. So I'm looking for suggestions to work around this issue programmatically. Ideas?
Tony
|
|
|
Re: confused about usage of IDLanROI in Itools [message #88571 is a reply to message #88563] |
Tue, 13 May 2014 12:40  |
TonyLanz
Messages: 4 Registered: January 2012
|
Junior Member |
|
|
Answering my own question!
Turns out I just need to delete my oVertices object before drawing another freehand ROI. Since I'm defining this using GetByIdentifier on something specifically named "VERTICES within data manager", by simply doing
obj_destroy,oVertices
in my example above forces iImage to call the next defined freehand ROI Vertices again, rather than Vertices_1.
|
|
|