<div>Greetings Mr. Neteler</div>
<div><br>I&#39;m implementing a methodology in GRASS to eliminate training_areas outliers. What I do?<br>1- first I pick up the current training areas for a class and I calculate mean vector and covariance matrix<br>2- Invert the covariance matrix<br>
3- Compare each pixel, that is included in a training_area, with a defined threshold and if it&#39;s OK, It&#39;s still labeled as 1 or, otherwise, it&#39;s eliminated.</div>
<div><br>It would be pointless in developing this function from scratch in GRASS so I used i.gensig that is used to calculate mean vector and covariance matrix for training areas. (This means that step 1 and 2 (by a simple implementation) is covered. (Do anyone suggest other function instead of this?)<br>
</div>
<div>My problem is with the third step (I&#39;m still not very familiar with some GRASS programming functions/functionalities)<br>I have created a cycle that goes for each row and col and I get the correct raster pixel value from group but I&#39;m not being able to retrieve the classification. This is an overview of the approach:<br>
for row=0, row&lt;nrows, row++<br>    for col=0, col&lt;ncols, cols++</div>
<div>           Check in training area if the pixel value is &gt;-1 (this is the problem I&#39;m not being able to get thiS)<br>            for band=0, pband&lt;nbands, pband++<br>                  pband[band]=cell_value for band &quot;band&quot;, in row=row, col=col and that is included in the training area.<br>
            - Then apply the compare (easy)<br>            - write (I think it&#39;s not a problem)<br>            }<br>   }<br>}<br>In what am I a bit lost:<br>1- How can I get the value from training areas raster?<br>2- How can I only apply this rule only to the  pixels that are included in a training_area?</div>

<p><br>Can anyone give me a few tips?</p>
<p><br>Thanks<br>Katrin</p>