Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add i.segment algorithm
- Loading branch information
|
|
@@ -0,0 +1,16 @@ |
|
|
i.segment |
|
|
Identifies segments (objects) from imagery data. |
|
|
Imagery (i.*) |
|
|
ParameterMultipleInput|input|Input rasters|3|False |
|
|
ParameterNumber|threshold|Difference threshold between 0 and 1|0.0|1.0|0.5|False |
|
|
ParameterSelection|method|Segmentation method|region_growing|0 |
|
|
ParameterSelection|similarity|Similarity calculation method|euclidean;manhattan|0 |
|
|
ParameterNumber|minsize|Minimum number of cells in a segment|1|100000|1|True |
|
|
ParameterNumber|memory|Amount of memory to use in MB|1|None|300|True |
|
|
ParameterNumber|iterations|Maximum number of iterations|1|None|20|True |
|
|
ParameterRaster|seeds|Name for input raster map with starting seeds|True |
|
|
ParameterRaster|bounds|Name of input bounding/constraining raster map|True |
|
|
*ParameterBoolean|-d|Use 8 neighbors (3x3 neighborhood) instead of the default 4 neighbors for each pixel|False |
|
|
*ParameterBoolean|-w|Weighted input, do not perform the default scaling of input raster maps|False |
|
|
OutputRaster|output|Segmented Raster |
|
|
OutputRaster|goodness|Goodness Raster |
|
@@ -118,7 +118,7 @@ def regroupRasters(alg, field, groupField, subgroupField=None, sigsetField=None) |
|
|
|
|
|
command = 'i.group group={}{} input={}'.format( |
|
|
group.value, |
|
|
' subgroup={}'.format(subgroup.value) if subgroup else '', |
|
|
' subgroup={}'.format(subgroup.value) if subgroupField else '', |
|
|
','.join([alg.exportedLayers[f] for f in rastersList]) |
|
|
) |
|
|
alg.commands.append(command) |
|
|
|
|
@@ -0,0 +1,33 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
""" |
|
|
*************************************************************************** |
|
|
i_segment.py |
|
|
------------ |
|
|
Date : March 2016 |
|
|
Copyright : (C) 2016 by Médéric Ribreux |
|
|
Email : medspx at medspx dot fr |
|
|
*************************************************************************** |
|
|
* * |
|
|
* This program is free software; you can redistribute it and/or modify * |
|
|
* it under the terms of the GNU General Public License as published by * |
|
|
* the Free Software Foundation; either version 2 of the License, or * |
|
|
* (at your option) any later version. * |
|
|
* * |
|
|
*************************************************************************** |
|
|
""" |
|
|
|
|
|
__author__ = 'Médéric Ribreux' |
|
|
__date__ = 'March 2016' |
|
|
__copyright__ = '(C) 2016, Médéric Ribreux' |
|
|
|
|
|
# This will get replaced with a git SHA1 when you do a git archive |
|
|
|
|
|
__revision__ = '$Format:%H$' |
|
|
|
|
|
from i import regroupRasters |
|
|
|
|
|
|
|
|
def processCommand(alg): |
|
|
# Regroup rasters |
|
|
regroupRasters(alg, 'input', 'group') |
|
@@ -25,7 +25,7 @@ |
|
|
|
|
|
__revision__ = '$Format:%H$' |
|
|
|
|
|
from i import multipleOutputDir, verifyRasterNum, regroupRasters |
|
|
from i import multipleOutputDir, verifyRasterNum |
|
|
from processing.core.parameters import getParameterFromString |
|
|
|
|
|
|
|
|
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.