Skip to content
Permalink
Browse files

OTB extents. Test implementation.

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@254 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
cpolymeris@gmail.com
cpolymeris@gmail.com committed Jun 19, 2012
1 parent 4899de0 commit b53e211b175d49eb983cd9aa5102a22362f8f77d
Showing with 17 additions and 11 deletions.
  1. +16 −11 src/sextante/otb/OTBAlgorithm.py
  2. +1 −0 src/sextante/otb/description/Smoothing.txt
@@ -12,7 +12,7 @@
from sextante.parameters.ParameterSelection import ParameterSelection
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from sextante.core.SextanteLog import SextanteLog
#~ from sextante.core.Sextante import Sextante
from sextante.core.SextanteUtils import SextanteUtils
from sextante.parameters.ParameterFactory import ParameterFactory
from sextante.outputs.OutputFactory import OutputFactory
from sextante.otb.OTBUtils import OTBUtils
@@ -69,7 +69,7 @@ def defineCharacteristicsFromFile(self):
elif line.startswith("Extent"):
self.extentParamNames = line[6:].strip().split(" ")
self.addParameter(ParameterExtent(self.REGION_OF_INTEREST, "Region of interest", "0,1,0,1"))
self.roiFile = SextanteUtils.getTempFilename()
self.roiFile = SextanteUtils.getTempFilename('tif')
else:
self.addOutput(OutputFactory.getFromString(line))
line = lines.readline().strip("\n").strip()
@@ -98,7 +98,7 @@ def processAlgorithm(self, progress):
commands.append(param.name)
if self.roiFile:
commands.append(self.roiFile)
self.roiInput = param.name
self.roiInput = param.value
else:
commands.append(param.value)
elif isinstance(param, ParameterMultipleInput):
@@ -121,15 +121,20 @@ def processAlgorithm(self, progress):
for out in self.outputs:
commands.append(out.name)
commands.append(out.value)

if self.roiFile:
args = {"in": self.roiInput,
"out": self.roiFile,
"startx": self.roiValues[0],
"starty": self.roiValues[1],
"sizex": self.roiValues[2],
"sizey": self.roiValues[3]}
Sextante.runalg("ExtractROI", *args)
startX, startY = float(self.roiValues[0]), float(self.roiValues[0])
sizeX = float(self.roiValues[2]) - startX
sizeY = float(self.roiValues[3]) - startY
helperCommands = [
path + os.sep + "otbcli_ExtractROI",
"-in", self.roiInput,
"-out", self.roiFile,
"-startx", startX,
"-starty", startY,
"-sizex", sizeX,
"-sizey", sizeY]
OTBUtils.executeOtb(helperCommands, progress)

loglines = []
loglines.append("OTB execution command")
@@ -10,3 +10,4 @@ ParameterNumber|-type.mean.radius|Radius|None|None|2
ParameterNumber|-type.gaussian.radius|Radius|None|None|2
ParameterNumber|-type.anidif.timestep|Time Step|None|None|0.125
ParameterNumber|-type.anidif.nbiter|Nb Iterations|None|None|10
Extent

0 comments on commit b53e211

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