Medical Imaging Interaction Toolkit  2018.4.99-6aa36ba9
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 
37  ppi->SetNameAndKey(name, key);
38 
40  }
41 
42  void registerProperty(const std::string& name, const std::string& key, const std::string& description, const PropertyPersistenceInfo::DeserializationFunctionType &deFnc, const PropertyPersistenceInfo::SerializationFunctionType &serFnc)
43  {
45 
47  ppi->SetNameAndKey(name, key);
48  ppi->SetDeserializationFunction(deFnc);
49  ppi->SetSerializationFunction(serFnc);
50 
52  }
53 
54  void Load(us::ModuleContext* /*context*/) override
55  {
56  //register relevant properties
57  registerProperty(mitk::ModelFitConstants::UID_PROPERTY_NAME(), "data_uid", "UID used to identify data in an MITK session.");
58 
60 
61  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).");
62  registerProperty(mitk::ModelFitConstants::PARAMETER_UNIT_PROPERTY_NAME(), "modelfit_parameter_unit", "Unit string of the Parameter. Is only used for display. Default value: \"\" (no unit)");
63  registerProperty(mitk::ModelFitConstants::PARAMETER_SCALE_PROPERTY_NAME(), "modelfit_parameter_scale", "Scaling of the parameter. Default value: 1.");
64  registerProperty(mitk::ModelFitConstants::PARAMETER_TYPE_PROPERTY_NAME(), "modelfit_parameter_type", "Type of the parameters. Default value: parameter. Other options: derived, criterion, evaluation.");
65 
66  registerProperty(mitk::ModelFitConstants::MODEL_TYPE_PROPERTY_NAME(), "modelfit_model_type", "Value specifies the type of model (helpfull for classification; e.g. MR perfusion)");
67  registerProperty(mitk::ModelFitConstants::MODEL_NAME_PROPERTY_NAME(), "modelfit_model_name", "Name of the specific fit. Only used for display.");
68  registerProperty(mitk::ModelFitConstants::MODEL_FUNCTION_PROPERTY_NAME(), "modelfit_model_function", "Functions string, that specifies the model and will be parsed, to plot the curves based on the parameter. Optional parameter that must not be set.");
69  registerProperty(mitk::ModelFitConstants::MODEL_FUNCTION_CLASS_PROPERTY_NAME(), "modelfit_model_functionClass", "ID of the model class implementation.");
70  registerProperty(mitk::ModelFitConstants::MODEL_X_PROPERTY_NAME(), "modelfit_model_x", "Value identifies the model type.");
71 
72  registerProperty(mitk::ModelFitConstants::XAXIS_NAME_PROPERTY_NAME(), "modelfit_xaxis_name", "Value identifies the model type.");
73  registerProperty(mitk::ModelFitConstants::XAXIS_UNIT_PROPERTY_NAME(), "modelfit_xaxis_unit", "Value identifies the model type.");
74 
75  registerProperty(mitk::ModelFitConstants::YAXIS_NAME_PROPERTY_NAME(), "modelfit_yaxis_name", "Value identifies the model type.");
76  registerProperty(mitk::ModelFitConstants::YAXIS_UNIT_PROPERTY_NAME(), "modelfit_yaxis_unit", "Value identifies the model type.");
77 
78  registerProperty(mitk::ModelFitConstants::FIT_UID_PROPERTY_NAME(), "modelfit_fit_uid", "Value identifies the model type.");
79  registerProperty(mitk::ModelFitConstants::FIT_NAME_PROPERTY_NAME(), "modelfit_fit_name", "Human readable name for the fit.");
80  registerProperty(mitk::ModelFitConstants::FIT_TYPE_PROPERTY_NAME(), "modelfit_fit_type", "Value identifies the model type.");
81  registerProperty(mitk::ModelFitConstants::FIT_INPUT_IMAGEUID_PROPERTY_NAME(), "modelfit_fit_input_imageUID", "Value identifies the model type.");
82  registerProperty(mitk::ModelFitConstants::FIT_INPUT_ROIUID_PROPERTY_NAME(), "modelfit_fit_input_roiUID", "Value identifies the model type.");
83  registerProperty(mitk::ModelFitConstants::FIT_INPUT_DATA_PROPERTY_NAME(), "modelfit_fit_input_data", "Value identifies the model type.");
85  }
86 
87  void Unload(us::ModuleContext* ) override
88  {
89  }
90 
91 private:
92 
93 };
94 }
95 
96 US_EXPORT_MODULE_ACTIVATOR(mitk::ModelFitIOActivator)
MITKMODELFIT_EXPORT mitk::BaseProperty::Pointer deserializeXMLToScalarListLookupTableProperty(const std::string &value)
static const std::string FIT_TYPE_PROPERTY_NAME()
virtual bool AddDescription(const std::string &propertyName, const std::string &description, const std::string &className="", bool overwrite=false)=0
Add a description for a specific property.
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()
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 FIT_INPUT_IMAGEUID_PROPERTY_NAME()
static const std::string UID_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()
virtual bool AddInfo(const PropertyPersistenceInfo *info, bool overwrite=false)=0
Add persistence info for a specific base data property. If there is already a property info instance ...
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