mp2p_icp_filters
src
FilterDeleteLayer.cpp
Go to the documentation of this file.
1
/* -------------------------------------------------------------------------
2
* A repertory of multi primitive-to-primitive (MP2P) ICP algorithms in C++
3
* Copyright (C) 2018-2024 Jose Luis Blanco, University of Almeria
4
* See LICENSE for license information.
5
* ------------------------------------------------------------------------- */
13
#include <
mp2p_icp_filters/FilterDeleteLayer.h
>
14
#include <mrpt/containers/yaml.h>
15
16
IMPLEMENTS_MRPT_OBJECT
(
17
FilterDeleteLayer,
mp2p_icp_filters::FilterBase
,
mp2p_icp_filters
)
18
19
using namespace
mp2p_icp_filters
;
20
21
void
FilterDeleteLayer::Parameters::load_from_yaml
(
22
const
mrpt::containers::yaml& c)
23
{
24
ASSERTMSG_(
25
c.has(
"pointcloud_layer_to_remove"
),
26
"YAML configuration must have an entry `pointcloud_layer_to_remove` "
27
"with a "
28
"scalar or sequence."
);
29
30
pointcloud_layer_to_remove
.clear();
31
32
auto
cfgIn = c[
"pointcloud_layer_to_remove"
];
33
if
(cfgIn.isScalar())
34
{
35
pointcloud_layer_to_remove
.push_back(cfgIn.as<
std::string
>());
36
}
37
else
38
{
39
ASSERTMSG_(
40
cfgIn.isSequence(),
41
"YAML configuration must have an entry "
42
"`pointcloud_layer_to_remove` "
43
"with a scalar or sequence."
);
44
45
for
(
const
auto
&
s
: cfgIn.asSequence())
46
pointcloud_layer_to_remove
.push_back(
s
.as<
std::string
>());
47
}
48
ASSERT_(!
pointcloud_layer_to_remove
.empty());
49
50
MCP_LOAD_OPT(c,
error_on_missing_input_layer
);
51
}
52
53
FilterDeleteLayer::FilterDeleteLayer
()
54
{
55
mrpt::system::COutputLogger::setLoggerName(
"FilterDeleteLayer"
);
56
}
57
58
void
FilterDeleteLayer::initialize
(
const
mrpt::containers::yaml& c)
59
{
60
MRPT_START
61
62
MRPT_LOG_DEBUG_STREAM(
"Loading these params:\n"
<< c);
63
params_
.
load_from_yaml
(c);
64
65
MRPT_END
66
}
67
68
void
FilterDeleteLayer::filter
(
mp2p_icp::metric_map_t
& inOut)
const
69
{
70
MRPT_START
71
72
for
(
const
auto
& layer :
params_
.
pointcloud_layer_to_remove
)
73
{
74
const
auto
nRemoved = inOut.
layers
.erase(layer);
75
76
if
(
params_
.
error_on_missing_input_layer
)
77
{
78
ASSERTMSG_(
79
nRemoved != 0,
80
mrpt::format(
81
"Point cloud layer '%s' was not found."
, layer.c_str()));
82
}
83
MRPT_LOG_DEBUG_STREAM(
"Deleted layer: '"
<< layer <<
"'"
);
84
}
85
MRPT_END
86
}
mp2p_icp_filters::FilterDeleteLayer::Parameters::error_on_missing_input_layer
bool error_on_missing_input_layer
Definition:
FilterDeleteLayer.h:47
mp2p_icp_filters::FilterDeleteLayer::initialize
void initialize(const mrpt::containers::yaml &c) override
Definition:
FilterDeleteLayer.cpp:58
FilterDeleteLayer.h
Removes a given point layer.
mp2p_icp_filters::FilterDeleteLayer::FilterDeleteLayer
FilterDeleteLayer()
Definition:
FilterDeleteLayer.cpp:53
s
XmlRpcServer s
testing::internal::string
::std::string string
Definition:
gtest.h:1979
IMPLEMENTS_MRPT_OBJECT
IMPLEMENTS_MRPT_OBJECT(FilterDeleteLayer, mp2p_icp_filters::FilterBase, mp2p_icp_filters) using namespace mp2p_icp_filters
mp2p_icp_filters::FilterDeleteLayer::Parameters::load_from_yaml
void load_from_yaml(const mrpt::containers::yaml &c)
Definition:
FilterDeleteLayer.cpp:21
mp2p_icp_filters::FilterBase
Definition:
FilterBase.h:46
mp2p_icp_filters::FilterDeleteLayer::filter
void filter(mp2p_icp::metric_map_t &inOut) const override
Definition:
FilterDeleteLayer.cpp:68
mp2p_icp_filters::FilterDeleteLayer::params_
Parameters params_
Definition:
FilterDeleteLayer.h:51
mp2p_icp::metric_map_t
Generic container of pointcloud(s), extracted features and other maps.
Definition:
metricmap.h:49
mp2p_icp::metric_map_t::layers
std::map< layer_name_t, mrpt::maps::CMetricMap::Ptr > layers
Definition:
metricmap.h:76
mp2p_icp_filters
Definition:
FilterAdjustTimestamps.h:19
mp2p_icp_filters::FilterDeleteLayer::Parameters::pointcloud_layer_to_remove
std::vector< std::string > pointcloud_layer_to_remove
Definition:
FilterDeleteLayer.h:42
mp2p_icp
Author(s):
autogenerated on Thu Dec 26 2024 03:48:10