<div dir="ltr">Dear Glynn and Manning<div><br></div><div>Your tips solved my problem.</div><div><br></div><div>Many thanks for both.</div><div><br></div><div>Best wishes</div><div><br></div><div>miltinho<br><br><div class="gmail_quote">
2008/9/15 Glynn Clements <span dir="ltr">&lt;<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d"><br>
Milton Cezar Ribeiro wrote:<br>
<br>
&gt; I tryed your suggestion and notice that the F8 solution<br>
&gt; simulate a dilatation of 1pixels on everyside of patches.<br>
&gt; But, if I am not wrong, when I have a patch separated by<br>
&gt; 2 pixels, the F8 solution will join these patches on only one.<br>
&gt;<br>
&gt; But I can preserve the patches separated, and only<br>
&gt; consider as one patches those pixels that can be joined<br>
&gt; on the rule 8. I donīt know if I am so clear, but I would<br>
&gt; like to request a little more time of you on this regard.<br>
&gt;<br>
&gt; I run the folowwing commands:<br>
&gt;<br>
&gt; r.mapcalc &quot;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])&quot;<br>
&gt; r.clump input=F8 output=F8_clump<br>
<br>
</div>The r.mapcalc command will perform &quot;thinning&quot;. The result will be one<br>
if all nine cells (the centre and all eight surrounding cells) are<br>
one, and zero if any of the nine cells are zero).<br>
<br>
[Actually, you&#39;re missing A[1,0].]<br>
<br>
For &quot;fattening&quot;, you should use e.g.:<br>
<br>
r.mapcalc &quot;F8 = A[-1,-1] || A[-1,0] || A[-1,1] || A[0,-1] || A || A[0,1] || A[1,-1] || A[1,0] || A[1,1]&quot;<br>
<br>
[For 0/1, multiplication is equivalent to the &quot;&amp;&amp;&quot; operator (logical<br>
conjunction).]<br>
<br>
Another option, which should only fill in the cells necessary to make<br>
r.clump recognise diagonal adjacency, is:<br>
<br>
r.mapcalc &quot;AF = A || A[0,1] &amp;&amp; A[1,0] || A[0,-1] &amp;&amp; A[1,0] || A[0,1] &amp;&amp; A[-1,0] || A[0,-1] &amp;&amp; A[-1,0]&quot;<br>
<br>
This will only set the centre cell if two diagonally-adjacent<br>
neighbours are both set.<br>
<br>
It may even suffice to use:<br>
<br>
r.mapcalc &quot;AF = A || A[0,1] &amp;&amp; A[1,0] || A[0,-1] &amp;&amp; A[1,0]&quot;<br>
<br>
This will only fill the cell on one side of a pair of diagonally<br>
adjacent cells.<br>
<font color="#888888"><br>
--<br>
Glynn Clements &lt;<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>&gt;<br>
</font></blockquote></div><br></div></div>