[GRASS-CVS] [addons] r1237 - in trunk/grassaddons/i.pr: i.pr_blob i.pr_classify i.pr_features i.pr_features_additional i.pr_features_extract i.pr_features_selection i.pr_model i.pr_sites_aggregate i.pr_statistics i.pr_subsets i.pr_training i.pr_uxb

grass-commit-addons at grass.itc.it grass-commit-addons at grass.itc.it
Tue Dec 4 09:30:40 EST 2007


Author: neteler
Date: 2007-12-04 15:30:40 +0100 (Tue, 04 Dec 2007)
New Revision: 1237

Modified:
   trunk/grassaddons/i.pr/i.pr_blob/main.c
   trunk/grassaddons/i.pr/i.pr_classify/main.c
   trunk/grassaddons/i.pr/i.pr_features/main.c
   trunk/grassaddons/i.pr/i.pr_features_additional/main.c
   trunk/grassaddons/i.pr/i.pr_features_extract/main.c
   trunk/grassaddons/i.pr/i.pr_features_selection/main.c
   trunk/grassaddons/i.pr/i.pr_model/main.c
   trunk/grassaddons/i.pr/i.pr_sites_aggregate/main.c
   trunk/grassaddons/i.pr/i.pr_statistics/main.c
   trunk/grassaddons/i.pr/i.pr_subsets/main.c
   trunk/grassaddons/i.pr/i.pr_training/main.c
   trunk/grassaddons/i.pr/i.pr_uxb/main.c
Log:
GPL header added; some cleanup

Modified: trunk/grassaddons/i.pr/i.pr_blob/main.c
===================================================================
--- trunk/grassaddons/i.pr/i.pr_blob/main.c	2007-12-04 12:46:13 UTC (rev 1236)
+++ trunk/grassaddons/i.pr/i.pr_blob/main.c	2007-12-04 14:30:40 UTC (rev 1237)
@@ -1,15 +1,32 @@
-#include <grass/gis.h>
-#include "global.h"
+/****************************************************************
+ *
+ * MODULE:     i.pr
+ *
+ * AUTHOR(S):  Stefano Merler, ITC-irst
+ *
+ * PURPOSE:    i.pr - Pattern Recognition
+ *
+ * COPYRIGHT:  (C) 2007 by the GRASS Development Team
+ *
+ *             This program is free software under the
+ *             GNU General Public License (>=v2).
+ *             Read the file COPYING that comes with GRASS
+ *             for details.
+ *
+ ****************************************************************/
+
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include "global.h"
 
-
-
 int main(argc,argv)
 int argc;
 char *argv[];
 {
+  struct GModule *module;
   struct Option *opt1;
   struct Option *opt2;
   struct Option *opt3;
@@ -29,18 +46,6 @@
   int nblobs,npoints;
   BlobSites *sites;
 
-
-
-  char gisrc[500];
-  
-  if(getenv("GISBASE")==NULL)
-      setenv("GISBASE",
-	     "/mpa_sw/ssi/BIO/software/GRASS5.0.0/grass5bin_cvs/grass5",1);
-  if(getenv("GISRC")==NULL){
-    sprintf(gisrc,"/ssi0/ssi/%s/.grassrc5",getenv("LOGNAME"));
-    setenv("GISRC",gisrc,1);
-  }
-  
   /* Define the different options */
 
   opt1              = G_define_option();
@@ -77,8 +82,16 @@
   /***** Start of main *****/
   G_gisinit(argv[0]);
 
+  module = G_define_module();
+  module->keywords = _("imagery, image processing, pattern recognition");
+  module->description =
+      _("Module to search for blobs. "
+        "i.pr: Pattern Recognition environment for image processing. Includes kNN, "
+        "Decision Tree and SVM classification techniques. Also includes "
+        "cross-validation and bagging methods for model validation.");
+
   if (G_parser(argc, argv) < 0)
-    exit(-1);
+    exit(EXIT_FAILURE);
 
   sscanf(opt2->answer,"%d",&minp);
   sscanf(opt3->answer,"%d",&maxp);

Modified: trunk/grassaddons/i.pr/i.pr_classify/main.c
===================================================================
--- trunk/grassaddons/i.pr/i.pr_classify/main.c	2007-12-04 12:46:13 UTC (rev 1236)
+++ trunk/grassaddons/i.pr/i.pr_classify/main.c	2007-12-04 14:30:40 UTC (rev 1237)
@@ -1,8 +1,26 @@
-#include <grass/gis.h>
-#include "global.h"
+/****************************************************************
+ *
+ * MODULE:     i.pr
+ *
+ * AUTHOR(S):  Stefano Merler, ITC-irst
+ *
+ * PURPOSE:    i.pr - Pattern Recognition
+ *
+ * COPYRIGHT:  (C) 2007 by the GRASS Development Team
+ *
+ *             This program is free software under the
+ *             GNU General Public License (>=v2).
+ *             Read the file COPYING that comes with GRASS
+ *             for details.
+ *
+ ****************************************************************/
+
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include "global.h"
 
 
 int extract_array_with_null();
@@ -11,6 +29,7 @@
 int argc;
 char *argv[];
 {
+  struct GModule *module;
   struct Option *opt1;
   struct Option *opt2;
   struct Option *opt3;
@@ -46,16 +65,6 @@
   int R,C;
   int last_row;
 
-  char gisrc[500];
-  
-  if(getenv("GISBASE")==NULL)
-    setenv("GISBASE",
-	   "/mpa_sw/ssi/BIO/software/GRASS5.0.0/grass5bin_cvs/grass5",1);
-  if(getenv("GISRC")==NULL){
-    sprintf(gisrc,"/ssi0/ssi/%s/.grassrc5",getenv("LOGNAME"));
-    setenv("GISRC",gisrc,1);
-  }
-
   /* Define the different options */
 
   opt1              = G_define_option();
@@ -82,8 +91,16 @@
   /***** Start of main *****/
   G_gisinit(argv[0]);
 
+  module = G_define_module();
+  module->keywords = _("imagery, image processing, pattern recognition");
+  module->description =
+      _("Module to classify raster map based on model defined in i.pr.* modules. "
+        "i.pr: Pattern Recognition environment for image processing. Includes kNN, "
+        "Decision Tree and SVM classification techniques. Also includes "
+        "cross-validation and bagging methods for model validation.");
+
   if (G_parser(argc, argv) < 0)
-    exit(-1);
+    exit(EXIT_FAILURE);
 
   /*read the model*/
   model_type=read_model(opt2->answer,&features,&nn,&gm,&tree,

Modified: trunk/grassaddons/i.pr/i.pr_features/main.c
===================================================================
--- trunk/grassaddons/i.pr/i.pr_features/main.c	2007-12-04 12:46:13 UTC (rev 1236)
+++ trunk/grassaddons/i.pr/i.pr_features/main.c	2007-12-04 14:30:40 UTC (rev 1237)
@@ -1,11 +1,33 @@
+/****************************************************************
+ *
+ * MODULE:     i.pr
+ *
+ * AUTHOR(S):  Stefano Merler, ITC-irst
+ *
+ * PURPOSE:    i.pr - Pattern Recognition
+ *
+ * COPYRIGHT:  (C) 2007 by the GRASS Development Team
+ *
+ *             This program is free software under the
+ *             GNU General Public License (>=v2).
+ *             Read the file COPYING that comes with GRASS
+ *             for details.
+ *
+ ****************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
 #include <grass/gis.h>
+#include <grass/glocale.h>
 #include "global.h"
-#include <stdlib.h>
 
 int main(argc, argv)
     int argc ;
     char **argv ;
 {
+    struct GModule *module;
     struct Option *opt1;
     struct Option *opt2;
     struct Option *opt3;
@@ -27,11 +49,17 @@
     FILE *fp;
 
 
-    char gisrc[500];
-
 /* Initialize the GIS calls */
     G_gisinit(argv[0]) ;
 
+  module = G_define_module();
+  module->keywords = _("imagery, image processing, pattern recognition");
+  module->description =
+      _("Module to process training data for feature extration. "
+        "i.pr: Pattern Recognition environment for image processing. Includes kNN, "
+        "Decision Tree and SVM classification techniques. Also includes "
+        "cross-validation and bagging methods for model validation.");
+
     sprintf(opt1desc,"Input files (max %d) containing training data.\n\t\t2 formats are currently supported:\n\t\t1) GRASS_data (output of i.pr_training)\n\t\t2) TABLE_data.",TRAINING_MAX_INPUTFILES);
 
 /* set up command line */

Modified: trunk/grassaddons/i.pr/i.pr_features_additional/main.c
===================================================================
--- trunk/grassaddons/i.pr/i.pr_features_additional/main.c	2007-12-04 12:46:13 UTC (rev 1236)
+++ trunk/grassaddons/i.pr/i.pr_features_additional/main.c	2007-12-04 14:30:40 UTC (rev 1237)
@@ -1,6 +1,26 @@
+/****************************************************************
+ *
+ * MODULE:     i.pr
+ *
+ * AUTHOR(S):  Stefano Merler, ITC-irst
+ *
+ * PURPOSE:    i.pr - Pattern Recognition
+ *
+ * COPYRIGHT:  (C) 2007 by the GRASS Development Team
+ *
+ *             This program is free software under the
+ *             GNU General Public License (>=v2).
+ *             Read the file COPYING that comes with GRASS
+ *             for details.
+ *
+ ****************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
 #include <grass/gis.h>
+#include <grass/glocale.h>
 #include "global.h"
-#include <stdlib.h>
 
 void generate_features();
 
@@ -8,6 +28,7 @@
     int argc ;
     char **argv ;
 {
+    struct GModule *module;
     struct Option *opt1;
     struct Option *opt2;
     struct Option *opt3;
@@ -19,20 +40,17 @@
     char tempbuf[500];
     char opt1desc[500];
 
-
-    char gisrc[500];
-
-    if(getenv("GISBASE")==NULL)
-      setenv("GISBASE",
-	     "/mpa_sw/ssi/BIO/software/GRASS5.0.0/grass5bin_cvs/grass5",1);
-    if(getenv("GISRC")==NULL){
-      sprintf(gisrc,"/ssi0/ssi/%s/.grassrc5",getenv("LOGNAME"));
-      setenv("GISRC",gisrc,1);
-    }
-
 /* Initialize the GIS calls */
     G_gisinit(argv[0]) ;
 
+  module = G_define_module();
+  module->keywords = _("imagery, image processing, pattern recognition");
+  module->description =
+      _("Module to add new features to existing feature in i.pr.* modules. "
+        "i.pr: Pattern Recognition environment for image processing. Includes kNN, "
+        "Decision Tree and SVM classification techniques. Also includes "
+        "cross-validation and bagging methods for model validation.");
+
     sprintf(opt1desc,"Input files (max %d) containing training data.\n\t\t2 formats are currently supported:\n\t\t1) GRASS_data (output of i.pr_training)\n\t\t2) TABLE_data.",TRAINING_MAX_INPUTFILES);
 
 /* set up command line */

Modified: trunk/grassaddons/i.pr/i.pr_features_extract/main.c
===================================================================
--- trunk/grassaddons/i.pr/i.pr_features_extract/main.c	2007-12-04 12:46:13 UTC (rev 1236)
+++ trunk/grassaddons/i.pr/i.pr_features_extract/main.c	2007-12-04 14:30:40 UTC (rev 1237)
@@ -1,7 +1,27 @@
+/****************************************************************
+ *
+ * MODULE:     i.pr
+ *
+ * AUTHOR(S):  Stefano Merler, ITC-irst
+ *
+ * PURPOSE:    i.pr - Pattern Recognition
+ *
+ * COPYRIGHT:  (C) 2007 by the GRASS Development Team
+ *
+ *             This program is free software under the
+ *             GNU General Public License (>=v2).
+ *             Read the file COPYING that comes with GRASS
+ *             for details.
+ *
+ ****************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
 #include <grass/gis.h>
+#include <grass/glocale.h>
 #include "global.h"
-#include <stdlib.h>
-#include <string.h>
 
 #define MAXLIMITS 20
 
@@ -11,6 +31,7 @@
     int argc ;
     char **argv ;
 {
+    struct GModule *module;
     struct Option *opt1;
     struct Option *opt2;
     struct Option *opt3;
@@ -23,25 +44,22 @@
     int limits[MAXLIMITS];
     int *selection;
     char *tmpbuf;
-    char gisrc[500];
     int nselection;
     int nlimits;
     double **copydata;
     int col;
 
-    if(getenv("GISBASE")==NULL)
-      setenv("GISBASE",
-	     ".",1);
-    //   "/mpa_sw/ssi/BIO/software/GRASS5.0.0/grass5bin_cvs/grass5",1);
-    if(getenv("GISRC")==NULL){
-      sprintf(gisrc,".grassrc5");
-      //sprintf(gisrc,"/ssi0/ssi/%s/.grassrc5",getenv("LOGNAME"));
-      setenv("GISRC",gisrc,1);
-    }
-
 /* Initialize the GIS calls */
     G_gisinit(argv[0]) ;
 
+  module = G_define_module();
+  module->keywords = _("imagery, image processing, pattern recognition");
+  module->description =
+      _("Module for feature extraction. "
+        "i.pr: Pattern Recognition environment for image processing. Includes kNN, "
+        "Decision Tree and SVM classification techniques. Also includes "
+        "cross-validation and bagging methods for model validation.");
+
 /* set up command line */
     opt1              = G_define_option();
     opt1->key         = "features";

Modified: trunk/grassaddons/i.pr/i.pr_features_selection/main.c
===================================================================
--- trunk/grassaddons/i.pr/i.pr_features_selection/main.c	2007-12-04 12:46:13 UTC (rev 1236)
+++ trunk/grassaddons/i.pr/i.pr_features_selection/main.c	2007-12-04 14:30:40 UTC (rev 1237)
@@ -1,14 +1,33 @@
-#include <grass/gis.h>
-#include "global.h"
+/****************************************************************
+ *
+ * MODULE:     i.pr
+ *
+ * AUTHOR(S):  Stefano Merler, ITC-irst
+ *
+ * PURPOSE:    i.pr - Pattern Recognition
+ *
+ * COPYRIGHT:  (C) 2007 by the GRASS Development Team
+ *
+ *             This program is free software under the
+ *             GNU General Public License (>=v2).
+ *             Read the file COPYING that comes with GRASS
+ *             for details.
+ *
+ ****************************************************************/
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include "global.h"
 
 int main(argc, argv)
      int argc ;
      char **argv ;
 {
+  struct GModule *module;
   struct Option *opt1;
   struct Option *opt2;
   struct Option *opt3;
@@ -46,21 +65,18 @@
   int ncicli;
   double **H_tot,**H_tmp,*valoriDJ,*wsquarenuovo,*vareliminatedouble;
   int svm_verbose;
-  char gisrc[500];
 
-  if(getenv("GISBASE")==NULL)
-    setenv("GISBASE",
-	   ".",1);
-  /*"/mpa_sw/ssi/BIO/software/GRASS5.0.0/grass5bin_cvs/grass5",1);*/
-  if(getenv("GISRC")==NULL){
-    sprintf(gisrc,".grassrc5");
-    /*sprintf(gisrc,"/ssi0/ssi/%s/.grassrc5",getenv("LOGNAME"));*/
-    setenv("GISRC",gisrc,1);
-  }
-
   /* Initialize the GIS calls */
   G_gisinit(argv[0]) ;
 
+  module = G_define_module();
+  module->keywords = _("imagery, image processing, pattern recognition");
+  module->description =
+      _("Module for feature selection. "
+        "i.pr: Pattern Recognition environment for image processing. Includes kNN, "
+        "Decision Tree and SVM classification techniques. Also includes "
+        "cross-validation and bagging methods for model validation.");
+
   /* set up command line */
   opt1              = G_define_option();
   opt1->key         = "features";

Modified: trunk/grassaddons/i.pr/i.pr_model/main.c
===================================================================
--- trunk/grassaddons/i.pr/i.pr_model/main.c	2007-12-04 12:46:13 UTC (rev 1236)
+++ trunk/grassaddons/i.pr/i.pr_model/main.c	2007-12-04 14:30:40 UTC (rev 1237)
@@ -1,14 +1,33 @@
-#include <grass/gis.h>
-#include "global.h"
+/****************************************************************
+ *
+ * MODULE:     i.pr
+ *
+ * AUTHOR(S):  Stefano Merler, ITC-irst
+ *
+ * PURPOSE:    i.pr - Pattern Recognition
+ *
+ * COPYRIGHT:  (C) 2007 by the GRASS Development Team
+ *
+ *             This program is free software under the
+ *             GNU General Public License (>=v2).
+ *             Read the file COPYING that comes with GRASS
+ *             for details.
+ *
+ ****************************************************************/
+
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <math.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include "global.h"
 
-
 int main(argc, argv)
     int argc ;
     char **argv ;
 {
+    struct GModule *module;
     struct Option *opt1;
     struct Option *opt2;
     struct Option *opt3;
@@ -75,21 +94,19 @@
     int parallel_boosting;
     double *misratio;
     double misclass_ratio;
-    char gisrc[500];
     int testset;
-    
-    if(getenv("GISBASE")==NULL)
-      setenv("GISBASE",
-	     "/mpa_sw/ssi/BIO/software/GRASS5.0.0/grass5bin_cvs/grass5",1);
-    if(getenv("GISRC")==NULL){
-      sprintf(gisrc,".grassrc5");
-      setenv("GISRC",gisrc,1);
-    }
 
-
     /* Initialize the GIS calls */
     G_gisinit(argv[0]) ;
 
+  module = G_define_module();
+  module->keywords = _("imagery, image processing, pattern recognition");
+  module->description =
+      _("Module to generate model from features file. "
+        "i.pr: Pattern Recognition environment for image processing. Includes kNN, "
+        "Decision Tree and SVM classification techniques. Also includes "
+        "cross-validation and bagging methods for model validation.");
+
     /* set up command line */
     opt1              = G_define_option();
     opt1->key         = "features";

Modified: trunk/grassaddons/i.pr/i.pr_sites_aggregate/main.c
===================================================================
--- trunk/grassaddons/i.pr/i.pr_sites_aggregate/main.c	2007-12-04 12:46:13 UTC (rev 1236)
+++ trunk/grassaddons/i.pr/i.pr_sites_aggregate/main.c	2007-12-04 14:30:40 UTC (rev 1237)
@@ -1,8 +1,27 @@
-#include <grass/gis.h>
-#include "global.h"
+/****************************************************************
+ *
+ * MODULE:     i.pr
+ *
+ * AUTHOR(S):  Stefano Merler, ITC-irst
+ *
+ * PURPOSE:    i.pr - Pattern Recognition
+ *
+ * COPYRIGHT:  (C) 2007 by the GRASS Development Team
+ *
+ *             This program is free software under the
+ *             GNU General Public License (>=v2).
+ *             Read the file COPYING that comes with GRASS
+ *             for details.
+ *
+ ****************************************************************/
+
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <math.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include "global.h"
 #include <grass/Vect.h>
 
 
@@ -12,6 +31,7 @@
      int argc;
      char *argv[];
 {
+  struct GModule *module;
   struct Option *opt1,*opt2,*opt3,*opt4;
   char *line=NULL;
   FILE *fp;
@@ -61,8 +81,16 @@
  /***** Start of main *****/
   G_gisinit(argv[0]);
 
+  module = G_define_module();
+  module->keywords = _("imagery, image processing, pattern recognition");
+  module->description =
+      _("Module to aggregate sites. "
+        "i.pr: Pattern Recognition environment for image processing. Includes kNN, "
+        "Decision Tree and SVM classification techniques. Also includes "
+        "cross-validation and bagging methods for model validation.");
+
   if (G_parser(argc, argv) < 0)
-    exit(-1);
+    exit(EXIT_FAILURE);
 
   sscanf(opt2->answer,"%lf",&max_dist);
   max_dist *= max_dist;

Modified: trunk/grassaddons/i.pr/i.pr_statistics/main.c
===================================================================
--- trunk/grassaddons/i.pr/i.pr_statistics/main.c	2007-12-04 12:46:13 UTC (rev 1236)
+++ trunk/grassaddons/i.pr/i.pr_statistics/main.c	2007-12-04 14:30:40 UTC (rev 1237)
@@ -1,8 +1,28 @@
+/****************************************************************
+ *
+ * MODULE:     i.pr
+ *
+ * AUTHOR(S):  Stefano Merler, ITC-irst
+ *
+ * PURPOSE:    i.pr - Pattern Recognition
+ *
+ * COPYRIGHT:  (C) 2007 by the GRASS Development Team
+ *
+ *             This program is free software under the
+ *             GNU General Public License (>=v2).
+ *             Read the file COPYING that comes with GRASS
+ *             for details.
+ *
+ ****************************************************************/
+
 #include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/glocale.h>
+#include "global.h"
 #include <grass/raster.h>
-#include "global.h"
 /*#include "edit.h"*/
 #include "localproto.h"
 
@@ -16,6 +36,7 @@
      int argc;
      char *argv[];
 {
+  struct GModule *module;
   struct Option *opt1;
   struct Option *opt2;
   struct Option *opt3;
@@ -49,18 +70,17 @@
   double d,prob,coeffcorr,pvalue,zvalue;
   double mean,sd;
   int *indexA;
-  char gisrc[500];
   
-  if(getenv("GISBASE")==NULL)
-    setenv("GISBASE",
-	   "/mpa_sw/ssi/BIO/software/GRASS5.0.0/grass5bin_cvs/grass5",1);
-  if(getenv("GISRC")==NULL){
-    sprintf(gisrc,"/ssi0/ssi/%s/.grassrc5",getenv("LOGNAME"));
-    setenv("GISRC",gisrc,1);
-  }
-  
   G_gisinit(argv[0]);
 
+  module = G_define_module();
+  module->keywords = _("imagery, image processing, pattern recognition");
+  module->description =
+      _("Module to calculate feature statistics. "
+        "i.pr: Pattern Recognition environment for image processing. Includes kNN, "
+        "Decision Tree and SVM classification techniques. Also includes "
+        "cross-validation and bagging methods for model validation.");
+
   opt1 = G_define_option() ;
   opt1->key        = "features";
   opt1->type       = TYPE_STRING;

Modified: trunk/grassaddons/i.pr/i.pr_subsets/main.c
===================================================================
--- trunk/grassaddons/i.pr/i.pr_subsets/main.c	2007-12-04 12:46:13 UTC (rev 1236)
+++ trunk/grassaddons/i.pr/i.pr_subsets/main.c	2007-12-04 14:30:40 UTC (rev 1237)
@@ -1,8 +1,27 @@
-#include <grass/gis.h>
-#include "global.h"
+/****************************************************************
+ *
+ * MODULE:     i.pr
+ *
+ * AUTHOR(S):  Stefano Merler, ITC-irst
+ *
+ * PURPOSE:    i.pr - Pattern Recognition
+ *
+ * COPYRIGHT:  (C) 2007 by the GRASS Development Team
+ *
+ *             This program is free software under the
+ *             GNU General Public License (>=v2).
+ *             Read the file COPYING that comes with GRASS
+ *             for details.
+ *
+ ****************************************************************/
+
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <math.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include "global.h"
 
 void write_matrix();
 
@@ -10,6 +29,7 @@
      int argc ;
      char **argv ;
 {
+  struct GModule *module;
   struct Option *opt1;
   struct Option *opt2;
   struct Option *opt3;
@@ -37,21 +57,17 @@
   double probok;
   int seed;
 
-  char gisrc[500];
-
-  if(getenv("GISBASE")==NULL)
-    setenv("GISBASE",
-	   ".",1);
-	   //"/mpa_sw/ssi/BIO/software/GRASS5.0.0/grass5bin_cvs/grass5",1);
-  if(getenv("GISRC")==NULL){
-    sprintf(gisrc,".grassrc5");
-    //sprintf(gisrc,"/ssi0/ssi/%s/.grassrc5",getenv("LOGNAME"));
-    setenv("GISRC",gisrc,1);
-  }
-  
   /* Initialize the GIS calls */
   G_gisinit(argv[0]) ;
 
+  module = G_define_module();
+  module->keywords = _("imagery, image processing, pattern recognition");
+  module->description =
+      _("Module to create features file for experiment using a features file and applying cross-validation or bootstrap resampling. "
+        "i.pr: Pattern Recognition environment for image processing. Includes kNN, "
+        "Decision Tree and SVM classification techniques. Also includes "
+        "cross-validation and bagging methods for model validation.");
+
   /* set up command line */
   opt1              = G_define_option();
   opt1->key         = "features";

Modified: trunk/grassaddons/i.pr/i.pr_training/main.c
===================================================================
--- trunk/grassaddons/i.pr/i.pr_training/main.c	2007-12-04 12:46:13 UTC (rev 1236)
+++ trunk/grassaddons/i.pr/i.pr_training/main.c	2007-12-04 14:30:40 UTC (rev 1237)
@@ -13,6 +13,7 @@
      int argc ;
      char **argv ;
 {
+  struct GModule *module;
   struct Option *opt1;
   struct Option *opt2;
   struct Option *opt3;
@@ -45,17 +46,17 @@
 
   char gisrc[500];
   
-  if(getenv("GISBASE")==NULL)
-      setenv("GISBASE",
-	     "/mpa_sw/ssi/BIO/software/GRASS5.0.0/grass5bin_cvs/grass5",1);
-  if(getenv("GISRC")==NULL){
-    sprintf(gisrc,"/ssi0/ssi/%s/.grassrc5",getenv("LOGNAME"));
-    setenv("GISRC",gisrc,1);
-  }
-  
   /* Initialize the GIS calls */
   G_gisinit(argv[0]) ;
 
+  module = G_define_module();
+  module->keywords = _("imagery, image processing, pattern recognition");
+  module->description =
+      _("Module to generate the training samples for use in i.pr.* modules. "
+        "i.pr: Pattern Recognition environment for image processing. Includes kNN, "
+        "Decision Tree and SVM classification techniques. Also includes "
+        "cross-validation and bagging methods for model validation.");
+
   sprintf(opt1desc,"Input raster maps (max %d) for extracting the training examples.\n\t\tThe first one will be used for graphical output in case vis_map option not set",TRAINING_MAX_LAYERS);
   /* set up command line */
   opt1              = G_define_option();

Modified: trunk/grassaddons/i.pr/i.pr_uxb/main.c
===================================================================
--- trunk/grassaddons/i.pr/i.pr_uxb/main.c	2007-12-04 12:46:13 UTC (rev 1236)
+++ trunk/grassaddons/i.pr/i.pr_uxb/main.c	2007-12-04 14:30:40 UTC (rev 1237)
@@ -1,16 +1,35 @@
-#include <grass/gis.h>
-#include "global.h"
+/****************************************************************
+ *
+ * MODULE:     i.pr
+ *
+ * AUTHOR(S):  Stefano Merler, ITC-irst
+ *
+ * PURPOSE:    i.pr - Pattern Recognition
+ *
+ * COPYRIGHT:  (C) 2007 by the GRASS Development Team
+ *
+ *             This program is free software under the
+ *             GNU General Public License (>=v2).
+ *             Read the file COPYING that comes with GRASS
+ *             for details.
+ *
+ ****************************************************************/
+
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <math.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include "global.h"
 
-
 int extract_array_with_null();
 
 int main(argc,argv)
 int argc;
 char *argv[];
 {
+  struct GModule *module;
   struct Option *opt1;
   struct Option *opt2;
   int model_type;
@@ -44,16 +63,6 @@
   int R,C;
   int last_row;
   
-  char gisrc[500];
-
-  if(getenv("GISBASE")==NULL)
-    setenv("GISBASE",
-	   "/mpa_sw/ssi/BIO/software/GRASS5.0.0/grass5bin_cvs/grass5",1);
-  if(getenv("GISRC")==NULL){
-      sprintf(gisrc,"/ssi0/ssi/%s/.grassrc5",getenv("LOGNAME"));
-      setenv("GISRC",gisrc,1);
-  }
-  
   /* Define the different options */
 
   opt1              = G_define_option();
@@ -73,8 +82,16 @@
   /***** Start of main *****/
   G_gisinit(argv[0]);
 
+  module = G_define_module();
+  module->keywords = _("imagery, image processing, pattern recognition");
+  module->description =
+      _("Module for detection of unexploded bombs. "
+        "i.pr: Pattern Recognition environment for image processing. Includes kNN, "
+        "Decision Tree and SVM classification techniques. Also includes "
+        "cross-validation and bagging methods for model validation.");
+
   if (G_parser(argc, argv) < 0)
-    exit(-1);
+    exit(EXIT_FAILURE);
 
   /*read the model*/
   model_type=read_model(opt2->answer,&features,&nn,&gm,&tree,



More information about the grass-commit mailing list