Skip to content

Commit

Permalink
Add i.segment algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
Médéric Ribreux authored and Médéric RIBREUX committed May 29, 2016
1 parent 7bc5338 commit a73ed12
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
16 changes: 16 additions & 0 deletions python/plugins/processing/algs/grass7/description/i.segment.txt
@@ -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
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/grass7/ext/i.py
Expand Up @@ -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)
Expand Down
33 changes: 33 additions & 0 deletions python/plugins/processing/algs/grass7/ext/i_segment.py
@@ -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')
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/grass7/ext/i_tasscap.py
Expand Up @@ -25,7 +25,7 @@

__revision__ = '$Format:%H$'

from i import multipleOutputDir, verifyRasterNum, regroupRasters
from i import multipleOutputDir, verifyRasterNum
from processing.core.parameters import getParameterFromString


Expand Down

0 comments on commit a73ed12

Please sign in to comment.