Skip to content
Permalink
Browse files

fix Processing GDAL near black tool

  • Loading branch information
Giovanni Manghi
Giovanni Manghi committed Feb 8, 2016
1 parent 964ae1f commit 5e5ddafb0e2e0ac8b116ac0e260a17718545747a
Showing with 11 additions and 8 deletions.
  1. +11 −8 python/plugins/processing/algs/gdal/nearblack.py
@@ -43,22 +43,25 @@ class nearblack(GdalAlgorithm):
def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Near black')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Analysis')
self.addParameter(ParameterRaster(nearblack.INPUT,
self.addParameter(ParameterRaster(self.INPUT,
self.tr('Input layer'), False))
self.addParameter(ParameterNumber(nearblack.NEAR,
self.addParameter(ParameterNumber(self.NEAR,
self.tr('How far from black (white)'), 0, None, 15))
self.addParameter(ParameterBoolean(nearblack.WHITE,
self.addParameter(ParameterBoolean(self.WHITE,
self.tr('Search for nearly white pixels instead of nearly black'),
False))
self.addOutput(OutputRaster(nearblack.OUTPUT, self.tr('Nearblack')))
self.addOutput(OutputRaster(self.OUTPUT, self.tr('Nearblack')))

def getConsoleCommands(self):
arguments = []
arguments.append('-o')
arguments.append(self.getOutputValue(nearblack.OUTPUT))
output = unicode(self.getOutputValue(self.OUTPUT))
arguments.append(output)
arguments.append('-of')
arguments.append(GdalUtils.getFormatShortNameFromFilename(output))
arguments.append('-near')
arguments.append(unicode(self.getParameterValue(nearblack.NEAR)))
if self.getParameterValue(nearblack.WHITE):
arguments.append(unicode(self.getParameterValue(self.NEAR)))
if self.getParameterValue(self.WHITE):
arguments.append('-white')
arguments.append(self.getParameterValue(nearblack.INPUT))
arguments.append(self.getParameterValue(self.INPUT))
return ['nearblack', GdalUtils.escapeAndJoin(arguments)]

0 comments on commit 5e5ddaf

Please sign in to comment.
You can’t perform that action at this time.