comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Multiple click region growing
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Multiple click region growing [message #63167] Tue, 28 October 2008 15:01
frankosuna is currently offline  frankosuna
Messages: 31
Registered: February 2008
Member
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
[Message index]
 
Read Message
Previous Topic: Re: FFT OF A NON RECTANGULAR IMAGE
Next Topic: array dimension change

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:36:01 PDT 2025

Total time taken to generate the page: 0.00466 seconds