cars 1.0.0a1__cp310-cp310-win_amd64.whl → 1.0.0a2__cp310-cp310-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 (49) hide show
  1. cars/__init__.py +4 -4
  2. cars/applications/dem_generation/dem_generation_wrappers.py +5 -1
  3. cars/applications/dem_generation/dichotomic_generation_app.py +21 -6
  4. cars/applications/dem_generation/rasterization_app.py +70 -27
  5. cars/applications/dense_match_filling/abstract_dense_match_filling_app.py +4 -0
  6. cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp310-win_amd64.dll.a +0 -0
  7. cars/applications/dense_match_filling/cpp/dense_match_filling_cpp.cp310-win_amd64.pyd +0 -0
  8. cars/applications/dense_match_filling/fill_disp_algo.py +41 -12
  9. cars/applications/dense_match_filling/plane_app.py +11 -0
  10. cars/applications/dense_match_filling/zero_padding_app.py +11 -1
  11. cars/applications/dense_matching/census_mccnn_sgm_app.py +262 -545
  12. cars/applications/dense_matching/cpp/dense_matching_cpp.cp310-win_amd64.dll.a +0 -0
  13. cars/applications/dense_matching/cpp/dense_matching_cpp.cp310-win_amd64.pyd +0 -0
  14. cars/applications/dense_matching/dense_matching_algo.py +59 -11
  15. cars/applications/dense_matching/dense_matching_wrappers.py +51 -31
  16. cars/applications/dense_matching/disparity_grid_algo.py +572 -0
  17. cars/applications/grid_generation/grid_correction_app.py +0 -53
  18. cars/applications/grid_generation/transform_grid.py +5 -5
  19. cars/applications/point_cloud_fusion/pc_fusion_algo.py +17 -11
  20. cars/applications/point_cloud_fusion/pc_fusion_wrappers.py +3 -4
  21. cars/applications/rasterization/rasterization_algo.py +20 -27
  22. cars/applications/rasterization/rasterization_wrappers.py +6 -5
  23. cars/applications/rasterization/simple_gaussian_app.py +2 -14
  24. cars/applications/sparse_matching/sparse_matching_wrappers.py +0 -49
  25. cars/applications/triangulation/line_of_sight_intersection_app.py +1 -1
  26. cars/applications/triangulation/triangulation_wrappers.py +2 -1
  27. cars/bundleadjustment.py +51 -11
  28. cars/cars.py +15 -5
  29. cars/core/constants.py +1 -1
  30. cars/core/geometry/abstract_geometry.py +54 -11
  31. cars/core/geometry/shareloc_geometry.py +59 -14
  32. cars/orchestrator/registry/saver_registry.py +0 -78
  33. cars/pipelines/default/default_pipeline.py +23 -26
  34. cars/pipelines/parameters/depth_map_inputs.py +22 -67
  35. cars/pipelines/parameters/dsm_inputs.py +16 -29
  36. cars/pipelines/parameters/sensor_inputs.py +20 -21
  37. cars/pipelines/parameters/sensor_loaders/basic_sensor_loader.py +3 -3
  38. cars/pipelines/parameters/sensor_loaders/pivot_sensor_loader.py +2 -2
  39. cars/pipelines/parameters/sensor_loaders/sensor_loader.py +4 -6
  40. cars/pipelines/parameters/sensor_loaders/sensor_loader_template.py +2 -2
  41. cars/pipelines/pipeline.py +8 -8
  42. cars/pipelines/unit/unit_pipeline.py +103 -196
  43. cars/starter.py +20 -1
  44. cars-1.0.0a2.dist-info/DELVEWHEEL +2 -0
  45. {cars-1.0.0a1.dist-info → cars-1.0.0a2.dist-info}/METADATA +3 -2
  46. {cars-1.0.0a1.dist-info → cars-1.0.0a2.dist-info}/RECORD +48 -47
  47. cars-1.0.0a1.dist-info/DELVEWHEEL +0 -2
  48. {cars-1.0.0a1.dist-info → cars-1.0.0a2.dist-info}/WHEEL +0 -0
  49. {cars-1.0.0a1.dist-info → cars-1.0.0a2.dist-info}/entry_points.txt +0 -0
@@ -91,7 +91,11 @@ class SharelocGeometry(AbstractGeometry):
91
91
  self.dem_roi_epsg = inputs.rasterio_get_epsg(dem)
92
92
 
93
93
  self.roi_shareloc = self.get_roi(
94
- pairs_for_roi, self.dem_roi_epsg, margin=0.012
94
+ pairs_for_roi,
95
+ self.dem_roi_epsg,
96
+ z_min=0,
97
+ z_max=0,
98
+ margin=self.dem_roi_margin,
95
99
  )
96
100
  # change convention
97
101
  self.dem_roi = [
@@ -105,14 +109,26 @@ class SharelocGeometry(AbstractGeometry):
105
109
 
106
110
  # fill_nodata option should be set when dealing with void in DTM
107
111
  # see shareloc DTM limitations in sphinx doc for further details
108
- dtm_image = dtm_reader(
109
- dem,
110
- geoid,
111
- roi=self.roi_shareloc,
112
- roi_is_in_physical_space=True,
113
- fill_nodata="mean",
114
- fill_value=0.0,
115
- )
112
+
113
+ try:
114
+ dtm_image = dtm_reader(
115
+ dem,
116
+ geoid,
117
+ roi=self.roi_shareloc,
118
+ roi_is_in_physical_space=True,
119
+ fill_nodata="mean",
120
+ fill_value=0.0,
121
+ )
122
+ except RuntimeError as err:
123
+ mss = "the roi bounds are"
124
+ if mss in str(err):
125
+ new_except_mss = (
126
+ f"The extent of the roi lies outside "
127
+ f"the extent of the initial elevation : {err}"
128
+ )
129
+ raise RuntimeError(new_except_mss) from err
130
+ raise
131
+
116
132
  self.elevation = (
117
133
  bindings_cpp.DTMIntersection( # pylint: disable=I1101
118
134
  dtm_image.epsg,
@@ -125,7 +141,7 @@ class SharelocGeometry(AbstractGeometry):
125
141
  else:
126
142
  self.elevation = default_alt
127
143
 
128
- def get_roi(self, pairs_for_roi, epsg, margin=0.006):
144
+ def get_roi(self, pairs_for_roi, epsg, z_min=0, z_max=0, margin=0.012):
129
145
  """
130
146
  Compute region of interest for intersection of DEM
131
147
 
@@ -138,27 +154,56 @@ class SharelocGeometry(AbstractGeometry):
138
154
  """
139
155
  coords_list = []
140
156
  for image1, geomodel1, image2, geomodel2 in pairs_for_roi:
141
- # Footprint of left image
157
+ # Footprint of left image with altitude z_min
142
158
  coords_list.extend(
143
- self.image_envelope(image1["main_file"], geomodel1)
159
+ self.image_envelope(
160
+ image1["main_file"], geomodel1, elevation=z_min
161
+ )
144
162
  )
145
- # Footprint of right image
163
+ # Footprint of left image with altitude z_max
146
164
  coords_list.extend(
147
- self.image_envelope(image2["main_file"], geomodel2)
165
+ self.image_envelope(
166
+ image1["main_file"], geomodel1, elevation=z_max
167
+ )
168
+ )
169
+ # Footprint of right image with altitude z_min
170
+ coords_list.extend(
171
+ self.image_envelope(
172
+ image2["main_file"], geomodel2, elevation=z_min
173
+ )
174
+ )
175
+ # Footprint of right image with altitude z_max
176
+ coords_list.extend(
177
+ self.image_envelope(
178
+ image2["main_file"], geomodel2, elevation=z_max
179
+ )
148
180
  )
149
181
  # Footprint of rectification grid (with margins)
150
182
  image1 = SharelocGeometry.load_image(image1["main_file"])
151
183
  geomodel1 = self.load_geom_model(geomodel1)
152
184
  geomodel2 = self.load_geom_model(geomodel2)
185
+
186
+ # With altitude z_min
153
187
  epipolar_extent = rectif.get_epipolar_extent(
154
188
  image1,
155
189
  geomodel1,
156
190
  geomodel2,
191
+ elevation=z_min,
157
192
  grid_margin=self.rectification_grid_margin,
158
193
  )
159
194
  lat_min, lon_min, lat_max, lon_max = list(epipolar_extent)
160
195
  coords_list.extend([(lon_min, lat_min), (lon_max, lat_max)])
161
196
 
197
+ # With altitude z_max
198
+ epipolar_extent = rectif.get_epipolar_extent(
199
+ image1,
200
+ geomodel1,
201
+ geomodel2,
202
+ elevation=z_max,
203
+ grid_margin=self.rectification_grid_margin,
204
+ )
205
+ lat_min, lon_min, lat_max, lon_max = list(epipolar_extent)
206
+ coords_list.extend([(lon_min, lat_min), (lon_max, lat_max)])
162
207
  lon_list, lat_list = list(zip(*coords_list)) # noqa: B905
163
208
  roi = [
164
209
  min(lat_list) - margin,
@@ -28,8 +28,6 @@ import logging
28
28
  import os
29
29
  import traceback
30
30
 
31
- from cars.core import constants as cst
32
-
33
31
  # CARS imports
34
32
  from cars.orchestrator.registry.abstract_registry import (
35
33
  AbstractCarsDatasetRegistry,
@@ -291,21 +289,6 @@ class SingleCarsDatasetSaver:
291
289
  try:
292
290
  if self.cars_ds.dataset_type == "arrays":
293
291
  if not self.already_seen:
294
- self.add_confidences(future_result, cst.RASTER_CONFIDENCE)
295
- self.add_confidences(future_result, cst.RASTER_AMBIGUITY)
296
-
297
- # delete doublon because of the confidences adding
298
- for index, value in enumerate(self.file_names):
299
- if (
300
- cst.RASTER_AMBIGUITY in value
301
- and cst.DSM_ALT not in value
302
- and "depth_map" not in value
303
- ):
304
- self.tags.pop(index)
305
- self.dtypes.pop(index)
306
- self.nodatas.pop(index)
307
- self.file_names.pop(index)
308
-
309
292
  # generate descriptors
310
293
  for count, file_name in enumerate(self.file_names):
311
294
  if self.tags[count] in future_result.keys():
@@ -340,22 +323,6 @@ class SingleCarsDatasetSaver:
340
323
  elif self.cars_ds.dataset_type == "points":
341
324
  # type points
342
325
  if not self.already_seen:
343
- # get the confidence tags available in future result
344
- self.add_confidences(future_result, cst.RASTER_CONFIDENCE)
345
- self.add_confidences(future_result, cst.RASTER_AMBIGUITY)
346
-
347
- # delete doublon because of the confidences adding
348
- for index, value in enumerate(self.file_names):
349
- if (
350
- cst.RASTER_AMBIGUITY in value
351
- and cst.DSM_ALT not in value
352
- and "depth_map" not in value
353
- ):
354
- self.tags.pop(index)
355
- self.dtypes.pop(index)
356
- self.nodatas.pop(index)
357
- self.file_names.pop(index)
358
-
359
326
  # create tmp_folder
360
327
  self.folder_name = self.file_names[0]
361
328
  if not os.path.exists(self.folder_name):
@@ -380,51 +347,6 @@ class SingleCarsDatasetSaver:
380
347
  logging.error(traceback.format_exc())
381
348
  logging.error("Tile not saved")
382
349
 
383
- def add_confidences(self, future_result, confidence_type):
384
- """
385
- Add all confidence data in the register
386
- Read confidence from future result outputs and rewrite
387
- the confidence registered values
388
- """
389
-
390
- def test_conf(val):
391
- """
392
- Check if val key string contains confidence subtring
393
- """
394
- if isinstance(val, str):
395
- return confidence_type in val
396
- return False
397
-
398
- confidence_tags = list(filter(test_conf, future_result.keys()))
399
-
400
- index = None
401
- if confidence_type in self.tags:
402
- # get the confidence indexes in the registered tag
403
- index_table = [
404
- idx
405
- for idx, value in enumerate(self.tags)
406
- if value == confidence_type
407
- ] # self.tags.index("confidence")
408
- for index in reversed(index_table):
409
- ref_confidence_path = self.file_names[index]
410
- confidence_dtype = self.dtypes[index]
411
- confidence_nodatas = self.nodatas[index]
412
- # delete the generic confidence registered values
413
- self.tags.pop(index)
414
- self.dtypes.pop(index)
415
- self.nodatas.pop(index)
416
- self.file_names.pop(index)
417
- self.optional_data_list.pop(index)
418
- for item in confidence_tags:
419
- self.tags.append(item)
420
- self.file_names.append(
421
- ref_confidence_path.replace(
422
- confidence_type, item.replace(".", "_")
423
- )
424
- )
425
- self.dtypes.append(confidence_dtype)
426
- self.nodatas.append(confidence_nodatas)
427
-
428
350
  def cleanup(self):
429
351
  """
430
352
  Cleanup function
@@ -80,7 +80,7 @@ class DefaultPipeline(PipelineTemplate):
80
80
 
81
81
  # pylint: disable=too-many-instance-attributes
82
82
 
83
- def __init__(self, conf, config_json_dir=None):
83
+ def __init__(self, conf, config_dir=None): # noqa: C901
84
84
  """
85
85
  Creates pipeline
86
86
 
@@ -99,13 +99,17 @@ class DefaultPipeline(PipelineTemplate):
99
99
  :type pipeline_name: str
100
100
  :param cfg: configuration {'matching_cost_method': value}
101
101
  :type cfg: dictionary
102
- :param config_json_dir: path to dir containing json
103
- :type config_json_dir: str
102
+ :param config_dir: path to dir containing json or yaml file
103
+ :type config_dir: str
104
104
  """
105
105
 
106
106
  # Used conf
107
107
  self.used_conf = {}
108
108
 
109
+ # Transform relative path to absolute path
110
+ if config_dir is not None:
111
+ config_dir = os.path.abspath(config_dir)
112
+
109
113
  # Check global conf
110
114
  self.check_global_schema(conf)
111
115
 
@@ -114,9 +118,7 @@ class DefaultPipeline(PipelineTemplate):
114
118
  # So we do the check once
115
119
 
116
120
  # Check conf inputs
117
- inputs = self.check_inputs(
118
- conf[INPUTS], config_json_dir=config_json_dir
119
- )
121
+ inputs = self.check_inputs(conf[INPUTS], config_dir=config_dir)
120
122
 
121
123
  # Check conf output
122
124
  output = self.check_output(conf[OUTPUT])
@@ -523,15 +525,15 @@ class DefaultPipeline(PipelineTemplate):
523
525
  logging.warning(log_msg)
524
526
 
525
527
  @staticmethod
526
- def check_inputs(conf, config_json_dir=None):
528
+ def check_inputs(conf, config_dir=None):
527
529
  """
528
530
  Check the inputs given
529
531
 
530
532
  :param conf: configuration of inputs
531
533
  :type conf: dict
532
- :param config_json_dir: directory of used json, if
534
+ :param config_dir: directory of used json, if
533
535
  user filled paths with relative paths
534
- :type config_json_dir: str
536
+ :type config_dir: str
535
537
 
536
538
  :return: overloaded inputs
537
539
  :rtype: dict
@@ -544,21 +546,19 @@ class DefaultPipeline(PipelineTemplate):
544
546
  and dsm_cst.DSMS not in conf
545
547
  ):
546
548
  output_config = sensor_inputs.sensors_check_inputs(
547
- conf, config_json_dir=config_json_dir
549
+ conf, config_dir=config_dir
548
550
  )
549
551
  elif depth_cst.DEPTH_MAPS in conf:
550
552
  output_config = {
551
553
  **output_config,
552
554
  **depth_map_inputs.check_depth_maps_inputs(
553
- conf, config_json_dir=config_json_dir
555
+ conf, config_dir=config_dir
554
556
  ),
555
557
  }
556
558
  else:
557
559
  output_config = {
558
560
  **output_config,
559
- **dsm_inputs.check_dsm_inputs(
560
- conf, config_json_dir=config_json_dir
561
- ),
561
+ **dsm_inputs.check_dsm_inputs(conf, config_dir=config_dir),
562
562
  }
563
563
  return output_config
564
564
 
@@ -830,17 +830,6 @@ class DefaultPipeline(PipelineTemplate):
830
830
  "intervals",
831
831
  ]
832
832
 
833
- if res <= 16:
834
- if (
835
- "dense matching" not in conf
836
- or "confidence filtering" not in conf["dense matching"]
837
- or "lower bound"
838
- not in conf["dense matching"]["confidence filtering"]
839
- ):
840
- used_conf["dense_matching"]["confidence_filtering"][
841
- "lower_bound"
842
- ] = -90
843
-
844
833
  # Triangulation
845
834
  self.triangulation_application = Application(
846
835
  "triangulation", cfg=used_conf.get("triangulation", {})
@@ -853,10 +842,18 @@ class DefaultPipeline(PipelineTemplate):
853
842
  self.dem_generation_application = Application(
854
843
  "dem_generation", cfg=used_conf.get("dem_generation", {})
855
844
  )
845
+
846
+ height_margin = None
847
+ if res >= 8 and "height_margin" not in used_conf["dem_generation"]:
848
+ height_margin = [50, 250]
849
+
856
850
  used_conf["dem_generation"] = (
857
851
  self.dem_generation_application.get_conf()
858
852
  )
859
853
 
854
+ if height_margin is not None:
855
+ used_conf["dem_generation"]["height_margin"] = height_margin
856
+
860
857
  # Points cloud small component outlier removal
861
858
  if "point_cloud_outlier_removal.1" in used_conf:
862
859
  if "method" not in used_conf["point_cloud_outlier_removal.1"]:
@@ -1118,7 +1115,7 @@ class DefaultPipeline(PipelineTemplate):
1118
1115
  size_low_res_img_col = first_image_size[1] // res
1119
1116
  if (
1120
1117
  "grid_generation" not in initial_conf_app
1121
- or "epi_step" not in application_conf["grid_generation"]
1118
+ or "epi_step" not in initial_conf_app["grid_generation"]
1122
1119
  ):
1123
1120
  if size_low_res_img_row <= 900 and size_low_res_img_col <= 900:
1124
1121
  application_conf["grid_generation"]["epi_step"] = res * 5
@@ -37,15 +37,15 @@ from cars.pipelines.parameters import sensor_inputs as sens_inp
37
37
  from cars.pipelines.parameters import sensor_inputs_constants as sens_cst
38
38
 
39
39
 
40
- def check_depth_maps_inputs(conf, config_json_dir=None):
40
+ def check_depth_maps_inputs(conf, config_dir=None):
41
41
  """
42
42
  Check the inputs given
43
43
 
44
44
  :param conf: configuration of inputs
45
45
  :type conf: dict
46
- :param config_json_dir: directory of used json, if
46
+ :param config_dir: directory of used json, if
47
47
  user filled paths with relative paths
48
- :type config_json_dir: str
48
+ :type config_dir: str
49
49
 
50
50
  :return: overloader inputs
51
51
  :rtype: dict
@@ -88,7 +88,7 @@ def check_depth_maps_inputs(conf, config_json_dir=None):
88
88
  cst.EPI_Z_INF: Or(str, None),
89
89
  cst.EPI_Z_SUP: Or(str, None),
90
90
  cst.POINT_CLOUD_CLASSIF_KEY_ROOT: Or(str, None),
91
- cst.POINT_CLOUD_CONFIDENCE_KEY_ROOT: Or(dict, None),
91
+ cst.POINT_CLOUD_AMBIGUITY_KEY_ROOT: Or(str, None),
92
92
  cst.POINT_CLOUD_CLR_KEY_ROOT: str,
93
93
  cst.POINT_CLOUD_FILLING_KEY_ROOT: Or(str, None),
94
94
  cst.POINT_CLOUD_MSK: Or(str, None),
@@ -96,7 +96,6 @@ def check_depth_maps_inputs(conf, config_json_dir=None):
96
96
  cst.PC_EPSG: Or(str, int, None),
97
97
  }
98
98
  checker_pc = Checker(pc_schema)
99
- confidence_conf_ref = None
100
99
  for depth_map_key in conf[depth_map_cst.DEPTH_MAPS]:
101
100
  # Get depth maps with default
102
101
  overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key] = {}
@@ -144,43 +143,10 @@ def check_depth_maps_inputs(conf, config_json_dir=None):
144
143
  cst.POINT_CLOUD_FILLING_KEY_ROOT
145
144
  ] = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get("filling", None)
146
145
 
147
- confidence_conf = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get(
148
- "confidence", None
149
- )
150
- if confidence_conf:
151
- overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
152
- cst.POINT_CLOUD_CONFIDENCE_KEY_ROOT
153
- ] = {}
154
- if (
155
- confidence_conf_ref
156
- and confidence_conf.keys() != confidence_conf_ref
157
- ):
158
- raise KeyError(
159
- "The confidence keys are not the same: \n",
160
- confidence_conf.keys(),
161
- "\n",
162
- confidence_conf_ref,
163
- )
146
+ overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
147
+ cst.POINT_CLOUD_AMBIGUITY_KEY_ROOT
148
+ ] = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get("ambiguity", None)
164
149
 
165
- confidence_conf_ref = confidence_conf.keys()
166
- for confidence_name in confidence_conf:
167
- output_confidence_name = confidence_name
168
- if (
169
- cst.POINT_CLOUD_CONFIDENCE_KEY_ROOT
170
- not in output_confidence_name
171
- ):
172
- output_confidence_name = (
173
- cst.POINT_CLOUD_CONFIDENCE_KEY_ROOT
174
- + "_"
175
- + output_confidence_name
176
- )
177
- overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
178
- cst.POINT_CLOUD_CONFIDENCE_KEY_ROOT
179
- ][output_confidence_name] = confidence_conf[confidence_name]
180
- else:
181
- overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
182
- cst.POINT_CLOUD_CONFIDENCE_KEY_ROOT
183
- ] = None
184
150
  overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
185
151
  cst.PC_EPSG
186
152
  ] = conf[depth_map_cst.DEPTH_MAPS][depth_map_key].get("epsg", 4326)
@@ -190,8 +156,8 @@ def check_depth_maps_inputs(conf, config_json_dir=None):
190
156
  )
191
157
 
192
158
  # Modify to absolute path
193
- if config_json_dir is not None:
194
- modify_to_absolute_path(config_json_dir, overloaded_conf)
159
+ if config_dir is not None:
160
+ modify_to_absolute_path(config_dir, overloaded_conf)
195
161
  else:
196
162
  logging.debug(
197
163
  "path of config file was not given,"
@@ -217,7 +183,7 @@ def check_depth_maps_inputs(conf, config_json_dir=None):
217
183
  cst.POINT_CLOUD_FILLING_KEY_ROOT
218
184
  ],
219
185
  overloaded_conf[depth_map_cst.DEPTH_MAPS][depth_map_key][
220
- cst.POINT_CLOUD_CONFIDENCE_KEY_ROOT
186
+ cst.POINT_CLOUD_AMBIGUITY_KEY_ROOT
221
187
  ],
222
188
  )
223
189
 
@@ -227,7 +193,7 @@ def check_depth_maps_inputs(conf, config_json_dir=None):
227
193
  )
228
194
 
229
195
  if sens_cst.SENSORS in conf and conf[sens_cst.SENSORS] is not None:
230
- sens_inp.check_sensors(conf, overloaded_conf, config_json_dir)
196
+ sens_inp.check_sensors(conf, overloaded_conf, config_dir)
231
197
 
232
198
  return overloaded_conf
233
199
 
@@ -264,10 +230,10 @@ def check_geometry_plugin(conf_inputs, conf_geom_plugin):
264
230
 
265
231
 
266
232
  def check_input_size(
267
- x_path, y_path, z_path, mask, color, classif, filling, confidence
233
+ x_path, y_path, z_path, mask, color, classif, filling, ambiguity
268
234
  ):
269
235
  """
270
- Check x, y, z, mask, color, classif and confidence given
236
+ Check x, y, z, mask, color, classif and ambiguity given
271
237
 
272
238
  Images must have same size
273
239
 
@@ -285,15 +251,15 @@ def check_input_size(
285
251
  :type classif: str
286
252
  :param filling: filling path
287
253
  :type filling: str
288
- :param confidence: confidence dict path
289
- :type confidence: dict[str]
254
+ :param ambiguity: ambiguity path
255
+ :type ambiguity: str
290
256
  """
291
257
 
292
258
  for path in [x_path, y_path, z_path]:
293
259
  if inputs.rasterio_get_nb_bands(path) != 1:
294
260
  raise RuntimeError("{} is not mono-band image".format(path))
295
261
 
296
- for path in [mask, color, classif, filling]:
262
+ for path in [mask, color, classif, filling, ambiguity]:
297
263
  if path is not None:
298
264
  if inputs.rasterio_get_size(x_path) != inputs.rasterio_get_size(
299
265
  path
@@ -302,25 +268,14 @@ def check_input_size(
302
268
  "The image {} and {} "
303
269
  "do not have the same size".format(x_path, path)
304
270
  )
305
- if confidence:
306
- for key in confidence:
307
- path = confidence[key]
308
- if path is not None:
309
- if inputs.rasterio_get_size(x_path) != inputs.rasterio_get_size(
310
- path
311
- ):
312
- raise RuntimeError(
313
- "The image {} and {} "
314
- "do not have the same size".format(x_path, path)
315
- )
316
271
 
317
272
 
318
- def modify_to_absolute_path(config_json_dir, overloaded_conf):
273
+ def modify_to_absolute_path(config_dir, overloaded_conf):
319
274
  """
320
275
  Modify input file path to absolute path
321
276
 
322
- :param config_json_dir: directory of the json configuration
323
- :type config_json_dir: str
277
+ :param config_dir: directory of the json/yaml configuration
278
+ :type config_dir: str
324
279
  :param overloaded_conf: overloaded configuration json
325
280
  :dict overloaded_conf: dict
326
281
  """
@@ -339,7 +294,7 @@ def modify_to_absolute_path(config_json_dir, overloaded_conf):
339
294
  if tag != cst.POINT_CLOUD_CONFIDENCE_KEY_ROOT:
340
295
  if depth_map[tag] is not None:
341
296
  depth_map[tag] = make_relative_path_absolute(
342
- depth_map[tag], config_json_dir
297
+ depth_map[tag], config_dir
343
298
  )
344
299
  else:
345
300
  if depth_map[tag] is not None:
@@ -348,12 +303,12 @@ def modify_to_absolute_path(config_json_dir, overloaded_conf):
348
303
  depth_map[tag][confidence_name] = (
349
304
  make_relative_path_absolute(
350
305
  depth_map[tag][confidence_name],
351
- config_json_dir,
306
+ config_dir,
352
307
  )
353
308
  )
354
309
 
355
310
  if overloaded_conf[sens_cst.ROI] is not None:
356
311
  if isinstance(overloaded_conf[sens_cst.ROI], str):
357
312
  overloaded_conf[sens_cst.ROI] = make_relative_path_absolute(
358
- overloaded_conf[sens_cst.ROI], config_json_dir
313
+ overloaded_conf[sens_cst.ROI], config_dir
359
314
  )
@@ -48,15 +48,15 @@ from cars.pipelines.parameters import sensor_inputs as sens_inp
48
48
  from cars.pipelines.parameters import sensor_inputs_constants as sens_cst
49
49
 
50
50
 
51
- def check_dsm_inputs(conf, config_json_dir=None):
51
+ def check_dsm_inputs(conf, config_dir=None):
52
52
  """
53
53
  Check the inputs given
54
54
 
55
55
  :param conf: configuration of inputs
56
56
  :type conf: dict
57
- :param config_json_dir: directory of used json, if
57
+ :param config_dir: directory of used json/yaml, if
58
58
  user filled paths with relative paths
59
- :type config_json_dir: str
59
+ :type config_dir: str
60
60
 
61
61
  :return: overloader inputs
62
62
  :rtype: dict
@@ -108,7 +108,7 @@ def check_dsm_inputs(conf, config_json_dir=None):
108
108
  cst.DSM_INF_STD: Or(str, None),
109
109
  cst.DSM_SUP_MEAN: Or(str, None),
110
110
  cst.DSM_SUP_STD: Or(str, None),
111
- cst.DSM_CONFIDENCE: Or(dict, None),
111
+ cst.DSM_AMBIGUITY: Or(str, None),
112
112
  cst.DSM_PERFORMANCE_MAP: Or(str, None),
113
113
  cst.DSM_SOURCE_PC: Or(str, None),
114
114
  cst.DSM_FILLING: Or(str, None),
@@ -164,9 +164,9 @@ def check_dsm_inputs(conf, config_json_dir=None):
164
164
  overloaded_conf[dsm_cst.DSMS][dsm_key][cst.DSM_SUP_STD] = conf[
165
165
  dsm_cst.DSMS
166
166
  ][dsm_key].get("dsm_sup_std", None)
167
- overloaded_conf[dsm_cst.DSMS][dsm_key][cst.DSM_CONFIDENCE] = conf[
167
+ overloaded_conf[dsm_cst.DSMS][dsm_key][cst.DSM_AMBIGUITY] = conf[
168
168
  dsm_cst.DSMS
169
- ][dsm_key].get("confidence", None)
169
+ ][dsm_key].get("ambiguity", None)
170
170
  overloaded_conf[dsm_cst.DSMS][dsm_key][cst.DSM_PERFORMANCE_MAP] = conf[
171
171
  dsm_cst.DSMS
172
172
  ][dsm_key].get("performance_map", None)
@@ -181,8 +181,8 @@ def check_dsm_inputs(conf, config_json_dir=None):
181
181
  checker_pc.validate(overloaded_conf[dsm_cst.DSMS][dsm_key])
182
182
 
183
183
  # Modify to absolute path
184
- if config_json_dir is not None:
185
- modify_to_absolute_path(config_json_dir, overloaded_conf)
184
+ if config_dir is not None:
185
+ modify_to_absolute_path(config_dir, overloaded_conf)
186
186
  else:
187
187
  logging.debug(
188
188
  "path of config file was not given,"
@@ -200,14 +200,6 @@ def check_dsm_inputs(conf, config_json_dir=None):
200
200
  overloaded_conf[dsm_cst.DSMS][dsm_key][cst.INDEX_DSM_MASK],
201
201
  )
202
202
 
203
- if cst.DSM_CONFIDENCE in conf[dsm_cst.DSMS][dsm_key]:
204
- if conf[dsm_cst.DSMS][dsm_key][cst.DSM_CONFIDENCE] is not None:
205
- for _, conf_value in conf[dsm_cst.DSMS][dsm_key][
206
- cst.DSM_CONFIDENCE
207
- ].items():
208
- if not os.path.exists(conf_value):
209
- raise RuntimeError("The path doesn't exist")
210
-
211
203
  # Check srtm dir
212
204
  sens_inp.check_srtm(
213
205
  overloaded_conf[sens_cst.INITIAL_ELEVATION][sens_cst.DEM_PATH]
@@ -216,7 +208,7 @@ def check_dsm_inputs(conf, config_json_dir=None):
216
208
  check_phasing(conf[dsm_cst.DSMS])
217
209
 
218
210
  if sens_cst.SENSORS in conf and conf[sens_cst.SENSORS] is not None:
219
- sens_inp.check_sensors(conf, overloaded_conf, config_json_dir)
211
+ sens_inp.check_sensors(conf, overloaded_conf, config_dir)
220
212
 
221
213
  return overloaded_conf
222
214
 
@@ -249,12 +241,12 @@ def check_input_size(dsm, classif, color, mask):
249
241
  )
250
242
 
251
243
 
252
- def modify_to_absolute_path(config_json_dir, overloaded_conf):
244
+ def modify_to_absolute_path(config_dir, overloaded_conf):
253
245
  """
254
246
  Modify input file path to absolute path
255
247
 
256
- :param config_json_dir: directory of the json configuration
257
- :type config_json_dir: str
248
+ :param config_dir: directory of the json configuration
249
+ :type config_dir: str
258
250
  :param overloaded_conf: overloaded configuration json
259
251
  :dict overloaded_conf: dict
260
252
  """
@@ -267,14 +259,12 @@ def modify_to_absolute_path(config_json_dir, overloaded_conf):
267
259
  cst.INDEX_DSM_MASK,
268
260
  ]:
269
261
  if dsms[tag] is not None:
270
- dsms[tag] = make_relative_path_absolute(
271
- dsms[tag], config_json_dir
272
- )
262
+ dsms[tag] = make_relative_path_absolute(dsms[tag], config_dir)
273
263
 
274
264
  if overloaded_conf[sens_cst.ROI] is not None:
275
265
  if isinstance(overloaded_conf[sens_cst.ROI], str):
276
266
  overloaded_conf[sens_cst.ROI] = make_relative_path_absolute(
277
- overloaded_conf[sens_cst.ROI], config_json_dir
267
+ overloaded_conf[sens_cst.ROI], config_dir
278
268
  )
279
269
 
280
270
 
@@ -505,11 +495,8 @@ def merge_dsm_infos( # noqa: C901 function is too complex
505
495
  and performance_map_file_name is not None
506
496
  ):
507
497
  out_file_name = performance_map_file_name
508
- elif (
509
- cst.DSM_CONFIDENCE_AMBIGUITY in key
510
- and ambiguity_file_name is not None
511
- ):
512
- out_file_name = os.path.join(ambiguity_file_name, key + ".tif")
498
+ elif key == cst.DSM_AMBIGUITY and ambiguity_file_name is not None:
499
+ out_file_name = ambiguity_file_name
513
500
  elif (
514
501
  key == cst.DSM_SOURCE_PC and contributing_pair_file_name is not None
515
502
  ):