Re: Identifying clusters of adjacent points on a lattice
- To: mathgroup at smc.vnet.net
- Subject: [mg81480] Re: Identifying clusters of adjacent points on a lattice
- From: "Mariusz Jankowski" <mjankowski at usm.maine.edu>
- Date: Wed, 26 Sep 2007 06:26:52 -0400 (EDT)
- Organization: University of Southern Maine
- References: <fcvr81$7r9$1@smc.vnet.net>
Gareth, you will find a connected components function in Digital Image
Processing package. Also see the article:
www.izbi.uni-leipzig.de/izbi/publikationen/publi_2004/IMS2004_JankowskiKuska
.pdf
Mariusz
>>> On 9/21/2007 at 3:18 AM, in message <fcvr81$7r9$1 at smc.vnet.net>, Gareth
Russell<russell at njit.edu> wrote:
> Hi,
>
> Is there any way to use the built-in clustering routines to find
> clusters of ajacent elements on a 2d lattice? For example, I might
> generate a 'map' with
>
> SeedRandom[1];
> testMap = =E2=80=A8 Last[CellularAutomaton[{1018, {2, {{0, 2, 0}, {2, 1,
> 2},
> {0, 2, 0}}}, {1, =E2=80=A8 1}}, Table[If[Random[Real] < 0.1, 1, 0],
> {100},
> {100}], 10]];
>
> I would then like to find and label the separate 'patches' consisting
> of clusters of 1's. Ultimately, I'm looking for a list of {x,y,id}
> triples where the x and y are the coordinates of each 1 and the id is a
> number that identifies the patch to which that element belongs, but the
> trick is to find the clusters. I can't see how any of the included
> options for FindClusters would perform this particular test (each
> cluster must consist of elements connected to at least one other
> element by a distance of 1).
>
> Of perhaps there is another way?
>
> Thanks,
>
> Gareth
> --
> Gareth Russell
> NJIT