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

Home » Public Forums » archive » IDL crashes using CONTAINSPOINTS when array exceeds 16x16?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
IDL crashes using CONTAINSPOINTS when array exceeds 16x16? [message #29205] Thu, 07 February 2002 01:32 Go to previous message
dw is currently offline  dw
Messages: 10
Registered: February 2001
Junior Member
Hi,

I have a little bit of code that removes background around my
cylindrical samples by setting the points outside a prescribed circle
to a non-zero value (I have to do this to stop SEARCH2D from growing
into the background), but I can only do it for an array of 16x16
pixels (and need to go to 370x370). Once I let the indices go to 17x17
or higher it crashes IDL. Any experiences like that out there?

Cheers,
Dorthe


This is my code:
************************************
FUNCTION CIRCLE, xcenter, ycenter, radius
points = (2 * !PI / 99.0) * FINDGEN(100)
x = xcenter + radius * COS(points )
y = ycenter + radius * SIN(points )
RETURN, TRANSPOSE([[x],[y]])
END

;*********************************************************** *********************************
;*********************************************************** *********************************

PRO Remove_background

topColor = !D.N_COLORS-1
LOADCT,0,NCOLORS=!D.N_COLORS-1

; Read volume file containing 3-D data set


vol = read_tomo_volume
('d:\recon_volumes\May2001\8_20_I_segm.volume')

; Extract one 2-d slice

image=vol[*,*,40]

siz = SIZE(image)
x = siz[1]
y = siz[2]

; Remove 'background' outside sample circle

bytimage = BYTSCL(image,min=0,max=10,TOP=topColor)

WINDOW,1,/PIXMAP,XSIZE=x,YSIZE=y
TV,bytimage

Xcentre = 330
Ycentre = 330
Radius = 140

circ_roi= CIRCLE(Xcentre,Ycentre,Radius)
PLOTS, circ_roi[0,*], circ_roi[1,*],/DEVICE

mask = image * 0
area = POLYFILLV(circ_roi[0,*],circ_roi[1,*],x,y)

mask[area] =1
CircleImage = mask * image
image_display, CircleImage

; Set pixels outside circle to non-zero value

For i = 0,17 do begin
For j = 0,17 do begin

inside_circle=obj_new('IDLanROI',circ_roi)
circleOK=inside_circle -> containspoints([i,j])
print, 'circleok:', circleOK

If circleok eq 0 then begin
image[i,j]=30
endif

endfor
endfor

image_display, image


END
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: DNs independent from Datatypes for ENVI-Mosaics
Next Topic: idl on a UML

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

Current Time: Fri Oct 10 07:24:13 PDT 2025

Total time taken to generate the page: 1.90738 seconds