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:
ML_START_NAMESPACE
class MyAlgorithm : public BaseWithParameterInfo {
private:
ParameterInfo _getParameterInfo() const override;
int _exampleInt{ 4711 };
double _exampleDouble{ 47.11 };
std::string _exampleString{ "Some String" };
ml::SubImageBox _exampleSubImageBox{ { 1, 2, 3, 4, 5, 6 }, { 1, 2, 3, 4, 5, 6 } };
};
ML_END_NAMESPACE
#define ML_CLASS_HEADER(className)
Tvec3< MLdouble > Vector3
A vector with three components of type double.
TSubImageBox< MLint > SubImageBox
Defines the standard SubImageBox type used in the ML. Its size varies with the size of the MLint type...
TImageVector< MLint > ImageVector
Defines the standard ImageVector type that is used by the ML for indexing and coordinates.
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;
pi[ "ExampleInt" ] = _exampleInt;
pi[ "ExampleDouble" ] = _exampleDouble;
pi[ "ExampleString" ] = QString::fromStdString( _exampleString );
ParameterInfo complexPi;
pi[ "ComplexDatatypes" ] = complexPi;
return pi;
}
#define ML_CLASS_SOURCE(className, parentName)
QVariantList ToQVariantList(const TImageVector< ValueType > &vec)
QVariantList FloatVectorToQVariantList(const FloatingPointVector< ValueType, N, DC > &vec)