This tool performs a simple region-growing operation. The user must specify the names of one or more raster images, forming a raster image stack. Note that all of the rasters in the stack must have the same dimensions. A seed points vector file then serves as the starting locations (seeds) for a simple region-growing operation such that neighbouring grid cells with values that differ from their adjoining seed pixel by less than a specified threshold value, are clumped into the same object. Object values (identifiers) are taken from the seed point feature numbers within the input shapefile. Connectivity can be defined using either the 8-cell (Moore) or 4-cell (von Neumann) connectivity rules, depending on whether diagnol neighbours should be included. The similarity value is calculated based on grid cell stack totals.
The following is an example of a Python script using this tool:
wd = pluginHost.getWorkingDirectory()
# You may have multiple input files but they must
# be separated by semicolons in the string.
inputFiles = wd + "input1.dep" + ";" + wd + "input2.dep" + ";" + wd + "input3.dep"
seedFile = wd + "seeds.shp"
outputFile = wd + "output.dep"
similarity = "100.0"
neighbourhoodType = "vonNeumann"
args = [inputFiles, seedFile, outputFile, similarity, neighbourhoodType]
pluginHost.runPlugin("SimpleRegionGrow", args, False)
This is a Groovy script also using this tool:
def wd = pluginHost.getWorkingDirectory()
// You may have multiple input files but they must
// be separated by semicolons in the string.
def inputFiles = wd + "input1.dep" + ";" + wd + "input2.dep" + ";" + wd + "input3.dep"
def seedFile = wd + "seeds.shp"
def outputFile = wd + "output.dep"
def similarity = "100.0"
def neighbourhoodType = "moore"
String[] args = [inputFiles, seedFile, outputFile, similarity, neighbourhoodType]
pluginHost.runPlugin("SimpleRegionGrow", args, false)