MeVisLab Toolbox Reference
ParameterInfo

Overview

Example

Say, we want to disclose the parameterization of a class MyAlgorithm:

The header file of an example object we want to provide the parameter info of:

class MyAlgorithm : public BaseWithParameterInfo {
private:
ParameterInfo _getParameterInfo() const override;
int _exampleInt{ 4711 };
double _exampleDouble{ 47.11 };
std::string _exampleString{ "Some String" };
// Complex data types
ml::ImageVector _exampleImageVector{ 1, 2, 3, 4, 5, 6 };
ml::Vector3 _exampleFloatVector{ 1.1, 2.2, 3.3 };
ml::SubImageBox _exampleSubImageBox{ { 1, 2, 3, 4, 5, 6 }, { 1, 2, 3, 4, 5, 6 } };
};
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non existing export symbol.

In the MeVisLab network, we would want the ParameterInfoInspector module to show for that object:

{
"ExampleInt": 4711,
"ExampleDouble": 47.11,
"ExampleString": "Some String",
"ComplexDatatypes": {
"ExampleImageVector": [ 1, 2, 3, 4, 5, 6 ],
"ExampleFloatVector": [ 1.1, 2.2, 3.3 ],
"ExampleSubImageBox": [ [ 1, 2, 3, 4, 5, 6 ], [ 1, 2, 3, 4, 5, 6 ] ]
}
}

We could achieve this with this implementation in the corresponding source file:

// [...]
void MyAlgorithm::_getParameterInfo() const {
ParameterInfo pi;
// Values need to be (convertible to) QVariant. This is how it works:
pi[ "ExampleInt" ] = _exampleInt;
pi[ "ExampleDouble" ] = _exampleDouble;
pi[ "ExampleString" ] = QString::fromStdString( _exampleString );
ParameterInfo complexPi;
pi[ "ComplexDatatypes" ] = complexPi;
return pi;
}
ML_CLASS_SOURCE( MyAlgorithm, BaseWithParameterInfo )
// [...]
#define ML_CLASS_SOURCE(className, parentName)
This macro has to be put into the source file of a non-abstract class to implement the methods declar...
QVariantList ToQVariantList(const TImageVector< ValueType > &vec)
QVariantList FloatVectorToQVariantList(const FloatingPointVector< ValueType, N, DC > &vec)