cars 1.0.0a2__cp312-cp312-win_amd64.whl → 1.0.0a4__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cars might be problematic. Click here for more details.

Files changed (144) hide show
  1. cars/__init__.py +3 -3
  2. cars/applications/__init__.py +0 -3
  3. cars/applications/application.py +14 -6
  4. cars/applications/application_template.py +42 -0
  5. cars/applications/auxiliary_filling/abstract_auxiliary_filling_app.py +12 -2
  6. cars/applications/auxiliary_filling/auxiliary_filling_algo.py +2 -2
  7. cars/applications/auxiliary_filling/auxiliary_filling_from_sensors_app.py +95 -46
  8. cars/applications/auxiliary_filling/auxiliary_filling_wrappers.py +7 -6
  9. cars/applications/dem_generation/abstract_dem_generation_app.py +9 -5
  10. cars/applications/dem_generation/dem_generation_algo.py +1 -1
  11. cars/applications/dem_generation/dem_generation_wrappers.py +44 -59
  12. cars/applications/dem_generation/dichotomic_generation_app.py +9 -6
  13. cars/applications/dem_generation/rasterization_app.py +112 -43
  14. cars/applications/dense_match_filling/__init__.py +1 -1
  15. cars/applications/dense_match_filling/abstract_dense_match_filling_app.py +2 -15
  16. cars/applications/dense_match_filling/fill_disp_algo.py +32 -373
  17. cars/applications/dense_match_filling/fill_disp_wrappers.py +0 -343
  18. cars/applications/dense_match_filling/zero_padding_app.py +10 -5
  19. cars/applications/dense_matching/abstract_dense_matching_app.py +2 -1
  20. cars/applications/dense_matching/census_mccnn_sgm_app.py +48 -60
  21. cars/applications/dense_matching/cpp/dense_matching_cpp.cp312-win_amd64.dll.a +0 -0
  22. cars/applications/dense_matching/cpp/dense_matching_cpp.cp312-win_amd64.pyd +0 -0
  23. cars/applications/dense_matching/dense_matching_algo.py +48 -14
  24. cars/applications/dense_matching/dense_matching_wrappers.py +11 -3
  25. cars/applications/dense_matching/disparity_grid_algo.py +95 -79
  26. cars/applications/dense_matching/loaders/config_mapping.json +13 -0
  27. cars/applications/dense_matching/loaders/global_land_cover_map.tif +0 -0
  28. cars/applications/dense_matching/loaders/pandora_loader.py +169 -34
  29. cars/applications/dsm_filling/border_interpolation_app.py +11 -12
  30. cars/applications/dsm_filling/bulldozer_filling_app.py +16 -15
  31. cars/applications/dsm_filling/exogenous_filling_app.py +14 -14
  32. cars/applications/grid_generation/abstract_grid_generation_app.py +1 -1
  33. cars/applications/grid_generation/epipolar_grid_generation_app.py +4 -2
  34. cars/applications/grid_generation/grid_correction_app.py +4 -1
  35. cars/applications/grid_generation/grid_generation_algo.py +7 -2
  36. cars/applications/ground_truth_reprojection/abstract_ground_truth_reprojection_app.py +1 -1
  37. cars/applications/ground_truth_reprojection/direct_localization_app.py +2 -2
  38. cars/applications/ground_truth_reprojection/ground_truth_reprojection_algo.py +2 -1
  39. cars/applications/point_cloud_fusion/abstract_pc_fusion_app.py +0 -155
  40. cars/applications/point_cloud_fusion/mapping_to_terrain_tiles_app.py +0 -658
  41. cars/applications/point_cloud_fusion/pc_fusion_algo.py +0 -1339
  42. cars/applications/point_cloud_fusion/pc_fusion_wrappers.py +0 -869
  43. cars/applications/point_cloud_outlier_removal/abstract_outlier_removal_app.py +11 -6
  44. cars/applications/point_cloud_outlier_removal/outlier_removal_algo.py +9 -8
  45. cars/applications/point_cloud_outlier_removal/small_components_app.py +101 -270
  46. cars/applications/point_cloud_outlier_removal/statistical_app.py +120 -277
  47. cars/applications/rasterization/abstract_pc_rasterization_app.py +2 -1
  48. cars/applications/rasterization/rasterization_algo.py +18 -6
  49. cars/applications/rasterization/rasterization_wrappers.py +2 -1
  50. cars/applications/rasterization/simple_gaussian_app.py +88 -116
  51. cars/applications/resampling/abstract_resampling_app.py +1 -1
  52. cars/applications/resampling/bicubic_resampling_app.py +3 -1
  53. cars/applications/resampling/resampling_algo.py +60 -53
  54. cars/applications/resampling/resampling_wrappers.py +3 -1
  55. cars/applications/sparse_matching/abstract_sparse_matching_app.py +1 -1
  56. cars/applications/sparse_matching/sift_app.py +5 -25
  57. cars/applications/sparse_matching/sparse_matching_algo.py +3 -2
  58. cars/applications/sparse_matching/sparse_matching_wrappers.py +1 -1
  59. cars/applications/triangulation/abstract_triangulation_app.py +1 -1
  60. cars/applications/triangulation/line_of_sight_intersection_app.py +13 -11
  61. cars/applications/triangulation/pc_transform.py +552 -0
  62. cars/applications/triangulation/triangulation_algo.py +6 -4
  63. cars/applications/triangulation/triangulation_wrappers.py +1 -0
  64. cars/bundleadjustment.py +6 -6
  65. cars/cars.py +11 -9
  66. cars/core/cars_logging.py +80 -49
  67. cars/core/constants.py +0 -1
  68. cars/core/datasets.py +5 -2
  69. cars/core/geometry/abstract_geometry.py +364 -22
  70. cars/core/geometry/shareloc_geometry.py +112 -82
  71. cars/core/inputs.py +72 -19
  72. cars/core/outputs.py +1 -1
  73. cars/core/preprocessing.py +17 -3
  74. cars/core/projection.py +126 -6
  75. cars/core/tiling.py +10 -3
  76. cars/data_structures/cars_dataset.py +12 -10
  77. cars/data_structures/corresponding_tiles_tools.py +0 -103
  78. cars/data_structures/format_transformation.py +4 -1
  79. cars/devibrate.py +6 -3
  80. cars/extractroi.py +20 -21
  81. cars/orchestrator/cluster/abstract_cluster.py +15 -5
  82. cars/orchestrator/cluster/abstract_dask_cluster.py +6 -2
  83. cars/orchestrator/cluster/dask_jobqueue_utils.py +1 -1
  84. cars/orchestrator/cluster/log_wrapper.py +149 -22
  85. cars/orchestrator/cluster/mp_cluster/multiprocessing_cluster.py +12 -4
  86. cars/orchestrator/cluster/mp_cluster/multiprocessing_profiler.py +2 -2
  87. cars/orchestrator/cluster/pbs_dask_cluster.py +1 -1
  88. cars/orchestrator/cluster/sequential_cluster.py +5 -4
  89. cars/orchestrator/cluster/slurm_dask_cluster.py +1 -1
  90. cars/orchestrator/orchestrator.py +15 -4
  91. cars/orchestrator/registry/id_generator.py +1 -0
  92. cars/orchestrator/registry/saver_registry.py +2 -2
  93. cars/pipelines/conf_resolution/conf_final_resolution.json +5 -3
  94. cars/pipelines/default/default_pipeline.py +461 -1052
  95. cars/pipelines/parameters/advanced_parameters.py +91 -64
  96. cars/pipelines/parameters/advanced_parameters_constants.py +6 -5
  97. cars/pipelines/parameters/application_parameters.py +71 -0
  98. cars/pipelines/parameters/depth_map_inputs.py +0 -314
  99. cars/pipelines/parameters/dsm_inputs.py +40 -4
  100. cars/pipelines/parameters/output_parameters.py +44 -8
  101. cars/pipelines/parameters/sensor_inputs.py +122 -73
  102. cars/pipelines/parameters/sensor_inputs_constants.py +0 -2
  103. cars/pipelines/parameters/sensor_loaders/__init__.py +4 -3
  104. cars/pipelines/parameters/sensor_loaders/basic_classif_loader.py +106 -0
  105. cars/pipelines/parameters/sensor_loaders/{basic_sensor_loader.py → basic_image_loader.py} +16 -22
  106. cars/pipelines/parameters/sensor_loaders/pivot_classif_loader.py +121 -0
  107. cars/pipelines/parameters/sensor_loaders/{pivot_sensor_loader.py → pivot_image_loader.py} +10 -21
  108. cars/pipelines/parameters/sensor_loaders/sensor_loader.py +4 -6
  109. cars/pipelines/parameters/sensor_loaders/sensor_loader_template.py +1 -3
  110. cars/pipelines/pipeline_template.py +1 -3
  111. cars/pipelines/unit/unit_pipeline.py +676 -1070
  112. cars/starter.py +4 -3
  113. cars-1.0.0a4.dist-info/DELVEWHEEL +2 -0
  114. {cars-1.0.0a2.dist-info → cars-1.0.0a4.dist-info}/METADATA +135 -53
  115. {cars-1.0.0a2.dist-info → cars-1.0.0a4.dist-info}/RECORD +120 -134
  116. cars.libs/libgcc_s_seh-1-b2494fcbd4d80cf2c98fdd5261f6d850.dll +0 -0
  117. cars.libs/libstdc++-6-e9b0d12ae0e9555bbae55e8dfd08c3f7.dll +0 -0
  118. cars.libs/libwinpthread-1-7882d1b093714ccdfaf4e0789a817792.dll +0 -0
  119. cars/applications/dense_match_filling/cpp/__init__.py +0 -0
  120. cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp312-win_amd64.dll.a +0 -0
  121. cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp312-win_amd64.pyd +0 -0
  122. cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.py +0 -72
  123. cars/applications/dense_match_filling/cpp/includes/dense_match_filling.hpp +0 -46
  124. cars/applications/dense_match_filling/cpp/meson.build +0 -9
  125. cars/applications/dense_match_filling/cpp/src/bindings.cpp +0 -11
  126. cars/applications/dense_match_filling/cpp/src/dense_match_filling.cpp +0 -142
  127. cars/applications/dense_match_filling/plane_app.py +0 -556
  128. cars/applications/hole_detection/__init__.py +0 -30
  129. cars/applications/hole_detection/abstract_hole_detection_app.py +0 -125
  130. cars/applications/hole_detection/cloud_to_bbox_app.py +0 -346
  131. cars/applications/hole_detection/hole_detection_algo.py +0 -144
  132. cars/applications/hole_detection/hole_detection_wrappers.py +0 -53
  133. cars/applications/point_cloud_denoising/__init__.py +0 -29
  134. cars/applications/point_cloud_denoising/abstract_pc_denoising_app.py +0 -273
  135. cars/applications/point_cloud_fusion/__init__.py +0 -30
  136. cars/applications/point_cloud_fusion/cloud_fusion_constants.py +0 -39
  137. cars/applications/sparse_matching/pandora_sparse_matching_app.py +0 -0
  138. cars/pipelines/parameters/depth_map_inputs_constants.py +0 -25
  139. cars-1.0.0a2.dist-info/DELVEWHEEL +0 -2
  140. cars.libs/libgcc_s_seh-1-f2b6825d483bdf14050493af93b5997d.dll +0 -0
  141. cars.libs/libstdc++-6-6b0059df6bc601df5a0f18a5805eea05.dll +0 -0
  142. cars.libs/libwinpthread-1-e01b8e85fd67c2b861f64d4ccc7df607.dll +0 -0
  143. {cars-1.0.0a2.dist-info → cars-1.0.0a4.dist-info}/WHEEL +0 -0
  144. {cars-1.0.0a2.dist-info → cars-1.0.0a4.dist-info}/entry_points.txt +0 -0
@@ -31,7 +31,7 @@ import numpy as np
31
31
 
32
32
  from cars.applications import application_constants
33
33
  from cars.applications.application import Application
34
- from cars.applications.application_template import ApplicationTemplate
34
+ from cars.applications.application_template import ScalingApplicationTemplate
35
35
  from cars.applications.point_cloud_outlier_removal import (
36
36
  outlier_removal_constants as pr_cst,
37
37
  )
@@ -41,7 +41,7 @@ from cars.data_structures import cars_dataset
41
41
 
42
42
 
43
43
  @Application.register("point_cloud_outlier_removal")
44
- class PointCloudOutlierRemoval(ApplicationTemplate, metaclass=ABCMeta):
44
+ class PointCloudOutlierRemoval(ScalingApplicationTemplate, metaclass=ABCMeta):
45
45
  """
46
46
  PointCloudOutlierRemoval
47
47
  """
@@ -49,12 +49,14 @@ class PointCloudOutlierRemoval(ApplicationTemplate, metaclass=ABCMeta):
49
49
  available_applications: Dict = {}
50
50
  default_application = "statistical"
51
51
 
52
- def __new__(cls, conf=None): # pylint: disable=W0613
52
+ def __new__(cls, scaling_coeff, conf=None): # pylint: disable=W0613
53
53
  """
54
54
  Return the required application
55
55
  :raises:
56
56
  - KeyError when the required application is not registered
57
57
 
58
+ :param scaling_coeff: scaling factor for resolution
59
+ :type scaling_coeff: float
58
60
  :param conf: configuration for points removal
59
61
  :return: a application_to_use object
60
62
  """
@@ -95,15 +97,17 @@ class PointCloudOutlierRemoval(ApplicationTemplate, metaclass=ABCMeta):
95
97
  cls.orchestrator = None
96
98
  cls.available_applications[short_name] = cls
97
99
 
98
- def __init__(self, conf=None):
100
+ def __init__(self, scaling_coeff, conf=None):
99
101
  """
100
102
  Init function of PointCloudOutlierRemoval
101
103
 
104
+ :param scaling_coeff: scaling factor for resolution
105
+ :type scaling_coeff: float
102
106
  :param conf: configuration
103
107
  :return: an application_to_use object
104
108
  """
105
109
 
106
- super().__init__(conf=conf)
110
+ super().__init__(scaling_coeff, conf=conf)
107
111
 
108
112
  @abstractmethod
109
113
  def get_on_ground_margin(self, resolution=0.5):
@@ -156,6 +160,7 @@ class PointCloudOutlierRemoval(ApplicationTemplate, metaclass=ABCMeta):
156
160
 
157
161
  """
158
162
 
163
+ # pylint: disable=too-many-positional-arguments
159
164
  def __register_epipolar_dataset__(
160
165
  self,
161
166
  epipolar_point_cloud,
@@ -346,7 +351,7 @@ class PointCloudOutlierRemoval(ApplicationTemplate, metaclass=ABCMeta):
346
351
  )
347
352
 
348
353
  @abstractmethod
349
- def run(
354
+ def run( # pylint: disable=too-many-positional-arguments
350
355
  self,
351
356
  merged_point_cloud,
352
357
  orchestrator=None,
@@ -31,7 +31,7 @@ import outlier_filter # pylint:disable=E0401
31
31
  import pandas
32
32
  from scipy.spatial import cKDTree # pylint: disable=no-name-in-module
33
33
 
34
- from cars.applications.point_cloud_fusion.pc_fusion_wrappers import filter_cloud
34
+ from cars.applications.triangulation import pc_transform
35
35
 
36
36
  # CARS imports
37
37
  from cars.core import constants as cst
@@ -82,7 +82,9 @@ def small_component_filtering(
82
82
  clusters_distance_threshold=clusters_distance_threshold_float,
83
83
  )
84
84
 
85
- return filter_cloud(cloud, index_elt_to_remove, filtered_elt_pos)
85
+ return pc_transform.filter_cloud(
86
+ cloud, index_elt_to_remove, filtered_elt_pos
87
+ )
86
88
 
87
89
 
88
90
  def detect_small_components(
@@ -188,6 +190,7 @@ def detect_small_components(
188
190
  # ##### statistical filtering ######
189
191
 
190
192
 
193
+ # pylint: disable=too-many-positional-arguments
191
194
  def statistical_outlier_filtering(
192
195
  cloud: pandas.DataFrame,
193
196
  k: int,
@@ -228,7 +231,9 @@ def statistical_outlier_filtering(
228
231
  use_median=use_median,
229
232
  )
230
233
 
231
- return filter_cloud(cloud, index_elt_to_remove, filtered_elt_pos)
234
+ return pc_transform.filter_cloud(
235
+ cloud, index_elt_to_remove, filtered_elt_pos
236
+ )
232
237
 
233
238
 
234
239
  def detect_statistical_outliers(
@@ -339,9 +344,9 @@ def epipolar_small_components(
339
344
  return cloud
340
345
 
341
346
 
347
+ # pylint: disable=too-many-positional-arguments
342
348
  def epipolar_statistical_filtering(
343
349
  epipolar_ds,
344
- epsg,
345
350
  k=15,
346
351
  filtering_constant=0.0,
347
352
  mean_factor=1.0,
@@ -354,8 +359,6 @@ def epipolar_statistical_filtering(
354
359
 
355
360
  :param epipolar_ds: epipolar dataset to filter
356
361
  :type epipolar_ds: xr.Dataset
357
- :param epsg: epsg code of the CRS used to compute distances
358
- :type epsg: int
359
362
  :param statistical_k: k
360
363
  :type statistical_k: int
361
364
  :param std_dev_factor: std factor
@@ -370,8 +373,6 @@ def epipolar_statistical_filtering(
370
373
 
371
374
  """
372
375
 
373
- projection.point_cloud_conversion_dataset(epipolar_ds, epsg)
374
-
375
376
  if not np.all(np.isnan(epipolar_ds[cst.Z])):
376
377
 
377
378
  outlier_filter.epipolar_statistical_outlier_filtering(
@@ -27,9 +27,7 @@ import copy
27
27
 
28
28
  # Standard imports
29
29
  import logging
30
- import math
31
30
  import os
32
- import time
33
31
 
34
32
  # Third party imports
35
33
  import numpy as np
@@ -39,14 +37,13 @@ from pyproj import CRS
39
37
  # CARS imports
40
38
  import cars.orchestrator.orchestrator as ocht
41
39
  from cars.applications import application_constants
42
- from cars.applications.point_cloud_fusion import (
43
- pc_fusion_algo,
44
- pc_fusion_wrappers,
45
- )
46
40
  from cars.applications.point_cloud_outlier_removal import (
47
41
  abstract_outlier_removal_app as pc_removal,
48
42
  )
49
- from cars.applications.point_cloud_outlier_removal import outlier_removal_algo
43
+ from cars.applications.point_cloud_outlier_removal import (
44
+ outlier_removal_algo,
45
+ )
46
+ from cars.applications.triangulation import pc_transform
50
47
  from cars.applications.triangulation.triangulation_wrappers import (
51
48
  generate_point_cloud_file_names,
52
49
  )
@@ -64,20 +61,21 @@ class SmallComponents(
64
61
 
65
62
  # pylint: disable=too-many-instance-attributes
66
63
 
67
- def __init__(self, conf=None):
64
+ def __init__(self, scaling_coeff, conf=None):
68
65
  """
69
66
  Init function of SmallComponents
70
67
 
68
+ :param scaling_coeff: scaling factor for resolution
69
+ :type scaling_coeff: float
71
70
  :param conf: configuration for points outlier removal
72
71
  :return: an application_to_use object
73
72
  """
74
73
 
75
- super().__init__(conf=conf)
74
+ super().__init__(scaling_coeff, conf=conf)
76
75
 
77
76
  self.used_method = self.used_config["method"]
78
77
 
79
78
  # small components
80
- self.activated = self.used_config["activated"]
81
79
  self.on_ground_margin = self.used_config["on_ground_margin"]
82
80
  self.connection_distance = self.used_config["connection_distance"]
83
81
  self.nb_points_threshold = self.used_config["nb_points_threshold"]
@@ -119,10 +117,6 @@ class SmallComponents(
119
117
  overloaded_conf["save_by_pair"] = conf.get("save_by_pair", False)
120
118
 
121
119
  # small components
122
- overloaded_conf["activated"] = conf.get(
123
- "activated", True
124
- ) # if false, the following
125
- # parameters are unused
126
120
  # on_ground_margin:
127
121
  # margin added to the on ground region to not filter
128
122
  # points clusters
@@ -131,7 +125,7 @@ class SmallComponents(
131
125
  # pts_connection_dist:
132
126
  # distance to use to consider that two points are connected
133
127
  overloaded_conf["connection_distance"] = conf.get(
134
- "connection_distance", 3.0
128
+ "connection_distance", self.scaling_coeff * 3.0
135
129
  )
136
130
  # nb_pts_threshold:
137
131
  # points clusters that have less than this number of points
@@ -159,7 +153,6 @@ class SmallComponents(
159
153
  point_cloud_fusion_schema = {
160
154
  "method": str,
161
155
  "save_by_pair": bool,
162
- "activated": bool,
163
156
  "on_ground_margin": int,
164
157
  "connection_distance": And(float, lambda x: x > 0),
165
158
  "nb_points_threshold": And(int, lambda x: x > 0),
@@ -194,18 +187,12 @@ class SmallComponents(
194
187
  :rtype: float
195
188
 
196
189
  """
190
+ tot = 10000 * superposing_point_clouds / point_cloud_resolution
197
191
 
198
- if not self.activated:
199
- # if not activated, this tile size must not be taken into acount
200
- # during the min(*tile_sizes) operations
201
- tile_size = math.inf
202
- else:
203
- tot = 10000 * superposing_point_clouds / point_cloud_resolution
204
-
205
- import_ = 200 # MiB
206
- tile_size = int(
207
- np.sqrt(float(((max_ram_per_worker - import_) * 2**23)) / tot)
208
- )
192
+ import_ = 200 # MiB
193
+ tile_size = int(
194
+ np.sqrt(float(((max_ram_per_worker - import_) * 2**23)) / tot)
195
+ )
209
196
 
210
197
  logging.info(
211
198
  "Estimated optimal tile size for small"
@@ -232,11 +219,7 @@ class SmallComponents(
232
219
  :return: margin
233
220
  :rtype: int
234
221
  """
235
-
236
- margin = 0
237
-
238
- if self.activated:
239
- margin = self.half_epipolar_size
222
+ margin = self.half_epipolar_size
240
223
 
241
224
  return margin
242
225
 
@@ -248,15 +231,11 @@ class SmallComponents(
248
231
  :rtype: float
249
232
 
250
233
  """
251
-
252
- on_ground_margin = 0
253
-
254
- if self.activated:
255
- on_ground_margin = self.on_ground_margin * resolution
234
+ on_ground_margin = self.on_ground_margin * resolution
256
235
 
257
236
  return on_ground_margin
258
237
 
259
- def run(
238
+ def run( # pylint: disable=too-many-positional-arguments
260
239
  self,
261
240
  merged_point_cloud,
262
241
  orchestrator=None,
@@ -310,10 +289,6 @@ class SmallComponents(
310
289
 
311
290
  :rtype: CarsDataset filled with xr.Dataset
312
291
  """
313
-
314
- if not self.activated:
315
- return merged_point_cloud
316
-
317
292
  # Default orchestrator
318
293
  if orchestrator is None:
319
294
  # Create default sequential orchestrator for current application
@@ -325,244 +300,99 @@ class SmallComponents(
325
300
  else:
326
301
  self.orchestrator = orchestrator
327
302
 
328
- if merged_point_cloud.dataset_type == "points":
329
- (
330
- filtered_point_cloud,
331
- point_cloud_laz_file_name,
332
- point_cloud_csv_file_name,
333
- saving_info,
334
- ) = self.__register_pc_dataset__(
335
- merged_point_cloud,
336
- point_cloud_dir,
337
- dump_dir,
338
- app_name="small_components",
339
- )
340
- # Generate rasters
341
- for col in range(filtered_point_cloud.shape[1]):
342
- for row in range(filtered_point_cloud.shape[0]):
343
- # update saving infos for potential replacement
344
- full_saving_info = ocht.update_saving_infos(
345
- saving_info, row=row, col=col
346
- )
347
- if merged_point_cloud.tiles[row][col] is not None:
348
- # Delayed call to cloud filtering
349
- filtered_point_cloud[
350
- row, col
351
- ] = self.orchestrator.cluster.create_task(
352
- small_component_removal_wrapper
353
- )(
354
- merged_point_cloud[row, col],
355
- self.connection_distance,
356
- self.nb_points_threshold,
357
- self.clusters_distance_threshold,
358
- save_by_pair=(self.save_by_pair),
359
- point_cloud_csv_file_name=point_cloud_csv_file_name,
360
- point_cloud_laz_file_name=point_cloud_laz_file_name,
361
- saving_info=full_saving_info,
362
- )
303
+ if dump_dir is None:
304
+ dump_dir = self.generate_unknown_dump_dir(self.orchestrator)
363
305
 
364
- elif merged_point_cloud.dataset_type == "arrays":
365
- prefix = os.path.basename(dump_dir)
366
- # Save as depth map
367
- filtered_point_cloud, saving_info_epipolar = (
368
- self.__register_epipolar_dataset__(
369
- merged_point_cloud,
370
- depth_map_dir,
371
- dump_dir,
372
- app_name="small_components",
373
- pair_key=prefix,
374
- )
306
+ if merged_point_cloud.dataset_type != "arrays":
307
+ raise RuntimeError(
308
+ "Only arrays is supported in small components removal"
375
309
  )
376
-
377
- # Save as point cloud
378
- (
379
- flatten_filtered_point_cloud,
380
- laz_pc_dir_name,
381
- csv_pc_dir_name,
382
- saving_info_flatten,
383
- ) = self.__register_pc_dataset__(
310
+ prefix = os.path.basename(dump_dir)
311
+ # Save as depth map
312
+ filtered_point_cloud, saving_info_epipolar = (
313
+ self.__register_epipolar_dataset__(
384
314
  merged_point_cloud,
385
- point_cloud_dir,
315
+ depth_map_dir,
386
316
  dump_dir,
387
317
  app_name="small_components",
318
+ pair_key=prefix,
388
319
  )
320
+ )
389
321
 
390
- # initialize empty index file for point cloud product if official
391
- # product is requested
392
- pc_index = None
393
- if point_cloud_dir:
394
- pc_index = {}
322
+ # Save as point cloud
323
+ (
324
+ flatten_filtered_point_cloud,
325
+ laz_pc_dir_name,
326
+ csv_pc_dir_name,
327
+ saving_info_flatten,
328
+ ) = self.__register_pc_dataset__(
329
+ merged_point_cloud,
330
+ point_cloud_dir,
331
+ dump_dir,
332
+ app_name="small_components",
333
+ )
334
+
335
+ # initialize empty index file for point cloud product if official
336
+ # product is requested
337
+ pc_index = None
338
+ if point_cloud_dir:
339
+ pc_index = {}
395
340
 
396
- # Generate rasters
397
- for col in range(filtered_point_cloud.shape[1]):
398
- for row in range(filtered_point_cloud.shape[0]):
341
+ # Generate rasters
342
+ for col in range(filtered_point_cloud.shape[1]):
343
+ for row in range(filtered_point_cloud.shape[0]):
399
344
 
400
- # update saving infos for potential replacement
401
- full_saving_info_epipolar = ocht.update_saving_infos(
402
- saving_info_epipolar, row=row, col=col
345
+ # update saving infos for potential replacement
346
+ full_saving_info_epipolar = ocht.update_saving_infos(
347
+ saving_info_epipolar, row=row, col=col
348
+ )
349
+ full_saving_info_flatten = None
350
+ if saving_info_flatten is not None:
351
+ full_saving_info_flatten = ocht.update_saving_infos(
352
+ saving_info_flatten, row=row, col=col
403
353
  )
404
- full_saving_info_flatten = None
405
- if saving_info_flatten is not None:
406
- full_saving_info_flatten = ocht.update_saving_infos(
407
- saving_info_flatten, row=row, col=col
354
+ if merged_point_cloud[row][col] is not None:
355
+ csv_pc_file_name, laz_pc_file_name = (
356
+ generate_point_cloud_file_names(
357
+ csv_pc_dir_name,
358
+ laz_pc_dir_name,
359
+ row,
360
+ col,
361
+ pc_index,
362
+ pair_key=prefix,
408
363
  )
409
- if merged_point_cloud[row][col] is not None:
410
- csv_pc_file_name, laz_pc_file_name = (
411
- generate_point_cloud_file_names(
412
- csv_pc_dir_name,
413
- laz_pc_dir_name,
414
- row,
415
- col,
416
- pc_index,
417
- pair_key=prefix,
418
- )
419
- )
420
- window = merged_point_cloud.tiling_grid[row, col]
421
- overlap = filtered_point_cloud.overlaps[row, col]
422
- # Delayed call to cloud filtering
423
- (
424
- filtered_point_cloud[row, col],
425
- flatten_filtered_point_cloud[row, col],
426
- ) = self.orchestrator.cluster.create_task(
427
- epipolar_small_component_removal_wrapper, nout=2
428
- )(
429
- merged_point_cloud[row, col],
430
- self.connection_distance,
431
- self.nb_points_threshold,
432
- self.clusters_distance_threshold,
433
- self.half_epipolar_size,
434
- window,
435
- overlap,
436
- point_cloud_csv_file_name=csv_pc_file_name,
437
- point_cloud_laz_file_name=laz_pc_file_name,
438
- saving_info_epipolar=full_saving_info_epipolar,
439
- saving_info_flatten=full_saving_info_flatten,
440
- )
441
-
442
- # update point cloud index
443
- if point_cloud_dir:
444
- self.orchestrator.update_index(pc_index)
364
+ )
365
+ window = merged_point_cloud.tiling_grid[row, col]
366
+ overlap = filtered_point_cloud.overlaps[row, col]
367
+ # Delayed call to cloud filtering
368
+ (
369
+ filtered_point_cloud[row, col],
370
+ flatten_filtered_point_cloud[row, col],
371
+ ) = self.orchestrator.cluster.create_task(
372
+ epipolar_small_component_removal_wrapper, nout=2
373
+ )(
374
+ merged_point_cloud[row, col],
375
+ self.connection_distance,
376
+ self.nb_points_threshold,
377
+ self.clusters_distance_threshold,
378
+ self.half_epipolar_size,
379
+ window,
380
+ overlap,
381
+ epsg=epsg,
382
+ point_cloud_csv_file_name=csv_pc_file_name,
383
+ point_cloud_laz_file_name=laz_pc_file_name,
384
+ saving_info_epipolar=full_saving_info_epipolar,
385
+ saving_info_flatten=full_saving_info_flatten,
386
+ )
445
387
 
446
- else:
447
- logging.error(
448
- "PointCloudOutlierRemoval application doesn't support "
449
- "this input data "
450
- "format"
451
- )
388
+ # update point cloud index
389
+ if point_cloud_dir:
390
+ self.orchestrator.update_index(pc_index)
452
391
 
453
392
  return filtered_point_cloud
454
393
 
455
394
 
456
- def small_component_removal_wrapper(
457
- cloud,
458
- connection_distance,
459
- nb_points_threshold,
460
- clusters_distance_threshold,
461
- save_by_pair: bool = False,
462
- point_cloud_csv_file_name=None,
463
- point_cloud_laz_file_name=None,
464
- saving_info=None,
465
- ):
466
- """
467
- Small components outlier removal
468
-
469
- :param cloud: cloud to filter
470
- :type cloud: pandas DataFrame
471
- :param connection_distance: connection distance
472
- :type connection_distance: float
473
- :param nb_points_threshold:
474
- :type nb_points_threshold: int
475
- :param clusters_distance_threshold:
476
- :type clusters_distance_threshold: float
477
- :param save_by_pair: save point cloud as pair
478
- :type save_by_pair: bool
479
- :param point_cloud_csv_file_name: write point cloud as CSV in filename
480
- (if None, the point cloud is not written as csv)
481
- :type point_cloud_csv_file_name: str
482
- :param point_cloud_laz_file_name: write point cloud as laz in filename
483
- (if None, the point cloud is not written as laz)
484
- :type point_cloud_laz_file_name: str
485
- :param saving_info: saving infos
486
- :type saving_info: dict
487
-
488
- :return: filtered cloud
489
- :rtype: pandas DataFrame
490
-
491
- """
492
-
493
- # Copy input cloud
494
- new_cloud = cloud.copy()
495
- new_cloud.attrs = copy.deepcopy(cloud.attrs)
496
-
497
- # Get current epsg
498
- cloud_attributes = cars_dataset.get_attributes(new_cloud)
499
- cloud_epsg = cloud_attributes["epsg"]
500
- current_epsg = cloud_epsg
501
-
502
- # Check if can be used to filter
503
- spatial_ref = CRS.from_epsg(cloud_epsg)
504
- if spatial_ref.is_geographic:
505
- logging.debug(
506
- "The points cloud to filter is not in a cartographic system. "
507
- "The filter's default parameters might not be adapted "
508
- "to this referential. Please, convert the points "
509
- "cloud to ECEF to ensure a proper point_cloud."
510
- )
511
- # Convert to epsg = 4978
512
- cartographic_epsg = 4978
513
-
514
- projection.point_cloud_conversion_dataframe(
515
- new_cloud, current_epsg, cartographic_epsg
516
- )
517
- current_epsg = cartographic_epsg
518
-
519
- # Filter point cloud
520
- tic = time.process_time()
521
- (
522
- new_cloud,
523
- _,
524
- ) = outlier_removal_algo.small_component_filtering(
525
- new_cloud,
526
- connection_distance,
527
- nb_points_threshold,
528
- clusters_distance_threshold,
529
- )
530
- toc = time.process_time()
531
- logging.debug(
532
- "Small component cloud filtering done in {} seconds".format(toc - tic)
533
- )
534
-
535
- # Conversion to UTM
536
- projection.point_cloud_conversion_dataframe(
537
- new_cloud, cloud_epsg, current_epsg
538
- )
539
- # Update attributes
540
- cloud_attributes["epsg"] = current_epsg
541
- cars_dataset.fill_dataframe(
542
- new_cloud, saving_info=saving_info, attributes=cloud_attributes
543
- )
544
-
545
- # save point cloud in worker
546
- if point_cloud_csv_file_name:
547
- cars_dataset.run_save_points(
548
- new_cloud,
549
- point_cloud_csv_file_name,
550
- save_by_pair=save_by_pair,
551
- overwrite=True,
552
- point_cloud_format="csv",
553
- )
554
- if point_cloud_laz_file_name:
555
- cars_dataset.run_save_points(
556
- new_cloud,
557
- point_cloud_laz_file_name,
558
- save_by_pair=save_by_pair,
559
- overwrite=True,
560
- point_cloud_format="laz",
561
- )
562
-
563
- return new_cloud
564
-
565
-
395
+ # pylint: disable=too-many-positional-arguments
566
396
  def epipolar_small_component_removal_wrapper(
567
397
  cloud,
568
398
  connection_distance,
@@ -571,6 +401,7 @@ def epipolar_small_component_removal_wrapper(
571
401
  half_epipolar_size,
572
402
  window,
573
403
  overlap,
404
+ epsg=None,
574
405
  point_cloud_csv_file_name=None,
575
406
  point_cloud_laz_file_name=None,
576
407
  saving_info_epipolar=None,
@@ -647,19 +478,19 @@ def epipolar_small_component_removal_wrapper(
647
478
  if point_cloud_csv_file_name or point_cloud_laz_file_name:
648
479
  # Convert epipolar array into point cloud
649
480
  flatten_filtered_cloud, cloud_epsg = (
650
- pc_fusion_algo.create_combined_cloud(
651
- [filtered_cloud], ["0"], current_epsg
481
+ pc_transform.depth_map_dataset_to_dataframe(
482
+ filtered_cloud, current_epsg
652
483
  )
653
484
  )
654
485
  # Convert to UTM
655
- if current_epsg is not None and cloud_epsg != current_epsg:
486
+ if epsg is not None and cloud_epsg != epsg:
656
487
  projection.point_cloud_conversion_dataframe(
657
- flatten_filtered_cloud, cloud_epsg, current_epsg
488
+ flatten_filtered_cloud, cloud_epsg, epsg
658
489
  )
659
- cloud_epsg = current_epsg
490
+ cloud_epsg = epsg
660
491
 
661
492
  # Fill attributes for LAZ saving
662
- color_type = pc_fusion_wrappers.get_color_type([filtered_cloud])
493
+ color_type = pc_transform.get_color_type([filtered_cloud])
663
494
 
664
495
  attributes = {
665
496
  "epsg": cloud_epsg,