Medical Imaging Interaction Toolkit  2018.4.99-eed36131
Medical Imaging Interaction Toolkit
mitkModelFitIOActivator.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 <usModuleActivator.h>
15 #include <usModuleContext.h>
16 
17 #include <mitkCoreServices.h>
20 #include <mitkModelFitConstants.h>
22 
23 namespace mitk
24 {
25 
26 /*
27  * This is the module activator for the IO aspects of the "ModelFit" module.
28  */
29 class ModelFitIOActivator : public us::ModuleActivator
30 {
31 public:
32  void registerProperty(const std::string& name, const std::string& key, const std::string& description)
33  {
35  propDescService->AddDescription(name, description);
36 
38  ppi->SetNameAndKey(name, key);
39 
41  propPersistenceService->AddInfo(ppi, true);
42  }
43 
44  void registerProperty(const std::string& name, const std::string& key, const std::string& description, const PropertyPersistenceInfo::DeserializationFunctionType &deFnc, const PropertyPersistenceInfo::SerializationFunctionType &serFnc)
45  {
47  propDescService->AddDescription(name, description);
48 
50  ppi->SetNameAndKey(name, key);
51  ppi->SetDeserializationFunction(deFnc);
52  ppi->SetSerializationFunction(serFnc);
53 
55  propPersistenceService->AddInfo(ppi, true);
56  }
57 
58  void Load(us::ModuleContext* /*context*/) override
59  {
60  //register relevant properties
62 
63  registerProperty(mitk::ModelFitConstants::PARAMETER_NAME_PROPERTY_NAME(), "modelfit_parameter_name", "Name of the parameter, that is represented by the data and how it is used in the function string (modelfit.model.function).");
64  registerProperty(mitk::ModelFitConstants::PARAMETER_UNIT_PROPERTY_NAME(), "modelfit_parameter_unit", "Unit string of the Parameter. Is only used for display. Default value: \"\" (no unit)");
65  registerProperty(mitk::ModelFitConstants::PARAMETER_SCALE_PROPERTY_NAME(), "modelfit_parameter_scale", "Scaling of the parameter. Default value: 1.");
66  registerProperty(mitk::ModelFitConstants::PARAMETER_TYPE_PROPERTY_NAME(), "modelfit_parameter_type", "Type of the parameters. Default value: parameter. Other options: derived, criterion, evaluation.");
67 
68  registerProperty(mitk::ModelFitConstants::MODEL_TYPE_PROPERTY_NAME(), "modelfit_model_type", "Value specifies the type of model (helpfull for classification; e.g. MR perfusion)");
69  registerProperty(mitk::ModelFitConstants::MODEL_NAME_PROPERTY_NAME(), "modelfit_model_name", "Name of the specific fit. Only used for display.");
70  registerProperty(mitk::ModelFitConstants::MODEL_FUNCTION_PROPERTY_NAME(), "modelfit_model_function", "Function string, that specifies the model and will be parsed, to plot the curves based on the parameter. Optional parameter that must not be set.");
71  registerProperty(mitk::ModelFitConstants::MODEL_FUNCTION_CLASS_PROPERTY_NAME(), "modelfit_model_functionClass", "ID of the model class implementation.");
72  registerProperty(mitk::ModelFitConstants::MODEL_X_PROPERTY_NAME(), "modelfit_model_x", "Name of the forumar parameter 'x', that is specified on the x axis. Only needed if model function string is set and formular must be parsed.");
73 
74  registerProperty(mitk::ModelFitConstants::XAXIS_NAME_PROPERTY_NAME(), "modelfit_xaxis_name", "Display name of the x axis.");
75  registerProperty(mitk::ModelFitConstants::XAXIS_UNIT_PROPERTY_NAME(), "modelfit_xaxis_unit", "Unit of the x axis.");
76 
77  registerProperty(mitk::ModelFitConstants::YAXIS_NAME_PROPERTY_NAME(), "modelfit_yaxis_name", "Display name of the y axis.");
78  registerProperty(mitk::ModelFitConstants::YAXIS_UNIT_PROPERTY_NAME(), "modelfit_yaxis_unit", "Unit of the y axis.");
79 
80  registerProperty(mitk::ModelFitConstants::FIT_UID_PROPERTY_NAME(), "modelfit_fit_uid", "UID of the fit.");
81  registerProperty(mitk::ModelFitConstants::FIT_NAME_PROPERTY_NAME(), "modelfit_fit_name", "Human readable name for the fit.");
82  registerProperty(mitk::ModelFitConstants::FIT_TYPE_PROPERTY_NAME(), "modelfit_fit_type", "Type of the fit (e.g. ROI based or pixel based).");
83  registerProperty(mitk::ModelFitConstants::FIT_INPUT_ROIUID_PROPERTY_NAME(), "modelfit_fit_input_roiUID", "UID of the ROI used for the fit.");
84  registerProperty(mitk::ModelFitConstants::FIT_INPUT_DATA_PROPERTY_NAME(), "modelfit_fit_input_data", "Property containing input data directly stored in the fit information.");
86 
87  //legacy properties for backwards compatibility
88  registerProperty(mitk::ModelFitConstants::LEGACY_UID_PROPERTY_NAME(), "data_uid", "UID used to identify data in an MITK session.");
89  registerProperty(mitk::ModelFitConstants::LEGACY_FIT_INPUT_IMAGEUID_PROPERTY_NAME(), "modelfit_fit_input_imageUID", "UID of the input image that used to fit the model.");
90  }
91 
92  void Unload(us::ModuleContext* ) override
93  {
94  }
95 
96 };
97 }
98 
99 US_EXPORT_MODULE_ACTIVATOR(mitk::ModelFitIOActivator)
MITKMODELFIT_EXPORT mitk::BaseProperty::Pointer deserializeXMLToScalarListLookupTableProperty(const std::string &value)
static const std::string FIT_TYPE_PROPERTY_NAME()
static const std::string LEGACY_FIT_INPUT_IMAGEUID_PROPERTY_NAME()
static const std::string MODEL_TYPE_PROPERTY_NAME()
static const std::string YAXIS_NAME_PROPERTY_NAME()
static const std::string PARAMETER_UNIT_PROPERTY_NAME()
DataCollection - Class to facilitate loading/accessing structured data.
static const std::string MODEL_NAME_PROPERTY_NAME()
static const std::string LEGACY_UID_PROPERTY_NAME()
virtual void Unload(ModuleContext *context)=0
static const std::string FIT_UID_PROPERTY_NAME()
static IPropertyDescriptions * GetPropertyDescriptions(us::ModuleContext *context=us::GetModuleContext())
Get an IPropertyDescriptions instance.
static const std::string INPUT_VARIABLES_PROPERTY_NAME()
static const std::string MODEL_FUNCTION_PROPERTY_NAME()
std::function< mitk::BaseProperty::Pointer(const std::string &)> DeserializationFunctionType
static IPropertyPersistence * GetPropertyPersistence(us::ModuleContext *context=us::GetModuleContext())
Get an IPropertyPersistence instance.
static const std::string FIT_INPUT_DATA_PROPERTY_NAME()
static const std::string XAXIS_NAME_PROPERTY_NAME()
static const std::string MODEL_X_PROPERTY_NAME()
static const std::string MODEL_FUNCTION_CLASS_PROPERTY_NAME()
static const std::string FIT_INPUT_ROIUID_PROPERTY_NAME()
static const std::string YAXIS_UNIT_PROPERTY_NAME()
static const std::string FIT_STATIC_PARAMETERS_PROPERTY_NAME()
static const std::string FIT_NAME_PROPERTY_NAME()
A RAII helper class for core service objects.
static const std::string XAXIS_UNIT_PROPERTY_NAME()
#define US_EXPORT_MODULE_ACTIVATOR(_activator_type)
Export a module activator class.
static const std::string PARAMETER_NAME_PROPERTY_NAME()
static const std::string PARAMETER_TYPE_PROPERTY_NAME()
virtual void Load(ModuleContext *context)=0
MITKMODELFIT_EXPORT ::std::string serializeScalarListLookupTablePropertyToXML(const mitk::BaseProperty *prop)
static const std::string PARAMETER_SCALE_PROPERTY_NAME()
std::function< std::string(const mitk::BaseProperty *)> SerializationFunctionType