[GRASS-user] eliminate isolated pixel groups

Florian Kindl florian.kindl at uibk.ac.at
Mon Jan 15 11:44:51 EST 2007


Hello list!

I am working on binary (1;null) maps depicting streams.
What I try to accomplish is a filter which removes isolated groups of
pixels.
It is easy to remove a single pixel with r.mapcalc:

r.mapcalc "$RO= \
if( \
( \
isnull($RI[-1,-1])&&isnull($RI[-1,0])&&isnull($RI[-1,1])&& \
isnull($RI[0,-1])&&isnull($RI[0,1])&& \
isnull($RI[1,-1])&&isnull($RI[1,0])&&isnull($RI[1,1])  \
) \
,null() \
,$RI \
)"

- test all 8 neighbours and null() the center pixel or leave it
  unchanged.

Now, what if I try to expand this concept:

  * * * * *
  * + + + *
  * + + + *
  * + + + *
  * * * * *

IF the outer ring (cells symbolized by a "*") fullfills a certain
condition (say, all cells are null)
THEN _all_ cells of the inner area (the "+" in the above scheme
are to be nulled.

In other words, I have to modify more than one cell of the output raster
at the same time, modify more than one cell at one step of the moving window.

Has anybody an idea how to accomplish this, either with r.mapcalc or
some other tool?

thanks,
Florian


-- 
Florian Kindl
Institute of Geography
University of Innsbruck
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20070115/08ee71c1/attachment.bin


More information about the grass-user mailing list