Re: retrieving regions from a IDLanROIGroup [message #41883 is a reply to message #41857] |
Mon, 06 December 2004 06:11  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Miriam Saldana-Munoz writes:
> I select automatically ROIs(from a binary image)
> and store them in a region group in the following way:
>
> ;thresHimage...bynary image
> CONTOUR,thresHimage,level=1,xmargin=[0,0],$
> ymargin=[0,0],/noerase,path_info=pathInfo,$
> path_xy=pathXY,xstyle=5,ystyle=5, /path_data_coords
> ;create the oRoiGroup
> oRoiGroup=OBJ_NEW('IDLanROIGroup')
> ;input the data of each of the contour paths
> ;into IDLanROI objects
> FOR I=0,N_ELEMENTS(pathInfo)-1 DO BEGIN
> ;initialize oRoi with the contour information of
> ;the current region
> line=[LINDGEN(pathInfo[I].N),0]
> oRoi=OBJ_NEW('IDLanROI',$
> (pathXY[*,pathInfo[I].OFFSET+line])[0,*],$
> (pathXY[*,pathInfo[I].OFFSET+line])[1,*], /interior )
> ;add to oRoiGroup
> oRoiGroup->Add,ORoi
> ;destroy the oRoi object
> OBJ_DESTROY,oRoi
> ENDFOR
>
> This works quite good and typing "help,oRoiGroup", IDL prints:
> OROIGROUP OBJREF = <ObjHeapVar1736(IDLANROIGROUP)>
>
> Next, I want to grow each of these regions (with region_grow),
> so I need to retrieve them from oRoiGroup. I do it in this
> way:
> SomeRoi=oRoiGroup->Get(position=0)
>
> typing "help,someRoi", IDL prints:
> SOMEROI OBJREF = <ObjHeapVar1737>
>
> If now I try to use any IDLanROI method it does not work!!,for instance:
> someRoi->getProperty,all=variable
> IDL prints:
> % Invalid object reference: SOMEROI.
>
> I would be very grateful if someone could tell me what I am doing false.
Well, you are destroying the object! That will make
it hard to recover. :-)
Take that OBJ_DESTROY out of there.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|