Hi,
I've got a little GUI into which I load a 3D volume and individual 2D slices are displayed (the z-position through the volume changes with a slider). At any given slice, I would like to be able to draw an ROI, add that ROI to an ROIGroup, and then use ComputeMesh to generate the 3D vertex and connectivity lists from all the ROIs I've drawn. Things seem to work on each individual slice, in so much as I can draw the ROI and computes the centroid of that ROI (x, y, z). However, when I try to then compute the mesh from the group of ROIs (after making 3 or 4 individual ROIs) the result is 0 (failed) and the vlist and plist aren't populated. Plus, I get a notification that 'Temporary variables are still checked out - cleaning up...'
Any thoughts on what I might be doing wrong here? Thanks! Ayla
Here's the relevant section of the code:
ROI_Group = OBJ_NEW('IDLanROIGroup')
ROI = OBJ_NEW('IDLanROI', TYPE=2, interior=0)
if uval eq 'button_roi' then begin
;using roi_ex.pro as a template
; Collect first vertex for the region.
CURSOR, xOrig, yOrig, /UP, /DEVICE
ROI->AppendData, xOrig, yOrig, position
PLOTS, xOrig, yOrig, PSYM=1, /DEVICE
;Continue to collect vertices for region until right mouse button.
x1 = xOrig
y1 = yOrig
while !MOUSE.BUTTON ne 4 do begin
x0 = x1
y0 = y1
CURSOR, x1, y1, /UP, /DEVICE
PLOTS, [x0,x1], [y0,y1], /DEVICE
ROI->AppendData, x1, y1, position
ROI_Group->Add,ROI
endwhile
PLOTS, [x1,xOrig], [y1,yOrig], /DEVICE
; Draw the the region with a line fill.
DRAW_ROI, ROI, /LINE_FILL, SPACING=0.2, ORIENTATION=45, /DEVICE
centroid = ROI ->ComputeGeometry(centroid=center)
print, center
;Add to ROI group, compute mesh
; ROI_Group->Add,ROI
mesh = ROI_Group->ComputeMesh(vlist, plist)
print, vlist
print, plist
endif
|