GRASS logo


i.segment.stats - Calculates statistics describing raster areas.


imagery, segmentation, statistics


i.segment.stats --help
i.segment.stats [-rs] map=name [rasters=name[,name,...]] [raster_statistics=string[,string,...]] [area_measures=string[,string,...]] [csvfile=name] [separator=character] [vectormap=name] [processes=integer] [--overwrite] [--help] [--verbose] [--quiet] [--ui]


Adjust region to input map
Do not calculate any shape statistics
Allow output files to overwrite existing files
Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


map=name [required]
Name for input raster map with areas
Raster map with areas (all pixels of an area have same id), such as the output of i.segment
Name of input raster maps for statistics
Statistics to calculate for each input raster map
Options: min, max, range, mean, mean_of_abs, stddev, variance, coeff_var, sum, sum_abs, first_quart, median, third_quart, perc_90
Default: mean,stddev,sum
Area measurements to include in the output
Options: area, perimeter, compact_circle, compact_square, fd
Default: area,perimeter,compact_circle,fd
Name for output CSV file containing statistics
Field separator
Special characters: pipe, comma, space, tab, newline
Default: pipe
Name for optional vector output map with statistics as attributes
Number of processes to run in parallel (for multiple rasters)
Default: 1

Table of contents


i.segment.stats calculates statistics for areas in a raster map. Areas are defined by adjacent pixels with the same value. Such areas can be the output of i.segment or r.clump.

Available statistics are those related to the shape and size of the areas (see the r.object.geometry addon man page for more information on the statistics) and aggregated statistics of pixel values of other raster maps (see v.univar for details).

The user can chose between output in the form of a vector map of the areas with the statistics in the attribute table (vectormap) and/or in the form of a CSV text file (csvfile).


The module respects the current region settings. The -r flag allows to force the module to adjust the region to the input raster map before calculating the statistics.

This module is a simple front-end to v.univar and the r.object.geometry add-on. It is the user's responsibility to install the latter using g.extension. If other statistics are desired, these should probably be implemented in those (or other) modules which can then be called from this module.

Problems can arise in the calculation of some form statistics for certain segment forms. If errors arise, the user might want to try to run r.clump on the input raster file before running i.segment.stats.

When treating files with a large number objects, creating the vector map can be very time-consuming. In that case, it might be easier to only work with the csvfile output.

The processing of several raster input files for which to calculate per-segment statistics can be parallelized by setting the processes parameter to the number of desired parallel processes, with at most one process per raster to be treated.

EXAMPLE group=landsat_pan input=lsat7_2002_80
g.region rast=lsat7_2002_80 -p
i.segment group=landsat_pan output=ls_pan_seg01 threshold=0.1 memory=4000 minsize=50
i.segment.stats map=ls_pan_seg01 csvfile=segstats.csv vectormap=ls_pan_seg01 \
  rasters=lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40,lsat7_2002_50,lsat7_2002_70 \


i.segment, v.univar, v.rast.stats

r.object.geometry (Addon) v.class.mlR (Addon)


Moritz Lennert

Last changed: $Date: 2017-11-02 14:27:22 +0100 (Thu, 02 Nov 2017) $


Available at: i.segment.stats source code (history)

Main index | Imagery index | Topics index | Keywords index | Graphical index | Full index

© 2003-2018 GRASS Development Team, GRASS GIS 7.4.1svn Reference Manual