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

Home » Public Forums » archive » how to find continuous regions
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
how to find continuous regions [message #58628] Mon, 11 February 2008 09:16
astroboy2k is currently offline  astroboy2k
Messages: 34
Registered: July 2007
Member
Hello.

Does anyone know of any code that finds continuous regions? To be more
exact:

I have a 3D dataset, say 64x64x64. Within this array, many entries
will be 1, some will be zero. Is there an easy way to identify all the
groups of array elements equal to 1 which lie adjacent to each other?

For a 1D dataset this is what I'm looking for:

arr=[0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1,1,1,1,1, 0, 0, 0, 0]
first second third
So, there are three continuous regions. (I don't care about isolated
1's).
I'd like to have an array (arr2) returned where I'd have something
like:

arr =[0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1,1,1,1,1, 0, 0, 0, 0]
arr2=[0, 1, 1, 0, 0, 0, 2, 2, 2, 0, 0, 0, 3,3, 3,3,3, 0, 0, 0, 0]

As I said, I need such a thing for a 3D array....

I expect I'm looking at recursive routines which I've always had
trouble getting my mind around. I'd rather not re-invent the wheel if
I can avoid it.

Thanks!

Mark
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: the problem of making the example of externel calltest
Next Topic: Re: how to find continuous regions

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

Current Time: Wed Oct 08 19:24:14 PDT 2025

Total time taken to generate the page: 0.00541 seconds