[GRASS-user] identifying diagonal clumps

Milton Cezar Ribeiro miltinho.astronauta at gmail.com
Sun Sep 14 22:34:14 EDT 2008


Dear Maning,
Many thanks for your kindly attention.

I tryed your suggestion and notice that the F8 solution
simulate a dilatation of 1pixels on everyside of patches.
But, if I am not wrong, when I have a patch separated by
2 pixels, the F8 solution will join these patches on only one.

But I can preserve the patches separated, and only
consider as one patches those pixels that can be joined
on the rule 8. I don´t know if I am so clear, but I would
like to request a little more time of you on this regard.

I run the folowwing commands:

r.mapcalc "F8 = (A*A[-1,-1]) * (A*A[-1,0]) * (A*A[1,-1]) * (A*A[0,-1]) *
(A*A[0,1]) * (A*A[-1,1]) * (A*A[1,1])"
r.clump input=F8 output=F8_clump

Best wishes,

miltinho

2008/9/14 maning sambale <emmanuel.sambale at gmail.com>

> I used to implement an r.mapcalc script by evaluating values in the
> cardinal directions
>
> sample below:
> ## pixels with both forest from the cardinal directions
> # 0--x--0
> # |  |  |
> # x--x--x
> # |  |  |
> # 0--x--0
>
> r.mapcalc "F4 = (A * A [1,0]) * (A * A [-1,0]) * (A * A [0,-1]) * (A * A
> [0,1])"
>
> where [r,c] refers to the current cell offset
>
> for an 8-rule you can use
>
> [-1,-1],[-1,0],[1,-1],[0,-1],[0,1],[-1,1],[1,-1],-1,1]
>
> hope that helps.
>
> cheers,
> maning
>
> On 9/15/08, Milton Cezar Ribeiro <miltinho.astronauta at gmail.com> wrote:
> > Dear all,
> > I am using r.cluster to identify the clumps of pixels of my binary map
> > (0=matrix and 1=habitat).
> > But when I run r.cluster, I get and output cluster map as (B) (see below)
> > and in fact
> > I would like the those diaagonal patches were clumped as the same clump.
> > Almost to those that work with landscape ecology, the patches are formed
> > using rules with 8 neighbors intead of 4 neighbors.
> >
> > I know that I can do it on other programs, but I need to implement a
> > sequence of
> > codes on GRASS, and I really need a rule-8 to build my patches map. Any
> > idea?
> >
> > Best wishes,
> >
> > miltinho astronauta
> > brazil
> >
> > (A)
> > 00000000
> > 01000000
> > 00110000
> > 00110000
> > 00001100
> > 00001100
> > 00001100
> > 00000000
> > (B)
> > 00000000
> > 01000000
> > 00220000
> > 00220000
> > 00003300
> > 00003300
> > 00001100
> > 00000000
> >
>
>
> --
> |---------|----------------------------------------------------------|
> | __.-._  |"Ohhh. Great warrior. Wars not make one great." -Yoda     |
> | '-._"7' |"Freedom is still the most radical idea of all" -N.Branden|
> |  /'.-c  |Linux registered user #402901, http://counter.li.org/     |
> |  |  /T  |http://esambale.wikispaces.com|
> | _)_/LI
> |---------|----------------------------------------------------------|
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20080915/f285ba46/attachment.html


More information about the grass-user mailing list