Skip to content

Commit

Permalink
update name attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
alavenant committed May 17, 2024
1 parent c72234c commit 2d2b3f1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion macro/macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def add_radius_assign(pipeline, radius, search_3d, condition_src, condition_ref,
"REF_DOMAIN = 0", f"REF_DOMAIN = 1 WHERE {condition_ref}",
"radius_search = 0"])
pipeline |= pdal.Filter.radius_assign(radius=radius, src_domain="SRS_DOMAIN",reference_domain="REF_DOMAIN",
output_name_attribute="radius_search", search_3d=search_3d)
output_dimension="radius_search", search_3d=search_3d)
pipeline |= pdal.Filter.assign(value=condition_out,where="radius_search==1")
return pipeline

Expand Down
6 changes: 3 additions & 3 deletions src/filter_radius_assign/radius_assignFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ void RadiusSearchFilter::addArgs(ProgramArgs& args)
args.add("src_domain", "Selects which points will be subject to radius-based neighbors search", m_args->m_srcDomain, "SRC_DOMAIN");
args.add("reference_domain", "Selects which points will be considered as potential neighbors", m_args->m_referenceDomain, "REF_DOMAIN");
args.add("radius", "Distance of neighbors to consult", m_args->m_radius, 1.);
args.add("output_name_attribute", "Name of the added attribut", m_args->m_nameAddAttribute, "radius" );
args.add("output_dimension", "Name of the added attribut", m_args->m_outputDimension, "radius" );
args.add("search_3d", "Search in 3d", m_args->search3d, false );
args.add("search_2d_above", "if search in 2d : filter point above the distance", m_args->m_search_bellow, 0. );
args.add("search_2d_bellow", "if search in 2d : filter point bellow the distance", m_args->m_search_above, 0. );
}

void RadiusSearchFilter::addDimensions(PointLayoutPtr layout)
{
m_args->m_dim = layout->registerOrAssignDim(m_args->m_nameAddAttribute, Dimension::Type::Double);
m_args->m_dim = layout->registerOrAssignDim(m_args->m_outputDimension, Dimension::Type::Double);
m_args->m_dim_ref = layout->registerOrAssignDim(m_args->m_referenceDomain,Dimension::Type::Unsigned8);
m_args->m_dim_src = layout->registerOrAssignDim(m_args->m_srcDomain,Dimension::Type::Unsigned8);
}
Expand All @@ -54,7 +54,7 @@ void RadiusSearchFilter::initialize()
throwError("The reference_domain must be given.");
if (m_args->m_radius <= 0)
throwError("Invalid 'radius' option: " + std::to_string(m_args->m_radius) + ", must be > 0");
if (m_args->m_nameAddAttribute.empty())
if (m_args->m_outputDimension.empty())
throwError("The output_name_attribut must be given.");
}

Expand Down
2 changes: 1 addition & 1 deletion src/filter_radius_assign/radius_assignFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PDAL_DLL RadiusSearchFilter : public Filter
std::string m_srcDomain;
double m_radius;
PointIdList m_ptsToUpdate;
std::string m_nameAddAttribute;
std::string m_outputDimension;
Dimension::Id m_dim;
bool search3d;
Dimension::Id m_dim_ref, m_dim_src;
Expand Down
2 changes: 1 addition & 1 deletion test/test_radius_assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def run_filter(arrays_las, distance_radius, search_3d, distance_cylinder=0. ):
"radius": distance_radius,
"src_domain": "SRS_DOMAIN",
"reference_domain": "REF_DOMAIN",
"output_name_attribute": "radius_search",
"output_dimension": "radius_search",
"search_3d": search_3d,
"search_2d_above": distance_cylinder,
"search_2d_bellow": distance_cylinder,
Expand Down

0 comments on commit 2d2b3f1

Please sign in to comment.