From acd3c8f229f9a64cf5fe62cf8dc29fcedf00d2fa Mon Sep 17 00:00:00 2001 From: Antoine Lavenant Date: Tue, 15 Oct 2024 12:19:43 +0200 Subject: [PATCH] update algo radius, update some variable name. --- ...e_for_digital_models_with_new_dimension.py | 58 +++++++++--------- .../RadiusAssignFilter.cpp | 7 ++- test/data/mnx/reference/crop_1.laz | Bin 673109 -> 673109 bytes test/data/mnx/reference/crop_2.laz | Bin 843829 -> 846759 bytes test/data/mnx/reference/crop_3.laz | Bin 187333 -> 188149 bytes ...e_for_digital_models_with_new_dimension.py | 7 ++- 6 files changed, 39 insertions(+), 33 deletions(-) diff --git a/pdal_ign_macro/mark_points_to_use_for_digital_models_with_new_dimension.py b/pdal_ign_macro/mark_points_to_use_for_digital_models_with_new_dimension.py index 4a3cc20..7449635 100755 --- a/pdal_ign_macro/mark_points_to_use_for_digital_models_with_new_dimension.py +++ b/pdal_ign_macro/mark_points_to_use_for_digital_models_with_new_dimension.py @@ -88,9 +88,9 @@ def define_marking_pipeline(input_las, output_las, dsm_dimension, dtm_dimension) # 0 - ajout de dimensions temporaires et de sortie temporary_dimensions = [ "PT_VEG_DSM", - "PT_ON_BRIDGE", - "PT_ON_BUILDING", - "PT_ON_VEGET", + "PT_UNDER_BRIDGE", + "PT_CLOSED_BUILDING", + "PT_UNDER_VEGET", "PT_ON_SOL", "PT_ON_VIRT", ] @@ -128,14 +128,14 @@ def define_marking_pipeline(input_las, output_las, dsm_dimension, dtm_dimension) condition_ref="Classification==2 && PT_VEG_DSM==0", condition_out="PT_VEG_DSM=0", ) - # 1.3 Isolement en PT_ON_VEGET=1 des éléments sous la végétation (hors sol) + # 1.3 Isolement en PT_UNDER_VEGET=1 des éléments sous la végétation (hors sol) pipeline = macro.add_radius_assign( pipeline, 1, False, condition_src=macro.build_condition("Classification", [6, 9, 17, 67]), condition_ref=macro.build_condition("Classification", [4, 5]), - condition_out="PT_ON_VEGET=1", + condition_out="PT_UNDER_VEGET=1", max2d_above=-1, max2d_below=0, ) @@ -143,13 +143,13 @@ def define_marking_pipeline(input_las, output_las, dsm_dimension, dtm_dimension) pipeline, 1, False, - condition_src="PT_ON_VEGET==1 && ( " + condition_src="PT_UNDER_VEGET==1 && ( " + macro.build_condition("Classification", [6, 9, 17, 67]) + " )", - condition_ref="PT_ON_VEGET==0 && ( " + condition_ref="PT_UNDER_VEGET==0 && ( " + macro.build_condition("Classification", [6, 9, 17, 67]) + " )", - condition_out="PT_ON_VEGET=0", + condition_out="PT_UNDER_VEGET=0", max2d_above=0.5, max2d_below=0.5, ) @@ -232,7 +232,7 @@ def define_marking_pipeline(input_las, output_las, dsm_dimension, dtm_dimension) resolution=0.5, output_dimension=dsm_dimension, output_type="max", - where="(PT_ON_VEGET==0 && (" + where="(PT_UNDER_VEGET==0 && (" + macro.build_condition("Classification", [6, 17, 67]) + f") || {dsm_dimension}==1)", ) @@ -247,7 +247,7 @@ def define_marking_pipeline(input_las, output_las, dsm_dimension, dtm_dimension) resolution=0.5, output_dimension=dsm_dimension, output_type="min", - where="(PT_ON_VEGET==0 && PT_ON_SOL==0 && PT_ON_VIRT==0 && Classification==9)", + where="(PT_UNDER_VEGET==0 && PT_ON_SOL==0 && PT_ON_VIRT==0 && Classification==9)", ) ################################################################################################################### # 4 - Gestion des points sol sous la veget,bâtis et ponts pour le MNS @@ -271,14 +271,14 @@ def define_marking_pipeline(input_las, output_las, dsm_dimension, dtm_dimension) False, condition_src="Classification==2 && PT_VEG_DSM==0", condition_ref=macro.build_condition("Classification", [6, 67]), - condition_out="PT_ON_BUILDING=1", + condition_out="PT_CLOSED_BUILDING=1", ) pipeline = macro.add_radius_assign( pipeline, 1, False, - condition_src=f"Classification==2 && {dsm_dimension}==0 && PT_ON_BUILDING==1 && {dtm_dimension}==1", - condition_ref="Classification==2 && PT_ON_BUILDING==0 && PT_VEG_DSM==0", + condition_src=f"Classification==2 && {dsm_dimension}==0 && PT_CLOSED_BUILDING==1 && {dtm_dimension}==1", + condition_ref="Classification==2 && PT_CLOSED_BUILDING==0 && PT_VEG_DSM==0", condition_out=f"{dsm_dimension}=1", ) ################################################################################################################### @@ -291,29 +291,29 @@ def define_marking_pipeline(input_las, output_las, dsm_dimension, dtm_dimension) False, condition_src=macro.build_condition("Classification", [2, 3, 4, 5, 6, 9, 67]), condition_ref="Classification==17", - condition_out="PT_ON_BRIDGE=1", - max2d_above=-1, # ne pas prendre les points qui sont en dessous des points pont (condition_ref) - max2d_below=0, # prendre tous les points qui sont au dessus des points pont (condition_ref) + condition_out="PT_UNDER_BRIDGE=1", + max2d_above=-1, # prendre les points (condition_src) qui on des points ponts au dessus d'eux (condition_ref) + max2d_below=0, ) pipeline = macro.add_radius_assign( pipeline, 1.25, False, - condition_src="PT_ON_BRIDGE==1", - condition_ref="PT_ON_BRIDGE==0 && " + condition_src="PT_UNDER_BRIDGE==1", + condition_ref="PT_UNDER_BRIDGE==0 && " + macro.build_condition("Classification", [2, 3, 4, 5, 6, 9, 67]), - condition_out="PT_ON_BRIDGE=0", - max2d_above=0.5, # ne pas prendre les points qui sont en dessous des points pont (condition_ref) - max2d_below=0.5, # prendre tous les points qui sont au dessus des points pont (condition_ref) + condition_out="PT_UNDER_BRIDGE=0", + max2d_above=0.5, + max2d_below=0.5, ) - pipeline |= pdal.Filter.assign(value=[f"{dsm_dimension}=0 WHERE PT_ON_BRIDGE==1"]) + pipeline |= pdal.Filter.assign(value=[f"{dsm_dimension}=0 WHERE PT_UNDER_BRIDGE==1"]) ################################################################################################################### # 6 - Ajout des point pour MNT (sol) qui servent au MNS également ################################################################################################################### pipeline |= pdal.Filter.assign( value=[ - f"{dsm_dimension}=1 WHERE ({dtm_dimension}==1 && PT_VEG_DSM==0 && PT_ON_BRIDGE==0 && PT_ON_BUILDING==0 && PT_ON_VEGET==0)" + f"{dsm_dimension}=1 WHERE ({dtm_dimension}==1 && PT_VEG_DSM==0 && PT_UNDER_BRIDGE==0 && PT_CLOSED_BUILDING==0 && PT_UNDER_VEGET==0)" ] ) @@ -333,15 +333,15 @@ def define_marking_pipeline(input_las, output_las, dsm_dimension, dtm_dimension) False, condition_src="Classification==66", condition_ref=macro.build_condition("Classification", [4, 5, 6, 17, 67]), - condition_out="PT_ON_VEGET=1", + condition_out="PT_UNDER_VEGET=1", ) pipeline = macro.add_radius_assign( pipeline, 0.5, False, - condition_src="PT_ON_VEGET==1 && Classification==66", - condition_ref="PT_ON_VEGET==0 && Classification==66", - condition_out="PT_ON_VEGET=0", + condition_src="PT_UNDER_VEGET==1 && Classification==66", + condition_ref="PT_UNDER_VEGET==0 && Classification==66", + condition_out="PT_UNDER_VEGET=0", ) # 7.3 Taguage pour les MNS des points virtuels eau seulement pipeline = macro.add_radius_assign( @@ -350,11 +350,11 @@ def define_marking_pipeline(input_las, output_las, dsm_dimension, dtm_dimension) False, condition_src="Classification==66", condition_ref="Classification==17", - condition_out="PT_ON_BRIDGE=1", + condition_out="PT_UNDER_BRIDGE=1", ) pipeline |= pdal.Filter.assign( value=[ - f"{dsm_dimension}=1 WHERE (Classification==66 && PT_ON_VEGET==0 && PT_ON_BRIDGE==0)" + f"{dsm_dimension}=1 WHERE (Classification==66 && PT_UNDER_VEGET==0 && PT_UNDER_BRIDGE==0)" ] ) diff --git a/src/filter_radius_assign/RadiusAssignFilter.cpp b/src/filter_radius_assign/RadiusAssignFilter.cpp index cfcff24..8b31348 100644 --- a/src/filter_radius_assign/RadiusAssignFilter.cpp +++ b/src/filter_radius_assign/RadiusAssignFilter.cpp @@ -82,16 +82,17 @@ void RadiusAssignFilter::doOneNoDomain(PointRef &pointSrc) { double Zsrc = pointSrc.getFieldAs(Dimension::Id::Z); - std::set ZNeib; + bool take (false); for (PointId ptId : iNeighbors) { double Zref = refView->point(ptId).getFieldAs(Dimension::Id::Z); if (m_args->m_max2d_above>=0 && Zref>Zsrc && (Zref-Zsrc)>m_args->m_max2d_above) continue; if (m_args->m_max2d_below>=0 && Zsrc>Zref && (Zsrc-Zref)>m_args->m_max2d_below) continue; - ZNeib.insert(Zref); + take = true; + break; } - if (ZNeib.size()==0) return; + if (!take) return; } m_args->m_ptsToUpdate.push_back(pointSrc.pointId()); diff --git a/test/data/mnx/reference/crop_1.laz b/test/data/mnx/reference/crop_1.laz index 38048ad437c6b6642309432e329aa424a11fd9e6..898723274bff8a8487a79e857dc468757bf27100 100644 GIT binary patch delta 44 zcmccGrFpeWb3zoOVqaO;nWJ*v!GmbbxttFXJLcJ}!oUka&N; zc&8vw7kAg`j55rd1mI$!o<1&~e(oUA4ZJYXFjsfi5RlO3&HBu8Y-}0~%nW_6CkJzy zOjMMZ+|HRX`7mPy+a5*+hCPhUZ#moFaxwxj)AqNV%)3pddtPN-thw0!j1AB=sDN$v zA4xMLq15Y#<0cU^lNs^8PnzL znI$G)V02*J2=v0nc58cPAZFQaZO^)N=60a-%NT)b1=-|OC+>Wf12jZoJJ1k2MxYj7 zHre0ml^Ql6L5Rr@Zm>d3=DW$70aTIDUUrieh}pK6-DKx|1-7*LFb72H^>av3a@Kb;#Qb$vSb_UqGm{5%96-q^D=)A8)1OC_6)uK|4t02P^=R{#J2 delta 186 zcmZ2}-FWK(;|Wm$tc)+%%NYYX85md?7#Q00CMrs9Z02BOYGB;l%eaVfb3Usa8=C+F zGlR^7$&!>ii|JV%NZwfGcd3)Ffg>aO;nWJ*v!GmbbxttFXJLcJ}!oUka&N; zc&8vw7kAg`g2$OQ3BbidJ$+m}{oFyK8+c)&VXp43At0g6oAsIH*w{1}m>Hhjn;gt( zGTD+*VsblY#^l3{3C-_0+uw6CZhz0oqBWXZcL7le000C4004$Aks%qeg9rfvfC00O0ipr3Zv`F( z1`q%P0JPhalM6JH-wSAirwoUu3<0;N3<537m+aR9Xt%W30yzc<4K`V-BLDyZH(wn1 diff --git a/test/pdal_ign_macro/test_mark_points_to_use_for_digital_models_with_new_dimension.py b/test/pdal_ign_macro/test_mark_points_to_use_for_digital_models_with_new_dimension.py index 3e15594..274dd57 100644 --- a/test/pdal_ign_macro/test_mark_points_to_use_for_digital_models_with_new_dimension.py +++ b/test/pdal_ign_macro/test_mark_points_to_use_for_digital_models_with_new_dimension.py @@ -57,7 +57,12 @@ def test_mark_points_to_use_for_digital_models_with_new_dimension_keep_dimension assert all( [ dim in output_dimensions - for dim in ["PT_VEG_DSM", "PT_ON_BRIDGE", "PT_ON_BUILDING", "PT_ON_VEGET"] + for dim in [ + "PT_VEG_DSM", + "PT_UNDER_BRIDGE", + "PT_CLOSED_BUILDING", + "PT_UNDER_VEGET", + ] ] )