diff --git a/opendm/context.py b/opendm/context.py index bb1927c7..ffadd67e 100644 --- a/opendm/context.py +++ b/opendm/context.py @@ -24,7 +24,7 @@ opensfm_path = os.path.join(superbuild_path, "src/opensfm") poisson_recon_path = os.path.join(superbuild_bin_path, 'PoissonRecon') dem2mesh_path = os.path.join(superbuild_bin_path, 'dem2mesh') -dem2points_path = os.path.join(superbuild_path, 'dem2points') +dem2points_path = os.path.join(superbuild_bin_path, 'dem2points') # define mvstex path mvstex_path = os.path.join(superbuild_bin_path, "texrecon") diff --git a/opendm/entwine.py b/opendm/entwine.py index 644046d2..0585d24d 100644 --- a/opendm/entwine.py +++ b/opendm/entwine.py @@ -47,18 +47,10 @@ def build_entwine(input_point_cloud_files, tmpdir, output_path, max_concurrency= 'outputdir': output_path } - # Run scan to compute dataset bounds - system.run('entwine scan --threads {threads} --tmp "{tmpdir}" {all_inputs} -o "{outputdir}"'.format(**kwargs)) - scan_json = os.path.join(output_path, "scan.json") - - if os.path.exists(scan_json): - kwargs['input'] = scan_json - for _ in range(len(input_point_cloud_files)): - # One at a time - system.run('entwine build --threads {threads} --tmp "{tmpdir}" -i "{input}" -o "{outputdir}" --run 1'.format(**kwargs)) - else: - log.ODM_WARNING("%s does not exist, no point cloud will be built." % scan_json) - + # for _ in range(len(input_point_cloud_files)): + # # One at a time + # system.run('entwine build --threads {threads} --tmp "{tmpdir}" -i "{input}" -o "{outputdir}"'.format(**kwargs)) + system.run('entwine build --threads {threads} --tmp "{tmpdir}" {all_inputs} -o "{outputdir}"'.format(**kwargs)) def build_untwine(input_point_cloud_files, tmpdir, output_path, max_concurrency=8, rerun=False): kwargs = { diff --git a/opendm/point_cloud.py b/opendm/point_cloud.py index 25a832b6..617d49bf 100644 --- a/opendm/point_cloud.py +++ b/opendm/point_cloud.py @@ -317,29 +317,35 @@ def merge_ply(input_point_cloud_files, output_file, dims=None): system.run(' '.join(cmd)) -def post_point_cloud_steps(args, tree): +def post_point_cloud_steps(args, tree, rerun=False): # XYZ point cloud output if args.pc_csv: log.ODM_INFO("Creating CSV file (XYZ format)") - system.run("pdal translate -i \"{}\" " - "-o \"{}\" " - "--writers.text.format=csv " - "--writers.text.order=\"X,Y,Z\" " - "--writers.text.keep_unspecified=false ".format( - tree.odm_georeferencing_model_laz, - tree.odm_georeferencing_xyz_file)) + if not io.file_exists(tree.odm_georeferencing_xyz_file) or rerun: + system.run("pdal translate -i \"{}\" " + "-o \"{}\" " + "--writers.text.format=csv " + "--writers.text.order=\"X,Y,Z\" " + "--writers.text.keep_unspecified=false ".format( + tree.odm_georeferencing_model_laz, + tree.odm_georeferencing_xyz_file)) + else: + log.ODM_WARNING("Found existing CSV file %s" % tree.odm_georeferencing_xyz_file) # LAS point cloud output if args.pc_las: log.ODM_INFO("Creating LAS file") - system.run("pdal translate -i \"{}\" " - "-o \"{}\" ".format( - tree.odm_georeferencing_model_laz, - tree.odm_georeferencing_model_las)) + if not io.file_exists(tree.odm_georeferencing_model_las) or rerun: + system.run("pdal translate -i \"{}\" " + "-o \"{}\" ".format( + tree.odm_georeferencing_model_laz, + tree.odm_georeferencing_model_las)) + else: + log.ODM_WARNING("Found existing LAS file %s" % tree.odm_georeferencing_xyz_file) # EPT point cloud output if args.pc_ept: log.ODM_INFO("Creating Entwine Point Tile output") - entwine.build([tree.odm_georeferencing_model_laz], tree.entwine_pointcloud, max_concurrency=args.max_concurrency, rerun=False) + entwine.build([tree.odm_georeferencing_model_laz], tree.entwine_pointcloud, max_concurrency=args.max_concurrency, rerun=rerun) diff --git a/stages/odm_georeferencing.py b/stages/odm_georeferencing.py index d83b8c7c..99888b82 100644 --- a/stages/odm_georeferencing.py +++ b/stages/odm_georeferencing.py @@ -64,7 +64,7 @@ class ODMGeoreferencingStage(types.ODM_Stage): log.ODM_INFO("Converting point cloud (non-georeferenced)") system.run(cmd + ' ' + ' '.join(stages) + ' ' + ' '.join(params)) - point_cloud.post_point_cloud_steps(args, tree) + point_cloud.post_point_cloud_steps(args, tree, self.rerun()) else: log.ODM_WARNING('Found a valid georeferenced model in: %s' % tree.odm_georeferencing_model_laz) diff --git a/stages/splitmerge.py b/stages/splitmerge.py index b9592da6..0e243a39 100644 --- a/stages/splitmerge.py +++ b/stages/splitmerge.py @@ -252,7 +252,7 @@ class ODMMergeStage(types.ODM_Stage): try: point_cloud.merge(all_point_clouds, tree.odm_georeferencing_model_laz, rerun=self.rerun()) - point_cloud.post_point_cloud_steps(args, tree) + point_cloud.post_point_cloud_steps(args, tree, self.rerun()) except Exception as e: log.ODM_WARNING("Could not merge point cloud: %s (skipping)" % str(e)) else: