Skip to content

Commit b53e211

Browse files
author
cpolymeris@gmail.com
committed
OTB extents. Test implementation.
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@254 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
1 parent 4899de0 commit b53e211

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

src/sextante/otb/OTBAlgorithm.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from sextante.parameters.ParameterSelection import ParameterSelection
1313
from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
1414
from sextante.core.SextanteLog import SextanteLog
15-
#~ from sextante.core.Sextante import Sextante
15+
from sextante.core.SextanteUtils import SextanteUtils
1616
from sextante.parameters.ParameterFactory import ParameterFactory
1717
from sextante.outputs.OutputFactory import OutputFactory
1818
from sextante.otb.OTBUtils import OTBUtils
@@ -69,7 +69,7 @@ def defineCharacteristicsFromFile(self):
6969
elif line.startswith("Extent"):
7070
self.extentParamNames = line[6:].strip().split(" ")
7171
self.addParameter(ParameterExtent(self.REGION_OF_INTEREST, "Region of interest", "0,1,0,1"))
72-
self.roiFile = SextanteUtils.getTempFilename()
72+
self.roiFile = SextanteUtils.getTempFilename('tif')
7373
else:
7474
self.addOutput(OutputFactory.getFromString(line))
7575
line = lines.readline().strip("\n").strip()
@@ -98,7 +98,7 @@ def processAlgorithm(self, progress):
9898
commands.append(param.name)
9999
if self.roiFile:
100100
commands.append(self.roiFile)
101-
self.roiInput = param.name
101+
self.roiInput = param.value
102102
else:
103103
commands.append(param.value)
104104
elif isinstance(param, ParameterMultipleInput):
@@ -121,15 +121,20 @@ def processAlgorithm(self, progress):
121121
for out in self.outputs:
122122
commands.append(out.name)
123123
commands.append(out.value)
124-
124+
125125
if self.roiFile:
126-
args = {"in": self.roiInput,
127-
"out": self.roiFile,
128-
"startx": self.roiValues[0],
129-
"starty": self.roiValues[1],
130-
"sizex": self.roiValues[2],
131-
"sizey": self.roiValues[3]}
132-
Sextante.runalg("ExtractROI", *args)
126+
startX, startY = float(self.roiValues[0]), float(self.roiValues[0])
127+
sizeX = float(self.roiValues[2]) - startX
128+
sizeY = float(self.roiValues[3]) - startY
129+
helperCommands = [
130+
path + os.sep + "otbcli_ExtractROI",
131+
"-in", self.roiInput,
132+
"-out", self.roiFile,
133+
"-startx", startX,
134+
"-starty", startY,
135+
"-sizex", sizeX,
136+
"-sizey", sizeY]
137+
OTBUtils.executeOtb(helperCommands, progress)
133138

134139
loglines = []
135140
loglines.append("OTB execution command")

src/sextante/otb/description/Smoothing.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ ParameterNumber|-type.mean.radius|Radius|None|None|2
1010
ParameterNumber|-type.gaussian.radius|Radius|None|None|2
1111
ParameterNumber|-type.anidif.timestep|Time Step|None|None|0.125
1212
ParameterNumber|-type.anidif.nbiter|Nb Iterations|None|None|10
13+
Extent

0 commit comments

Comments
 (0)