[GRASS-user] eliminate isolated pixel groups
Dylan Beaudette
dylan.beaudette at gmail.com
Mon Jan 15 13:58:04 EST 2007
On Monday 15 January 2007 08:44, Florian Kindl wrote:
> 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
Hi Florian,
r.reclass.area might do the job, if you can identify a threshold area which
makes sense.
good luck,
--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341
More information about the grass-user
mailing list