Skip to content

Commit

Permalink
expose other get/save labelspace overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanhhughes committed Jan 23, 2025
1 parent 836c9ed commit eaab6f2
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions python/bindings/src/spark_dsg_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ PYBIND11_MODULE(_dsg_bindings, module) {
},
"node"_a,
"unknown_name"_a = "UNKNOWN")
.def("__bool__", [](const Labelspace& labelspace) { return static_cast<bool>(labelspace); })
.def("__bool__",
[](const Labelspace& labelspace) { return static_cast<bool>(labelspace); })
.def_property_readonly("labels_to_names", &Labelspace::labels_to_names)
.def_property_readonly("names_to_labels", &Labelspace::names_to_labels);

Expand Down Expand Up @@ -982,6 +983,12 @@ PYBIND11_MODULE(_dsg_bindings, module) {
},
"layer"_a,
"partition"_a = 0)
.def(
"get_labelspace",
[](const DynamicSceneGraph& graph, const std::string& name) {
return Labelspace::fromMetadata(graph, name);
},
"name"_a)
.def(
"set_labelspace",
[](DynamicSceneGraph& graph,
Expand All @@ -990,7 +997,14 @@ PYBIND11_MODULE(_dsg_bindings, module) {
PartitionId partition) { labelspace.save(graph, layer, partition); },
"labelspace"_a,
"layer"_a,
"partition"_a = 0);
"partition"_a = 0)
.def(
"set_labelspace",
[](DynamicSceneGraph& graph,
const Labelspace& labelspace,
const std::string& name) { labelspace.save(graph, name); },
"labelspace"_a,
"name"_a);

/**************************************************************************************
* Zmq Interface
Expand Down

0 comments on commit eaab6f2

Please sign in to comment.