[GRASS-SVN] r55007 - grass/trunk/imagery/i.segment
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Feb 12 02:18:51 PST 2013
Author: martinl
Date: 2013-02-12 02:18:50 -0800 (Tue, 12 Feb 2013)
New Revision: 55007
Modified:
grass/trunk/imagery/i.segment/i.segment.xl.html
grass/trunk/imagery/i.segment/main.c
grass/trunk/imagery/i.segment/parse_args.c
Log:
i.segment.xl: more guisections
remove trailing dots
Modified: grass/trunk/imagery/i.segment/i.segment.xl.html
===================================================================
--- grass/trunk/imagery/i.segment/i.segment.xl.html 2013-02-12 09:51:18 UTC (rev 55006)
+++ grass/trunk/imagery/i.segment/i.segment.xl.html 2013-02-12 10:18:50 UTC (rev 55007)
@@ -164,6 +164,7 @@
<a href="http://grass.osgeo.org/wiki/Image_classification">classification in GRASS</a>
is at available on the wiki.
</p>
+
<h2>SEE ALSO</h2>
<em>
<a href="i.group.html">i.group</a>,
@@ -174,6 +175,7 @@
</em>
<h2>AUTHORS</h2>
-Eric Momsen - North Dakota State University<br>
-Markus Metz (GSoC Mentor)
+Eric Momsen - North Dakota State University (Google Summer of Code 2012, mentor: Markus Metz)<br>
+Various improvements by Markus Metz
+
Modified: grass/trunk/imagery/i.segment/main.c
===================================================================
--- grass/trunk/imagery/i.segment/main.c 2013-02-12 09:51:18 UTC (rev 55006)
+++ grass/trunk/imagery/i.segment/main.c 2013-02-12 10:18:50 UTC (rev 55007)
@@ -2,20 +2,21 @@
/****************************************************************************
*
* MODULE: i.segment
- * AUTHOR(S): Eric Momsen <eric.momsen at gmail com>
+ * AUTHOR(S): Eric Momsen <eric.momsen at gmail com> (Google Summer of Code 2012)
+ * Optimized by Markus Metz
* PURPOSE: Segments an image group.
* COPYRIGHT: (C) 2012 by Eric Momsen, and the GRASS Development Team
*
- * This program is free software under the GNU General Public
- * License (>=v2). Read the COPYING file that comes with GRASS
- * for details.
+ * This program is free software under the GNU General
+ * Public License (>=v2). Read the COPYING file that
+ * comes with GRASS for details.
*
*
- * NOTE: the word "segment" is already used by the Segmentation
- * Library for the data files/tiling, so iseg (image segmentation)
- * will be used to refer to the image segmentation.
+ * NOTE: the word "segment" is already used by the
+ * Segmentation Library for the data files/tiling, so
+ * iseg (image segmentation) will be used to refer to
+ * the image segmentation.
*
- *
*****************************************************************************/
#include <stdlib.h>
@@ -25,7 +26,7 @@
int main(int argc, char *argv[])
{
- struct globals globals; /* input and output file descriptors, data structure, buffers */
+ struct globals globals; /* input and output file descriptors, data structure, buffers */
struct GModule *module;
G_gisinit(argv[0]);
@@ -34,22 +35,21 @@
G_add_keyword(_("imagery"));
G_add_keyword(_("segmentation"));
module->description =
- _("Outputs a single segmented map (raster) based on input values in an image group.");
+ _("Outputs a single segmented raster map based on input values in an image group.");
- if (parse_args(argc, argv, &globals) != TRUE)
- G_fatal_error(_("Error in parse_args()"));
-
+ parse_args(argc, argv, &globals);
+
G_debug(1, "Main: starting open_files()");
if (open_files(&globals) != TRUE)
- G_fatal_error(_("Error in open_files()"));
+ G_fatal_error(_("Error in reading data"));
G_debug(1, "Main: starting create_isegs()");
if (create_isegs(&globals) != TRUE)
- G_fatal_error(_("Error in create_isegs()"));
+ G_fatal_error(_("Error in creating segments"));
G_debug(1, "Main: starting write_output()");
if (write_output(&globals) != TRUE)
- G_fatal_error(_("Error in write_output()"));
+ G_fatal_error(_("Error in writing data"));
G_debug(1, "Main: starting close_files()");
close_files(&globals);
Modified: grass/trunk/imagery/i.segment/parse_args.c
===================================================================
--- grass/trunk/imagery/i.segment/parse_args.c 2013-02-12 09:51:18 UTC (rev 55006)
+++ grass/trunk/imagery/i.segment/parse_args.c 2013-02-12 10:18:50 UTC (rev 55007)
@@ -27,8 +27,8 @@
threshold->key = "threshold";
threshold->type = TYPE_DOUBLE;
threshold->required = YES;
- threshold->label = _("Difference threshold between 0 and 1.");
- threshold->description = _("Threshold = 0 merges only identical segments; threshold = 1 merges all.");
+ threshold->label = _("Difference threshold between 0 and 1");
+ threshold->description = _("Threshold = 0 merges only identical segments; threshold = 1 merges all");
/* optional parameters */
@@ -37,7 +37,8 @@
method->type = TYPE_STRING;
method->required = NO;
method->answer = "region_growing";
- method->description = _("Segmentation method.");
+ method->options = "region_growing";
+ method->description = _("Segmentation method");
method->guisection = _("Settings");
similarity = G_define_option();
@@ -45,8 +46,8 @@
similarity->type = TYPE_STRING;
similarity->required = YES;
similarity->answer = "euclidean";
- similarity->options = "euclidean, manhattan";
- similarity->description = _("Similarity calculation method.");
+ similarity->options = "euclidean,manhattan";
+ similarity->description = _("Similarity calculation method");
similarity->guisection = _("Settings");
min_segment_size = G_define_option();
@@ -55,9 +56,9 @@
min_segment_size->required = NO;
min_segment_size->answer = "1";
min_segment_size->options = "1-100000";
- min_segment_size->label = _("Minimum number of cells in a segment.");
+ min_segment_size->label = _("Minimum number of cells in a segment");
min_segment_size->description =
- _("The final step will merge small segments with their best neighbor.");
+ _("The final step will merge small segments with their best neighbor");
min_segment_size->guisection = _("Settings");
#ifdef _OR_SHAPE_
@@ -68,7 +69,7 @@
radio_weight->answer = "1";
radio_weight->options = "0-1";
radio_weight->label =
- _("Importance of radiometric (input raster) values relative to shape.");
+ _("Importance of radiometric (input raster) values relative to shape");
radio_weight->guisection = _("Settings");
smooth_weight = G_define_option();
@@ -78,31 +79,16 @@
smooth_weight->answer = "0.5";
smooth_weight->options = "0-1";
smooth_weight->label =
- _("Importance of smoothness relative to compactness.");
+ _("Importance of smoothness relative to compactness");
smooth_weight->guisection = _("Settings");
#endif
- /* Using raster for seeds
- * Low priority TODO: allow vector points/centroids seed input. */
- seeds = G_define_standard_option(G_OPT_R_INPUT);
- seeds->key = "seeds";
- seeds->required = NO;
- seeds->description = _("Optional raster map with starting seeds.");
-
- /* Polygon constraints. */
- bounds = G_define_standard_option(G_OPT_R_INPUT);
- bounds->key = "bounds";
- bounds->required = NO;
- bounds->label = _("Optional bounding/constraining raster map");
- bounds->description =
- _("Must be integer values, each area will be segmented independent of the others.");
-
mem = G_define_option();
mem->key = "memory";
mem->type = TYPE_INTEGER;
mem->required = NO;
mem->answer = "300";
- mem->description = _("Memory in MB.");
+ mem->description = _("Memory in MB");
/* TODO input for distance function */
@@ -112,23 +98,44 @@
endt->type = TYPE_INTEGER;
endt->required = NO;
endt->answer = "100";
- endt->description = _("Maximum number of iterations.");
+ endt->description = _("Maximum number of iterations");
+ endt->guisection = _("Settings");
+ /* Using raster for seeds
+ * Low priority TODO: allow vector points/centroids seed input. */
+ seeds = G_define_standard_option(G_OPT_R_INPUT);
+ seeds->key = "seeds";
+ seeds->required = NO;
+ seeds->description = _("Name for output raster map with starting seeds");
+ seeds->guisection = _("Optional outputs");
+
+ /* Polygon constraints. */
+ bounds = G_define_standard_option(G_OPT_R_INPUT);
+ bounds->key = "bounds";
+ bounds->required = NO;
+ bounds->label = _("Name for output bounding/constraining raster map");
+ bounds->description =
+ _("Must be integer values, each area will be segmented independent of the others");
+ bounds->guisection = _("Optional outputs");
+
outband = G_define_standard_option(G_OPT_R_OUTPUT);
outband->key = "goodness";
outband->required = NO;
outband->description =
- _("Goodness of fit estimate.");
+ _("Name for output goodness of fit estimate");
+ outband->guisection = _("Optional outputs");
diagonal = G_define_flag();
diagonal->key = 'd';
diagonal->description =
- _("Use 8 neighbors (3x3 neighborhood) instead of the default 4 neighbors for each pixel.");
+ _("Use 8 neighbors (3x3 neighborhood) instead of the default 4 neighbors for each pixel");
+ diagonal->guisection = _("Settings");
weighted = G_define_flag();
weighted->key = 'w';
weighted->description =
- _("Weighted input, don't perform the default scaling of input maps.");
+ _("Weighted input, don't perform the default scaling of input raster maps");
+ weighted->guisection = _("Settings");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
@@ -140,19 +147,19 @@
if (G_legal_filename(output->answer) == TRUE)
globals->out_name = output->answer;
else
- G_fatal_error("Invalid output raster name.");
+ G_fatal_error("Invalid output raster name");
/* Note: this threshold is scaled after we know more at the beginning of create_isegs() */
globals->alpha = atof(threshold->answer);
if (globals->alpha <= 0 || globals->alpha >= 1)
- G_fatal_error(_("threshold should be >= 0 and <= 1"));
+ G_fatal_error(_("Threshold should be >= 0 and <= 1"));
/* segmentation methods: 1 = region growing */
if (strcmp(method->answer, "region_growing") == 0)
globals->method = 1;
else
- G_fatal_error("Couldn't assign segmentation method.");
+ G_fatal_error(_("Unable to assign segmentation method"));
G_debug(1, "segmentation method: %d", globals->method);
@@ -162,7 +169,7 @@
else if (strcmp(similarity->answer, "manhattan") == 0)
globals->calculate_similarity = calculate_manhattan_similarity;
else
- G_fatal_error(_("Invalid similarity method."));
+ G_fatal_error(_("Invalid similarity method"));
#ifdef _OR_SHAPE_
/* consider shape */
@@ -201,11 +208,11 @@
globals->seeds = seeds->answer;
if (globals->seeds) {
if (G_find_raster(globals->seeds, "") == NULL) {
- G_fatal_error(_("Seeds map not found."));
+ G_fatal_error(_("Seeds raster map not found"));
}
if (Rast_map_type(globals->seeds, "") !=
CELL_TYPE) {
- G_fatal_error(_("Seeeds map must be CELL type (integers)"));
+ G_fatal_error(_("Seeeds raster map must be CELL type (integers)"));
}
}
@@ -215,11 +222,11 @@
else {
globals->bounds_map = bounds->answer;
if ((globals->bounds_mapset = G_find_raster(globals->bounds_map, "")) == NULL) {
- G_fatal_error(_("Segmentation constraint/boundary map not found."));
+ G_fatal_error(_("Segmentation constraint/boundary raster map not found"));
}
if (Rast_map_type(globals->bounds_map, globals->bounds_mapset) !=
CELL_TYPE) {
- G_fatal_error(_("Segmentation constraint map must be CELL type (integers)"));
+ G_fatal_error(_("Segmentation constraint raster map must be CELL type (integers)"));
}
}
@@ -234,7 +241,7 @@
if (G_legal_filename(outband->answer) == TRUE)
globals->out_band = outband->answer;
else
- G_fatal_error("Invalid output raster name for goodness of fit.");
+ G_fatal_error(_("Invalid output raster name for goodness of fit"));
}
if (endt->answer) {
@@ -242,7 +249,7 @@
globals->end_t = atoi(endt->answer);
else {
globals->end_t = 100;
- G_warning(_("Invalid number of iterations, 100 will be used."));
+ G_warning(_("Invalid number of iterations, 100 will be used"));
}
}
else
@@ -252,7 +259,7 @@
globals->mb = atoi(mem->answer);
else {
globals->mb = 300;
- G_warning(_("Invalid number of MB, 300 will be used."));
+ G_warning(_("Invalid number of MB, 300 will be used"));
}
return TRUE;
More information about the grass-commit
mailing list