Skip to content

Commit

Permalink
[processing] lidar tools update
Browse files Browse the repository at this point in the history
changes by Martin Isenburg
  • Loading branch information
volaya authored and alexbruy committed Jun 2, 2016
1 parent 30813f9 commit d46f98d
Show file tree
Hide file tree
Showing 41 changed files with 1,019 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : April, October 2014
Copyright : (C) 2014 by Martin Isenburg
Date : April, October 2014 and May 2016
Copyright : (C) 2014 - 2016 by Martin Isenburg
Email : martin near rapidlasso point com
---------------------
Date : June 2014
Expand All @@ -24,7 +24,6 @@
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
Expand Down Expand Up @@ -76,6 +75,11 @@
from .lastools.lascanopy import lascanopy
from .lastools.lasoverage import lasoverage
from .lastools.lasoverlap import lasoverlap
from .lastools.laspublish import laspublish
from .lastools.lasground_new import lasground_new
from .lastools.lascontrol import lascontrol
from .lastools.lasdiff import lasdiff
from .lastools.lasheight_classify import lasheight_classify

from .lastools.lastilePro import lastilePro
from .lastools.lasgroundPro import lasgroundPro
Expand Down Expand Up @@ -104,6 +108,9 @@
from .lastools.lasmergePro import lasmergePro
from .lastools.lasviewPro import lasviewPro
from .lastools.lasoverlapPro import lasoverlapPro
from .lastools.laspublishPro import laspublishPro
from .lastools.lasgroundPro_new import lasgroundPro_new
from .lastools.lasheightPro_classify import lasheightPro_classify

from .lastools.flightlinesToDTMandDSM import flightlinesToDTMandDSM
from .lastools.flightlinesToCHM import flightlinesToCHM
Expand Down Expand Up @@ -156,13 +163,14 @@ def _loadAlgorithms(self):
lasindex(), lasthin(), lassort(), lascanopy(), lasmerge(),
las2shp(), shp2las(), lasnoise(), lassplit(), las2las_filter(),
las2las_project(), las2las_transform(), lasoverage(), lasoverlap(),
lasquery()
lasquery(), laspublish(), lasground_new(), lascontrol(), lasdiff(),
lasheight_classify()
]
else:
lastools = [
lasinfo(), lasprecision(), lasvalidate(), las2txt(), txt2las(),
laszip(), lasindex(), lasmerge(), las2las_filter(), las2las_project(),
las2las_transform(), lasquery()
las2las_transform(), lasquery(), lasdiff()
]
self.algs.extend(lastools)

Expand All @@ -175,7 +183,8 @@ def _loadAlgorithms(self):
lasnoisePro(), lasindexPro(), lascanopyPro(), blast2demPro(), lasboundaryPro(),
lasinfoPro(), las2lasPro_filter(), las2lasPro_project(), las2lasPro_transform(),
lasoveragePro(), txt2lasPro(), las2txtPro(), blast2isoPro(), lasvalidatePro(),
lasmergePro(), lasviewPro(), lasoverlapPro()
lasmergePro(), lasviewPro(), lasoverlapPro(), laspublishPro(), lasgroundPro_new(),
lasheightPro_classify()
]
else:
lastoolsPro = [
Expand Down
38 changes: 32 additions & 6 deletions python/plugins/processing/algs/lidar/lastools/LAStoolsAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : April 2014
Date : April 2014 and May 2016
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
Expand Down Expand Up @@ -70,12 +70,14 @@ class LAStoolsAlgorithm(GeoAlgorithm):
FILES_ARE_FLIGHTLINES = "FILES_ARE_FLIGHTLINES"
APPLY_FILE_SOURCE_ID = "APPLY_FILE_SOURCE_ID"
STEP = "STEP"

FILTER_RETURN_CLASS_FLAGS1 = "FILTER_RETURN_CLASS_FLAGS1"
FILTER_RETURN_CLASS_FLAGS2 = "FILTER_RETURN_CLASS_FLAGS2"
FILTER_RETURN_CLASS_FLAGS3 = "FILTER_RETURN_CLASS_FLAGS3"
FILTERS_RETURN_CLASS_FLAGS = ["---", "keep_last", "keep_first", "keep_middle", "keep_single", "drop_single",
"keep_double", "keep_class 2", "keep_class 2 8", "keep_class 8", "keep_class 6",
"keep_class 9", "keep_class 3 4 5", "keep_class 2 6", "drop_class 7", "drop_withheld", "drop_synthetic"]
"keep_class 9", "keep_class 3 4 5", "keep_class 3", "keep_class 4", "keep_class 5",
"keep_class 2 6", "drop_class 7", "drop_withheld", "drop_synthetic"]
FILTER_COORDS_INTENSITY1 = "FILTER_COORDS_INTENSITY1"
FILTER_COORDS_INTENSITY2 = "FILTER_COORDS_INTENSITY2"
FILTER_COORDS_INTENSITY3 = "FILTER_COORDS_INTENSITY3"
Expand Down Expand Up @@ -103,6 +105,10 @@ class LAStoolsAlgorithm(GeoAlgorithm):
"scale_scan_angle", "translate_scan_angle", "translate_gps_time", "set_classification", "set_user_data",
"set_point_source", "scale_rgb_up", "scale_rgb_down", "repair_zero_returns"]

IGNORE_CLASS1 = "IGNORE_CLASS1"
IGNORE_CLASS2 = "IGNORE_CLASS2"
IGNORE_CLASSES = ["---", "unclassified (1)", "ground (2)", "veg low (3)", "veg mid (4)", "veg high (5)", "buildings (6)", "noise (7)", "keypoint (8)", "water (9)"]

def getIcon(self):
filepath = os.path.dirname(__file__) + "/../../../images/tool.png"
return QtGui.QIcon(filepath)
Expand Down Expand Up @@ -139,7 +145,7 @@ def addParametersPointInputCommands(self, commands):
input = self.getParameterValue(LAStoolsAlgorithm.INPUT_LASLAZ)
if input is not None:
commands.append("-i")
commands.append(input)
commands.append('"' + input + '"')

def addParametersPointInputFolderGUI(self):
self.addParameter(ParameterFile(LAStoolsAlgorithm.INPUT_DIRECTORY, self.tr("input directory"), True, False))
Expand Down Expand Up @@ -232,7 +238,7 @@ def addParametersPointOutputCommands(self, commands):
output = self.getOutputValue(LAStoolsAlgorithm.OUTPUT_LASLAZ)
if output is not None:
commands.append("-o")
commands.append(output)
commands.append('"' + output + '"')

def addParametersPointOutputFormatGUI(self):
self.addParameter(ParameterSelection(LAStoolsAlgorithm.OUTPUT_POINT_FORMAT, self.tr("output format"), LAStoolsAlgorithm.OUTPUT_POINT_FORMATS, 0))
Expand Down Expand Up @@ -279,7 +285,7 @@ def addParametersOutputDirectoryCommands(self, commands):
commands.append(odir)

def addParametersOutputAppendixGUI(self):
self.addParameter(ParameterString(LAStoolsAlgorithm.OUTPUT_APPENDIX, self.tr("output appendix")))
self.addParameter(ParameterString(LAStoolsAlgorithm.OUTPUT_APPENDIX, self.tr("output appendix"), optional=True))

def addParametersOutputAppendixCommands(self, commands):
odix = self.getParameterValue(LAStoolsAlgorithm.OUTPUT_APPENDIX)
Expand All @@ -303,7 +309,7 @@ def addParametersTemporaryDirectoryAsInputFilesCommands(self, commands, files):
commands.append(idir + '\\' + files)

def addParametersAdditionalGUI(self):
self.addParameter(ParameterString(LAStoolsAlgorithm.ADDITIONAL_OPTIONS, self.tr("additional command line parameter(s)")), optional=True)
self.addParameter(ParameterString(LAStoolsAlgorithm.ADDITIONAL_OPTIONS, self.tr("additional command line parameter(s)"), optional=True))

def addParametersAdditionalCommands(self, commands):
additional_options = self.getParameterValue(LAStoolsAlgorithm.ADDITIONAL_OPTIONS).split()
Expand Down Expand Up @@ -413,3 +419,23 @@ def addParametersTransform2OtherCommands(self, commands):
commands.append("-" + LAStoolsAlgorithm.TRANSFORM_OTHERS[transform2])
if transform2 < 11 and transform2_arg is not None:
commands.append(transform2_arg)

def addParametersIgnoreClass1GUI(self):
self.addParameter(ParameterSelection(LAStoolsAlgorithm.IGNORE_CLASS1,
self.tr("ignore points with this classification"), LAStoolsAlgorithm.IGNORE_CLASSES, 0))

def addParametersIgnoreClass1Commands(self, commands):
ignore1 = self.getParameterValue(LAStoolsAlgorithm.IGNORE_CLASS1)
if ignore1 != 0:
commands.append("-ignore_class")
commands.append(unicode(ignore1))

def addParametersIgnoreClass2GUI(self):
self.addParameter(ParameterSelection(LAStoolsAlgorithm.IGNORE_CLASS2,
self.tr("also ignore points with this classification"), LAStoolsAlgorithm.IGNORE_CLASSES, 0))

def addParametersIgnoreClass2Commands(self, commands):
ignore2 = self.getParameterValue(LAStoolsAlgorithm.IGNORE_CLASS2)
if ignore2 != 0:
commands.append("-ignore_class")
commands.append(unicode(ignore2))
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
***************************************************************************
las2lasPro_filter.py
---------------------
Date : October 2014
Date : October 2014 and May 2016
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
Expand Down Expand Up @@ -41,7 +41,10 @@ def defineCharacteristics(self):
self.addParametersPointOutputGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las")]
if (LAStoolsUtils.hasWine()):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las.exe")]
else:
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersFilter1ReturnClassFlagsCommands(commands)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
***************************************************************************
las2lasPro_project.py
---------------------
Date : October 2014
Date : October 2014 and May 2016
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
Expand Down Expand Up @@ -70,7 +70,10 @@ def defineCharacteristics(self):
self.addParametersVerboseGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las")]
if (LAStoolsUtils.hasWine()):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las.exe")]
else:
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputFolderCommands(commands)
source_projection = self.getParameterValue(las2lasPro_project.SOURCE_PROJECTION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
***************************************************************************
las2lasPro_transform.py
---------------------
Date : October 2014
Date : October 2014 and May 2016
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
Expand Down Expand Up @@ -58,7 +58,10 @@ def defineCharacteristics(self):
self.addParametersVerboseGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las")]
if (LAStoolsUtils.hasWine()):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las.exe")]
else:
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputFolderCommands(commands)
self.addParametersTransform1CoordinateCommands(commands)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
***************************************************************************
las2las_filter.py
---------------------
Date : September 2013
Date : September 2013 and May 2016
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
Expand Down Expand Up @@ -43,7 +43,10 @@ def defineCharacteristics(self):
self.addParametersAdditionalGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las")]
if (LAStoolsUtils.hasWine()):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las.exe")]
else:
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersFilter1ReturnClassFlagsCommands(commands)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
***************************************************************************
las2las_project.py
---------------------
Date : September 2013
Date : September 2013 and May 2016
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
Expand Down Expand Up @@ -67,7 +67,10 @@ def defineCharacteristics(self):
self.addParametersAdditionalGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las")]
if (LAStoolsUtils.hasWine()):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las.exe")]
else:
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
source_projection = self.getParameterValue(las2las_project.SOURCE_PROJECTION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
***************************************************************************
las2las_transform.py
---------------------
Date : September 2013
Date : September 2013 and May 2016
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
Expand Down Expand Up @@ -54,7 +54,10 @@ def defineCharacteristics(self):
self.addParametersAdditionalGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las")]
if (LAStoolsUtils.hasWine()):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las.exe")]
else:
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2las")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
self.addParametersTransform1CoordinateCommands(commands)
Expand Down
7 changes: 5 additions & 2 deletions python/plugins/processing/algs/lidar/lastools/las2txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
***************************************************************************
las2txt.py
---------------------
Date : September 2013
Date : September 2013 and May 2016
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
Expand Down Expand Up @@ -47,7 +47,10 @@ def defineCharacteristics(self):
self.addParametersAdditionalGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2txt")]
if (LAStoolsUtils.hasWine()):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2txt.exe")]
else:
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2txt")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputCommands(commands)
parse = self.getParameterValue(las2txt.PARSE)
Expand Down
7 changes: 5 additions & 2 deletions python/plugins/processing/algs/lidar/lastools/las2txtPro.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
***************************************************************************
las2txtPro.py
---------------------
Date : October 2014
Date : October 2014 and May 2016
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
Expand Down Expand Up @@ -47,7 +47,10 @@ def defineCharacteristics(self):
self.addParametersVerboseGUI()

def processAlgorithm(self, progress):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2txt")]
if (LAStoolsUtils.hasWine()):
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2txt.exe")]
else:
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2txt")]
self.addParametersVerboseCommands(commands)
self.addParametersPointInputFolderCommands(commands)
parse = self.getParameterValue(las2txtPro.PARSE)
Expand Down
8 changes: 5 additions & 3 deletions python/plugins/processing/algs/lidar/lastools/lasboundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
Date : September 2013
Date : September 2013 and May 2016
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
Expand Down Expand Up @@ -39,7 +39,7 @@
class lasboundary(LAStoolsAlgorithm):

MODE = "MODE"
MODES = ["points", "spatial index (the *.lax file)", "bounding box"]
MODES = ["points", "spatial index (the *.lax file)", "bounding box", "tile bounding box"]
CONCAVITY = "CONCAVITY"
DISJOINT = "DISJOINT"
HOLES = "HOLES"
Expand Down Expand Up @@ -70,8 +70,10 @@ def processAlgorithm(self, progress):
if (mode != 0):
if (mode == 1):
commands.append("-use_lax")
else:
elif (mode == 2):
commands.append("-use_bb")
else:
commands.append("-use_tile_bb")
else:
concavity = self.getParameterValue(lasboundary.CONCAVITY)
commands.append("-concavity")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
***************************************************************************
lasboundaryPro.py
---------------------
Date : October 2014
Date : October 2014 and May 2016
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
***************************************************************************
Expand Down Expand Up @@ -35,7 +35,7 @@
class lasboundaryPro(LAStoolsAlgorithm):

MODE = "MODE"
MODES = ["points", "spatial index (the *.lax file)", "bounding box"]
MODES = ["points", "spatial index (the *.lax file)", "bounding box", "tile bounding box"]
CONCAVITY = "CONCAVITY"
DISJOINT = "DISJOINT"
HOLES = "HOLES"
Expand Down Expand Up @@ -69,8 +69,10 @@ def processAlgorithm(self, progress):
if (mode != 0):
if (mode == 1):
commands.append("-use_lax")
else:
elif (mode == 2):
commands.append("-use_bb")
else:
commands.append("-use_tile_bb")
else:
concavity = self.getParameterValue(lasboundaryPro.CONCAVITY)
commands.append("-concavity")
Expand Down
Loading

0 comments on commit d46f98d

Please sign in to comment.