I have the following code to region grow around a user selected point,
however, I need to allow the user to select multiple points to region
grow(as many as they'd like)
Any ideas on how I can modify this code to do that?
Frank
DEVICE, DECOMPOSED = 0, RETAIN = 2
;LOADCT, 0
; Load an image and get the image dimensions.
file = FILEPATH(imageName+'.bmp', $
ROOT_DIR = ['/home/users/fjosuna/CASVU_ISS/'])
img = READ_BMP(file)
dims = SIZE(img, /DIMENSIONS)
; Create a window and display the image.
WINDOW, 0, XSIZE = dims[0], YSIZE = dims[1], $
TITLE = 'Click on an Edge to navigate on.'
TVSCL, congrid(img,dims[0],dims[1])
; Define the original region pixels. Use the CURSOR
; function to select the region, making a 10x10 square
; at the selected x,y, coordinates.
CURSOR, xi, yi, /DEVICE
x = LINDGEN(5*5) MOD 5 + xi
y = LINDGEN(5*5) / 5 + yi
roiPixels = x + y * 1024
; Grow the region. The THRESHOLD values are determined
; empirically.
newROIPixels = REGION_GROW(img, roiPixels, $
THRESHOLD = [200,255], /ALL_NEIGHBORS)
; Set the topmost color table entry to white.
topClr = !D.TABLE_SIZE - 1
TVLCT, 255, 255, 255, topClr
; Scale the array, setting the maximum array value
; equal to one less than the value of topClr.
regionPts = BYTSCL(img, TOP = (topClr - 1))
; Show the result of the region grown using
; thresholding. Black out all other pixels
regionImg = BYTSCL(img, TOP = 0)
regionImg[newROIPixels] = topClr
WINDOW, 2, XSIZE = dims[0], YSIZE = dims[1], $
TITLE = 'THRESHOLD Grown Region'
TVSCL, congrid(regionImg,1024,1024)
image24 = TVRD(TRUE=3)
image = Color_Quan(image24,3,r,g,b)
Write_BMP, imageName + '2.bmp',image, r,g,b
WDELETE, 2
OPENW, lun, imageName + '2.dat', /GET_LUN
WRITEU, lun, image
FREE_LUN, lun
WDELETE, 0
|