Paco Alonso schrieb:
> To achieve this I break the sig file into pieces of just one class.
>
> Running i.maxlik for each class gives then a "rej map" for each class.

Thank you for the suggestion. I created a little script that automates
the process (see attachment).

regards,
Georg

> Georg Kaspar wrote:
>> Hi,
>> as mentioned before, I need to extract probability-values from
>> i.maxlik that are computed for each pixel for each class. Is there an
>> 'easy' way to achieve this? If I need to dig into the source code, can
>> anybody help me to find the right line in the right class? I'm not
>> that much of a C guru :-/
>> Thanks in advance!
>> Georg


#!/bin/sh
#
############################################################################
#
# MODULE:      i.probabilities
# AUTHOR(S):   Georg Kaspar
# PURPOSE:     extracts probabilities for all classes from sigfile
# COPYRIGHT:   (C) 2009
#
#              This program is free software under the GNU General Public
#              License (>=v2). Read the file COPYING that comes with GRASS
#              for details.
#
#############################################################################

if test "$GISBASE" = ""; then
   echo "You must be in GRASS to run this program."
   exit
fi

# signature file is first parameter:
GROUP=$1
SUBGROUP=$2
SIGN=$3

# split signature file into subfiles with 1 signature each
tail -n +2 $SIGN > tmp.sig
split -d -l 7 tmp.sig plr_
COUNTER=0
for f in ./plr_*
do 
   echo "#produced by i.plr" > $f.sig;
   cat $f >> $f.sig; 
   rm $f; 
   COUNTER=`expr "$COUNTER" "+" "1"`
done;
echo "$COUNTER files created";

# run i.maxlik for each signature and save rejected values
SUFFIX=0
for i in $(seq 0 1 `expr "$COUNTER" "-" "1"`)
do
   if [ $i -lt 10 ]
   then
      SUFFIX="0$i"
   else
      SUFFIX="$i"
   fi
   echo "plr_$SUFFIX.sig"
   i.maxlik group=$GROUP subgroup=$SUBGROUP sigfile="plr_$SUFFIX.sig" 
class=plrtmp_$SUFFIX reject=plr_rej_$SUFFIX
done;

# clean up
rm tmp.sig 
rm plr_*.*
g.mremove plrtmp* -f

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to