ReconstructMe SDK
2.0.819-89134
Real-time 3D reconstruction engine
|
How to interact with options in a generic way through reme_options_t
Accessing and manipulating options/parameters is central to every application. The Options interface provides methods to interact and manipulate parameters and options generic way in ReconstructMe API.
The reme_options_t represents a generic options handle. Once created it is said to be empty, as it does not represent any specific options. In order to manipulate specific options, you need to bind it to a specific options using a specific function that usually carries bind
in its function name. The page Options Bindings lists all known binders. Each binder documents the available parameters in the method's detail section using Google Protocol Buffer format.
Once the options object is bound, it directly manipulates the bound options. You can query values using reme_options_get, manipulate values using reme_options_set, or export/import options from and to files using reme_options_save_to_file and reme_options_load_from_file.
Following is an example to adjust reconstruction settings which contain settings for the volume, the resolution and specific algorithm parameters. See reme_context_bind_reconstruction_options for details.
First create context. This will initialize the reconstruction options with sensible default values.
Next create an empty options object, not bound to any parameters.
In order to manipulate and access specific options it needs to be bound. In our case to reconstruction options.
Think about the binding as a pointer to the internal options set. Every action we take on the options object reflects directly to the internal options set and as such influences the outcome of reme_context_compile.
We can read values
Or write to individual option fields
Options can be saved using a human read-able format
And restored at a later point in time
In case the options specification contains repeated fields such as the OpenCL informations below
use the repeated methods to access these fields.
All the above examples had in common that they were using a lazy-reflection based API through strings. ReconstructMe API allows you to use an alternative, type-safe approach using Google Protocol Buffers directly.
Using Google Protocol Buffers directly you can compile a getter/setter object for the programming language of your choice and use the built-in serialization mechanism to get a nice way to interop between your programming language and ReconstructMe API. Such compilers exist for all modern languanges such as C, C++, Java and .NET. See https://developers.google.com/protocol-buffers/ for details.
Here's an example of the type safe approach in C++ using the compile settings. It requires the generation of the class poisson_options
through the use of protoc
which ships with Google Protocol Buffers. The compiler protoc
is invoked with the protocol buffer description (see reme_surface_bind_poisson_options) and it produces header and source files containing the class poisson_options
. This class can then be used in your project.
First create the context and your options object as usual
Next bind the options
Now use the generated poisson_options
class
To transfer the state of poisson_options
to our reme_options_t we can use the built-in serialization mechnisms. This allows us to effectively serialize/deserialize option objects from string like buffers.
To read the current state of the Poisson options back to your poisson_options
instance use