Skip to content
Snippets Groups Projects
Commit 3b35015c authored by Maciej Wielgosz's avatar Maciej Wielgosz
Browse files

update in the density based filtering - relative paths update

parent 9688d309
No related branches found
No related tags found
No related merge requests found
...@@ -6,11 +6,8 @@ import glob ...@@ -6,11 +6,8 @@ import glob
import os import os
from pathlib import Path from pathlib import Path
# filter the density of the point cloud using pdal
# it does it only for a single file
class DensityFiltering: class DensityFiltering:
def __init__(self, path_data, min_density, count_threshold, buffer_size, verbose=False): def __init__(self, path_data, min_density=1, count_threshold=15000, buffer_size=0.01, verbose=False):
self.path_data = Path(path_data) self.path_data = Path(path_data)
# remove the extension # remove the extension
self.path_data_out = os.path.join(os.path.dirname(path_data), os.path.basename(path_data).split('.')[0]) self.path_data_out = os.path.join(os.path.dirname(path_data), os.path.basename(path_data).split('.')[0])
......
...@@ -23,8 +23,8 @@ class DensityFilteringInFolders: ...@@ -23,8 +23,8 @@ class DensityFilteringInFolders:
# copy files from os.path.join(self.path_data_out, "_clipped.las") to the input folder and rename them as the original file # copy files from os.path.join(self.path_data_out, "_clipped.las") to the input folder and rename them as the original file
if result is not None: if result is not None:
shutil.move( shutil.move(
os.path.join(self.input_folder, os.path.basename(density_filtering.path_data_out), "_clipped.las"), os.path.join(density_filtering.path_data_out, "_clipped.las"),
os.path.join(self.input_folder, file)) os.path.join(file))
if __name__ == "__main__": if __name__ == "__main__":
...@@ -49,7 +49,7 @@ if __name__ == "__main__": ...@@ -49,7 +49,7 @@ if __name__ == "__main__":
density_filtering_in_folders.filter_density_in_folder() density_filtering_in_folders.filter_density_in_folder()
# a simple way to test the code # a simple way to test the code
# python density_filtering_in_folders.py --input_folder /home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/check_maciek/ --min_density 1 --count_threshold 15000 --buffer_size 0.01 --verbose # python nibio_preprocessing/density_filtering_in_folders.py --input_folder /home/nibio/mutable-outside-world/code/gitlab_fsct/instance_segmentation_classic/check_maciek/ --min_density 1 --count_threshold 15000 --buffer_size 0.01 --verbose
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
############################ parameters ################################################# ############################ parameters #################################################
# General parameters # General parameters
CLEAR_INPUT_FOLDER=1 # 1: clear input folder, 0: not clear input folder CLEAR_INPUT_FOLDER=1 # 1: clear input folder, 0: not clear input folder
CONDA_ENV="pdal-env" # conda environment for running the pipeline CONDA_ENV="pdal-env-1" # conda environment for running the pipeline
# Parameters for the semetnic segmentation # Parameters for the semetnic segmentation
data_folder="" # path to the folder containing the data data_folder="" # path to the folder containing the data
...@@ -104,8 +104,8 @@ fi ...@@ -104,8 +104,8 @@ fi
# do the conversion from laz to las if there are laz files in place (this is need for metrics calculation) # do the conversion from laz to las if there are laz files in place (this is need for metrics calculation)
python nibio_preprocessing/convert_files_in_folder.py --input_folder $data_folder --output_folder $data_folder --out_file_type las --in_place --verbose python nibio_preprocessing/convert_files_in_folder.py --input_folder $data_folder --output_folder $data_folder --out_file_type las --in_place --verbose
# do the conversion to ply # do the density filtering
python nibio_preprocessing/convert_files_in_folder.py --input_folder $data_folder --output_folder $data_folder --out_file_type ply --verbose python nibio_preprocessing/density_filtering_in_folders.py --input_folder $data_folder --min_density 1 --count_threshold 15000 --buffer_size 0.01
# clear input folder if CLEAR_INPUT_FOLDER is set to 1 # clear input folder if CLEAR_INPUT_FOLDER is set to 1
if [ $CLEAR_INPUT_FOLDER -eq 1 ] if [ $CLEAR_INPUT_FOLDER -eq 1 ]
...@@ -117,6 +117,10 @@ then ...@@ -117,6 +117,10 @@ then
echo "Removed all the files and folders except the ply and las files in the input folder" echo "Removed all the files and folders except the ply and las files in the input folder"
fi fi
# do the conversion to ply
python nibio_preprocessing/convert_files_in_folder.py --input_folder $data_folder --output_folder $data_folder --out_file_type ply --verbose
# move the output of the first step to the input folder of the second step # move the output of the first step to the input folder of the second step
mkdir -p $data_folder/segmented_point_clouds mkdir -p $data_folder/segmented_point_clouds
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment