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

Home » Public Forums » archive » Re: checking for connectedness of a given set of pixels
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: checking for connectedness of a given set of pixels [message #73514 is a reply to message #73430] Sun, 14 November 2010 13:56 Go to previous messageGo to previous message
guillermo.castilla.ca is currently offline  guillermo.castilla.ca
Messages: 27
Registered: September 2008
Junior Member
On Nov 8, 3:22 pm, James <donje...@gmail.com> wrote:

> One problem is that LABEL_REGION runs over a whole array even if it is
> mostly empty (sparse).  This is why LABEL_REGION might be slow for
> your task - it could be doing a lot of unnecessary extra work.  

Thanks a lot James, very insightful comments, and very nice piece of
code :). After giving it some more thought, I found out that there is
an IDL function called REGI0N_GROW that may be faster than
LABEL_REGION for this purpose when the minimum bounding box for the
input set of pixels is large. I have modified your function to include
the former as an alternative method (below). I'll do some tests and
report back (hopefully within this year :).

function ISCONNECTED, points, method=method, _extra=ex
mins = min(points, max=maxs, dimension=2)-1
dims=maxs-mins+3
npts= n_elements(points)/2
indices= points - mins # replicate(1, npts)
indices= indices[0,*] + dims[0]*indices[1,*]
arr = bytarr(dims)
arr[indices] = 1B
if ~keyword_set(method) then $
return, max(label_region(arr, _extra=ex)) le 1 $
else return, n_elements(region_grow( $
arr, indices[0], thresh=[1B,1B], _extra=ex)) eq npts
end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Random NetCDF I/O error
Next Topic: Re: Random NetCDF I/O error

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

Current Time: Wed Oct 08 17:30:10 PDT 2025

Total time taken to generate the page: 0.00456 seconds