ReconstructMe SDK  2.6.43-0
Real-time 3D reconstruction engine
example_reconstructmesdk_options.cpp

Content

This example shows how to modify options.

Boost is only used to generate examples and is not necessary for working with this SDK.

#include <boost/test/unit_test.hpp>
#include <stdio.h>
#include <cstdlib>
BOOST_AUTO_TEST_SUITE(example_reconstructmesdk)
BOOST_AUTO_TEST_CASE(options) {
// Create a new context that has default options applied
// By default, each object comes with a set of sensible
// predefined values. In this example compile time options.
// Create empty options binding, not bound to any specific options
// Bind the reconstruction options.
int res;
reme_options_get_int(c, o, "volume.resolution.x", &res);
printf("Volume size in x-dim is: %i", res);
// Increase resolution in all dimensions
reme_options_set_int(c, o, "volume.resolution.x", 512);
reme_options_set_int(c, o, "volume.resolution.y", 512);
reme_options_set_int(c, o, "volume.resolution.z", 512);
// Export options in a human read-able format
reme_options_save_to_file(c, o, "options.txt");
// Export options in a human read-able format
reme_options_load_from_file(c, o, "options.txt");
// Print pending errors
// Make sure to release all memory acquired
}
BOOST_AUTO_TEST_CASE(options_repeated) {
// Create a new context that has default options applied
// Create empty options binding
reme_options_t o, o_sub;
reme_options_create(c, &o_sub);
// Bind to OpenCL infos
// See method documentation for protocol buffer specification
// See how many devices are available
int num_devices = 0;
reme_options_get_repeated_count(c, o, "devices", &num_devices);
printf("Found %i OpenCL compatible devices\n", num_devices);
// Each device is a nested message. Iterate over all of them
char name[256], vendor[256], type[256];
for (int i = 0; i < num_devices; i += 1) {
printf("----\n");
reme_options_bind_repeated_message(c, o, "devices", i, o_sub);
reme_options_get(c, o_sub, "name", name, 256);
reme_options_get(c, o_sub, "vendor", vendor, 256);
reme_options_get(c, o_sub, "type", type, 256);
printf("Device '%s' \n", name);
printf(" - by '%s' \n", vendor);
printf(" - type %s \n", type);
}
// Print pending errors
// Make sure to release all memory acquired
}
BOOST_AUTO_TEST_SUITE_END()