Medical Imaging Interaction Toolkit  2018.4.99-93926fb8
Medical Imaging Interaction Toolkit
mitkModelFitParameter.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #include "mitkModelFitParameter.h"
15 #include "mitkModelFitConstants.h"
16 
18  name (""), type(Parameter::ParameterType), unit(""), scale(1.0f)
19 {
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 
47  {
48  param->type = Parameter::DerivedType;
49  }
51  {
52  param->type = Parameter::CriterionType;
53  }
55  {
56  param->type = Parameter::EvaluationType;
57  }
58  else
59  {
60  param->type = Parameter::ParameterType;
61  }
62 
64  param->unit);
66  param->scale);
67 
68  return param;
69 }
70 
static const std::string PARAMETER_TYPE_VALUE_CRITERION()
Base of all data objects.
Definition: mitkBaseData.h:42
static const std::string PARAMETER_UNIT_PROPERTY_NAME()
MITKMODELFIT_EXPORT Parameter::Pointer ExtractParameterFromData(const mitk::BaseData *data)
Data class that stores all information about a modelfit parameter. Such a parameter is going to be fi...
static const std::string PARAMETER_TYPE_VALUE_DERIVED_PARAMETER()
Image class for storing images.
Definition: mitkImage.h:72
mitk::PropertyList::Pointer GetPropertyList() const
Get the data&#39;s property list.
static const std::string PARAMETER_NAME_PROPERTY_NAME()
static const std::string PARAMETER_TYPE_PROPERTY_NAME()
static const std::string PARAMETER_SCALE_PROPERTY_NAME()
static const std::string PARAMETER_TYPE_VALUE_EVALUATION_PARAMETER()