Skip to content

i.segment.hierarchical

Hierarchical segmentation

i.segment.hierarchical group=name thresholds=float [,float,...] output=name [outputs_prefix=string] [method=string] [similarity=string] [minsizes=integer [,integer,...]] [memory=integer] [iterations=integer] [seeds=name] [bounds=name] [width=integer] [height=integer] [overlap=integer] [processes=integer] [move=string] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

i.segment.hierarchical group=name thresholds=0.02,0.05 output=name

grass.script.run_command("i.segment.hierarchical", group, thresholds=0.02,0.05, output, outputs_prefix="seg__%.2f", method="region_growing", similarity="euclidean", minsizes=None, memory=300, iterations=20, seeds=None, bounds=None, width=None, height=None, overlap=0, processes=None, move=None, overwrite=None, verbose=None, quiet=None, superquiet=None)

Example:

gs.run_command("i.segment.hierarchical", group="name", thresholds=0.02,0.05, output="name")

grass.tools.Tools.i_segment_hierarchical(group, thresholds=0.02,0.05, output, outputs_prefix="seg__%.2f", method="region_growing", similarity="euclidean", minsizes=None, memory=300, iterations=20, seeds=None, bounds=None, width=None, height=None, overlap=0, processes=None, move=None, overwrite=None, verbose=None, quiet=None, superquiet=None)

Example:

tools = Tools()
tools.i_segment_hierarchical(group="name", thresholds=0.02,0.05, output="name")

This grass.tools API is experimental in version 8.5 and expected to be stable in version 8.6.

Parameters

group=name [required]
    Name of input imagery group
thresholds=float [,float,...] [required]
    Segment thresholds
    Default: 0.02,0.05
output=name [required]
    Name of output segment raster map
outputs_prefix=string
    Name for output raster maps from segment
    Default: seg__%.2f
method=string
    Segmentation method
    Default: region_growing
similarity=string
    Similarity calculation method
    Default: euclidean
minsizes=integer [,integer,...]
    Minimum number of cells in a segment
memory=integer
    Memory in MB
    Default: 300
iterations=integer
    Maximum number of iterations
    Default: 20
seeds=name
    Name for input raster map with starting seeds
bounds=name
    Name of input bounding/constraining raster map
width=integer
    Tile width in pixels
height=integer
    Tile height in pixels
overlap=integer
    Tile overlap in pixels
    Default: 0
processes=integer
    Number of concurrent processes
move=string
    Path where move and copy the mapset
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

group : str, required
    Name of input imagery group
    Used as: input, group, name
thresholds : float | list[float] | str, required
    Segment thresholds
    Default: 0.02,0.05
output : str, required
    Name of output segment raster map
    Used as: output, raster, name
outputs_prefix : str, optional
    Name for output raster maps from segment
    Default: seg__%.2f
method : str, optional
    Segmentation method
    Default: region_growing
similarity : str, optional
    Similarity calculation method
    Default: euclidean
minsizes : int | list[int] | str, optional
    Minimum number of cells in a segment
memory : int, optional
    Memory in MB
    Default: 300
iterations : int, optional
    Maximum number of iterations
    Default: 20
seeds : str, optional
    Name for input raster map with starting seeds
    Used as: input, raster, name
bounds : str, optional
    Name of input bounding/constraining raster map
    Used as: input, raster, name
width : int, optional
    Tile width in pixels
height : int, optional
    Tile height in pixels
overlap : int, optional
    Tile overlap in pixels
    Default: 0
processes : int, optional
    Number of concurrent processes
move : str, optional
    Path where move and copy the mapset
overwrite : bool, optional
    Allow output files to overwrite existing files
    Default: None
verbose : bool, optional
    Verbose module output
    Default: None
quiet : bool, optional
    Quiet module output
    Default: None
superquiet : bool, optional
    Very quiet module output
    Default: None

group : str, required
    Name of input imagery group
    Used as: input, group, name
thresholds : float | list[float] | str, required
    Segment thresholds
    Default: 0.02,0.05
output : str | type(np.ndarray) | type(np.array) | type(gs.array.array), required
    Name of output segment raster map
    Used as: output, raster, name
outputs_prefix : str, optional
    Name for output raster maps from segment
    Default: seg__%.2f
method : str, optional
    Segmentation method
    Default: region_growing
similarity : str, optional
    Similarity calculation method
    Default: euclidean
minsizes : int | list[int] | str, optional
    Minimum number of cells in a segment
memory : int, optional
    Memory in MB
    Default: 300
iterations : int, optional
    Maximum number of iterations
    Default: 20
seeds : str | np.ndarray, optional
    Name for input raster map with starting seeds
    Used as: input, raster, name
bounds : str | np.ndarray, optional
    Name of input bounding/constraining raster map
    Used as: input, raster, name
width : int, optional
    Tile width in pixels
height : int, optional
    Tile height in pixels
overlap : int, optional
    Tile overlap in pixels
    Default: 0
processes : int, optional
    Number of concurrent processes
move : str, optional
    Path where move and copy the mapset
overwrite : bool, optional
    Allow output files to overwrite existing files
    Default: None
verbose : bool, optional
    Verbose module output
    Default: None
quiet : bool, optional
    Quiet module output
    Default: None
superquiet : bool, optional
    Very quiet module output
    Default: None

Returns:

result : grass.tools.support.ToolResult | np.ndarray | tuple[np.ndarray] | None
If the tool produces text as standard output, a ToolResult object will be returned. Otherwise, None will be returned. If an array type (e.g., np.ndarray) is used for one of the raster outputs, the result will be an array and will have the shape corresponding to the computational region. If an array type is used for more than one raster output, the result will be a tuple of arrays.

DESCRIPTION

i.segment.hierarchical performs a hierarchical segmentation on a image (group). The module uses i.segment.

EXAMPLE

TODO

SEE ALSO

i.segment

AUTHOR

Pietro Zambelli (University of Trento)

SOURCE CODE

Available at: i.segment.hierarchical source code (history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819