10 #include <json/json.h>
15 value[
"class_name"] =
"AlignmentSession";
16 value[
"version_major"] = 1;
17 value[
"version_minor"] = 0;
18 Json::Value source_array;
20 source_array.append((
int)si);
22 value[
"source_indices"] = source_array;
23 Json::Value target_array;
25 target_array.append((
int)ti);
27 value[
"target_indices"] = target_array;
38 if (!value.isObject()) {
40 "AlignmentSession read JSON failed: unsupported json "
44 if (value.get(
"class_name",
"").asString() !=
"AlignmentSession" ||
45 value.get(
"version_major", 1).asInt() != 1 ||
46 value.get(
"version_minor", 0).asInt() != 0) {
48 "AlignmentSession read JSON failed: unsupported json "
52 const auto &source_array = value[
"source_indices"];
54 for (
int i = 0; i < (int)source_array.size(); i++) {
57 const auto &target_array = value[
"target_indices"];
59 for (
int i = 0; i < (int)target_array.size(); i++) {
67 value[
"max_correspondence_distance"].asDouble();
double max_correspondence_distance_
std::vector< size_t > source_indices_
Eigen::Matrix4d_u transformation_
bool ConvertFromJsonValue(const Json::Value &value) override
std::vector< size_t > target_indices_
bool ConvertToJsonValue(Json::Value &value) const override
static bool EigenMatrix4dFromJsonArray(Eigen::Matrix4d &mat, const Json::Value &value)
static bool EigenMatrix4dToJsonArray(const Eigen::Matrix4d &mat, Json::Value &value)
Generic file read and write utility for python interface.