[GRASS-SVN] r43511 -
grass/branches/releasebranch_6_4/imagery/i.rgb.his
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Sep 18 12:15:52 EDT 2010
Author: neteler
Date: 2010-09-18 16:15:52 +0000 (Sat, 18 Sep 2010)
New Revision: 43511
Modified:
grass/branches/releasebranch_6_4/imagery/i.rgb.his/closefiles.c
grass/branches/releasebranch_6_4/imagery/i.rgb.his/r2hmain.c
Log:
backport: metadata and cleanup
Modified: grass/branches/releasebranch_6_4/imagery/i.rgb.his/closefiles.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.rgb.his/closefiles.c 2010-09-18 16:15:16 UTC (rev 43510)
+++ grass/branches/releasebranch_6_4/imagery/i.rgb.his/closefiles.c 2010-09-18 16:15:52 UTC (rev 43511)
@@ -12,6 +12,7 @@
int i;
struct Colors colors;
struct Range range;
+ struct History history;
CELL min, max;
char *mapset;
@@ -22,6 +23,8 @@
mapset = G_mapset();
+ /* write colors */
+ /* set to 0,max_level instead of min,max ?? */
G_read_range(h_name, mapset, &range);
G_get_range_min_max(&range, &min, &max);
G_make_grey_scale_colors(&colors, min, max);
@@ -37,5 +40,22 @@
G_make_grey_scale_colors(&colors, min, max);
G_write_colors(s_name, mapset, &colors);
+ /* write metadata */
+ G_short_history(h_name, "raster", &history);
+ G_command_history(&history);
+ G_write_history(h_name, &history);
+ G_put_cell_title(h_name, "Image hue");
+
+ G_short_history(i_name, "raster", &history);
+ G_command_history(&history);
+ G_write_history(i_name, &history);
+ G_put_cell_title(i_name, "Image intensity");
+
+ G_short_history(s_name, "raster", &history);
+ G_command_history(&history);
+ G_write_history(s_name, &history);
+ G_put_cell_title(s_name, "Image saturation");
+
return 0;
}
+
Modified: grass/branches/releasebranch_6_4/imagery/i.rgb.his/r2hmain.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.rgb.his/r2hmain.c 2010-09-18 16:15:16 UTC (rev 43510)
+++ grass/branches/releasebranch_6_4/imagery/i.rgb.his/r2hmain.c 2010-09-18 16:15:52 UTC (rev 43511)
@@ -75,6 +75,7 @@
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
+
/* get dimension of the image */
rows = G_window_rows();
cols = G_window_cols();
@@ -89,7 +90,7 @@
for (band = 0; band < 3; band++)
if (G_get_map_row(fd_input[band], rowbuffer[band], i) < 0)
- G_fatal_error(_("Unable to read raster map row %d"), i);
+ G_fatal_error(_("Unable to read raster map row %ld"), i);
/* process this row of the map */
rgb2his(rowbuffer, cols);
@@ -98,11 +99,13 @@
for (band = 0; band < 3; band++)
if (G_put_raster_row(fd_output[band], rowbuffer[band], CELL_TYPE)
< 0)
- G_fatal_error(_("Failed writing raster map row %d"), i);
+ G_fatal_error(_("Failed writing raster map row %ld"), i);
}
+ G_percent(i, rows, 2);
closefiles(opt_hue->answer, opt_inten->answer, opt_sat->answer,
fd_output, rowbuffer);
+
exit(EXIT_SUCCESS);
}
More information about the grass-commit
mailing list