| 20 | } |
| 21 | |
| 22 | mitk::modelFit::Parameter::Pointer mitk::modelFit::ExtractParameterFromData(const mitk::BaseData* data) |
| 23 | { |
| 24 | if (!data) |
| 25 | { |
| 26 | return nullptr; |
| 27 | } |
| 28 | |
| 29 | mitk::modelFit::Parameter::Pointer param = mitk::modelFit::Parameter::New(); |
| 30 | |
| 31 | if (!data->GetPropertyList()->GetStringProperty(mitk::ModelFitConstants::PARAMETER_NAME_PROPERTY_NAME().c_str(), param->name)) |
| 32 | { |
| 33 | return nullptr; |
| 34 | }; |
| 35 | |
| 36 | param->image = dynamic_cast<const mitk::Image*>(data); |
| 37 | |
| 38 | if(!(param->image)) |
| 39 | { |
| 40 | return nullptr; |
| 41 | } |
| 42 | |
| 43 | std::string typeString; |
| 44 | data->GetPropertyList()->GetStringProperty(mitk::ModelFitConstants::PARAMETER_TYPE_PROPERTY_NAME().c_str(), typeString); |
| 45 | |
| 46 | if(typeString == mitk::ModelFitConstants::PARAMETER_TYPE_VALUE_DERIVED_PARAMETER()) |
| 47 | { |
| 48 | param->type = Parameter::DerivedType; |
| 49 | } |
| 50 | else if(typeString == mitk::ModelFitConstants::PARAMETER_TYPE_VALUE_CRITERION()) |
| 51 | { |
| 52 | param->type = Parameter::CriterionType; |
| 53 | } |
| 54 | else if(typeString == mitk::ModelFitConstants::PARAMETER_TYPE_VALUE_EVALUATION_PARAMETER()) |
| 55 | { |
| 56 | param->type = Parameter::EvaluationType; |
| 57 | } |
| 58 | else |
| 59 | { |
| 60 | param->type = Parameter::ParameterType; |
| 61 | } |
| 62 | |
| 63 | data->GetPropertyList()->GetStringProperty(mitk::ModelFitConstants::PARAMETER_UNIT_PROPERTY_NAME().c_str(), |
| 64 | param->unit); |
| 65 | data->GetPropertyList()->GetFloatProperty(mitk::ModelFitConstants::PARAMETER_SCALE_PROPERTY_NAME().c_str(), |
| 66 | param->scale); |
| 67 | |
| 68 | return param; |
| 69 | } |
| 70 |
nothing calls this directly
no test coverage detected