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

Home » Public Forums » archive » Point within country boundary
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Point within country boundary [message #87334 is a reply to message #87330] Sat, 25 January 2014 04:54 Go to previous messageGo to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi,

On 24.01.2014 22:36, David Fanning wrote:
> Well, believe it or not, this is nearly instantaneous!


Contain points is musch slowier than computeMask, see following test:


pro test_contain_points

poly_x = [10, 90, 90, 10, 10] + 0.1
poly_y = [10, 10, 90, 90, 10] + 0.1

n = 1800

o = IDLanROI(poly_x, poly_y)

print, 'Compute mask'
tic
result = o->ComputeMask(DIMENSION=[n,n])
toc
i = Image(result)

xx = INDGEN(n) # (LONARR(n) + 1)
yy = INDGEN(n) ## (LONARR(n) + 1)
mask = BYTARR(n,n)

print, 'Contain point'
tic
result = o->ContainsPoints(xx,yy)
toc

mask[where(result)] = 255
i = Image(mask)

mask = BYTARR(n,n)
print, 'This does the trick'
tic
totest = where(o->ComputeMask(DIMENSION=[n,n]))
result = o->ContainsPoints(xx[totest],yy[totest])
toc

mask[totest[where(result)]] = 255
i = Image(mask)

end

on my machine:

IDL> test_contain_points
Compute mask
% Time elapsed: 0.00040602684 seconds.
Contain point
% Time elapsed: 0.53887701 seconds.
This does the trick
% Time elapsed: 0.0035710335 seconds.

Since contains points can do what compute mask can't, I use the trick
above to spare computing time...

Cheers,

Fabien
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: harrisgeospatial unreachable...
Next Topic: Re: Segregating data in bimodal distribution

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

Current Time: Wed Oct 08 16:02:51 PDT 2025

Total time taken to generate the page: 0.00254 seconds