User interface

HERDOS software is mainly written in two languages, C++ and Python: C++ is primarily used to write low-level algorithm code to ensure high performance of the software; Python is mainly used to write high-level code to ensure flexibility of the software. SNiPER, based on the Python binding functionality provided by Boost.Python, implements mixed programming of C++ and Python. SNiPER kernel provides Python binding code for some commonly used C++ classes and functions, allowing these classes and functions to be directly called in Python scripts, thus achieving dynamic configuration of the software without the need for developers to understand the implementation details of Python binding.

In addition to Python binding, SNiPER provides the Property tool to enable passing parameters from Python scripts to C++ code. Developers can declare different types of Properties in algorithms or services to dynamically configure the software by passing parameter variables from Python to C++ at runtime. Currently, SNiPER supports three types of Properties, including:

  • Scalar type: mainly includes built-in variable types in C++, such as bool, int, float, double, and string, which can be directly defined using corresponding Scalar types in Python.

  • List of Scalar types: in C++ code, it is std::vector, i.e., an array of simple types, which can be defined using the corresponding type of list in Python.

  • Mapping of Scalar types: in C++ code, it is std::map, i.e., a mapping of simple types, which can be defined using the corresponding type of dictionary in Python.

By combining the above three types, most of the parameter configuration requirements can be achieved. In addition, for software with high complexity and a large number of configuration parameters, a configuration method based on JSON files is provided to ensure the repeatability of tasks.