[Ctk-developers] SlicerExecutionModel pull request: Parameter Serializer

Matt McCormick matt.mccormick at kitware.com
Thu Aug 22 01:08:00 EDT 2013


Hi,

I have created a pull request for the SlicerExecutionModel that could
use review [1].  This feature, which can optionally be enabled via
CMake, adds serialization/deserialization via JSON files capabilities
to CLI's.

>From the pull request:


Motivation
----------

The ability to store, restore, and programmatically manipulate
algorithm parameters has many benefits.  The set of parameters used in
an analysis can be archived for future reference or shared for
reproducibility purposes.  A collection of parameter sets tuned for
particular types of input data can be stored and restored.  If a
standard file format with libraries easily accessible across
programming languages is used to serialize the parameters, automated
exploration of the parameter space is possible.

This branch adds command line flags to serialize and deserialize the
parameters used by the Command Line Interface (CLI) in the JSON_ file
format.

Building
--------

Check out the *ParameterSerializer* branch of this repository.  During
CMake configuration, set *SlicerExecutionModel_USE_SERIALIZER* to *ON*
and the build paths to the jsoncpp-cmake_ and ParameterSerializer_
projects with *JsonCpp_DIR* and *ParameterSerializer_DIR*.

Implementation
--------------

Two new flags will be automatically added to all CLI's:

1) --serialize <std::string>
2) --deserialize <std::string>

The *--serialize* flag specifies the path to a JSON file where all the
parameters used in the current analysis will be **archived**.  The
*--deserialize* flag specifies the path to a JSON file created by the
*--parametersarchive* in a previous execution.  Parameters from the
previous execution will then be **restored** for the current analysis.

While the layout of the JSON file reflects the self-descriptive
metadata of the CLI XML file, it also contains *Value* entries for
each parameter.

Since parameters can be specified in different ways, an order of
precedence determines which specification is used in the analysis.
This order is, from highest to lowest:

1) Command line arguments.
2) Parameters restored from the JSON file.
3) The default parameter value in the CLI XML file.

Required parameters, such as positional arguments, must always be
specified on the command line even if `--deserialize` is given.



Your feedback is welcome.

Thanks,
Matt

[1] https://github.com/Slicer/SlicerExecutionModel/pull/20



More information about the Ctk-developers mailing list