25 mitkThrow() <<
"Given parameter must not be NULL";
30 MITK_DEBUG <<
"Adding parameter '" << p->name <<
"with type " << p->type
31 <<
"' to modelFit '" <<
uid <<
"'.";
34 parameterList.push_back(p);
38 MITK_DEBUG <<
"Parameter '" << p->name <<
"' of modelFit '" <<
uid 39 <<
"' already exists. Aborting.";
43 mitk::modelFit::Parameter::ConstPointer
47 for (
ConstIterType iter = parameterList.begin(); iter != parameterList.end(); ++iter)
49 Parameter::ConstPointer p =
static_cast<Parameter::ConstPointer
>(*iter);
51 if (p->name == name && p->type == type)
64 return this->parameterList;
70 for (IterType iter = parameterList.begin(); iter != parameterList.end(); ++iter)
72 Parameter::ConstPointer p =
static_cast<Parameter::ConstPointer
>(*iter);
74 if (p->name == name && p->type == type)
76 MITK_DEBUG <<
"Deleting parameter '" << name <<
" with type " << type
77 <<
"' from modelFit '" <<
uid <<
"'.";
80 parameterList.erase(iter);
88 const std::string& prop)
92 if (!node || !node->
GetData() ||
96 <<
" is lacking the required " 97 <<
"property '" << prop
98 <<
"' or contains an empty string.";
105 const std::string& prop)
109 if (!data || !data->
GetPropertyList()->GetStringProperty(prop.c_str(), result) || result.empty())
112 <<
"property '" << prop
113 <<
"' or contains an empty string.";
119 mitk::modelFit::ModelFitInfo::Pointer
128 mitk::DataStorage::SetOfObjects::ConstPointer nodes =
GetNodesOfFit(uid, storage);
130 if (nodes.IsNull() || nodes->empty())
138 if (!node->GetData())
143 ModelFitInfo::Pointer fit = ModelFitInfo::New();
168 fit->functionClassID =
173 if (fit->function.empty())
178 <<
"' are both empty or missing. One of these is required.";
191 for (DataStorage::SetOfObjects::ConstIterator pos = nodes->Begin(); pos != nodes->End(); ++pos)
195 if (param.IsNotNull())
197 fit->AddParameter(param);
204 if (varProp.IsNotNull())
209 for (mitk::ScalarListLookupTable::LookupTableType::const_iterator mapIter =
210 varMap.begin(); mapIter != varMap.end(); ++mapIter)
212 fit->staticParamMap.Add(mapIter->first, mapIter->second);
232 if (inputNode.IsNull())
234 MITK_ERROR <<
"Cannot create valid model fit info. input node cannot be found.";
240 if (inputImage.IsNull())
242 MITK_ERROR <<
"Cannot create valid model fit info. input node does not contain an image.";
253 if (inputDataProp.IsNotNull())
255 fit->inputData = inputDataProp->GetValue();
261 mitk::modelFit::ModelFitInfo::Pointer
266 if (!usedParameterizer)
274 ModelFitInfo::Pointer fit = ModelFitInfo::New();
281 if (fit->inputImage.IsNull())
283 mitkThrow() <<
"Cannot generate model fit info. Input node does not contain an image.";
290 fit->x = usedParameterizer->
GetXName();
291 fit->functionClassID = usedParameterizer->
GetClassID();
303 for (ModelTraitsInterface::ParameterNamesType::iterator pos = paramNames.begin();
304 pos != paramNames.end(); ++pos)
306 modelFit::Parameter::Pointer param = modelFit::Parameter::New();
310 if (paramScales.find(*pos) == paramScales.end())
313 "Cannot generate model fit info. Model traits invalid (scales do not include parameter). Parameter name: " 317 if (paramUnits.find(*pos) == paramUnits.end())
320 "Cannot generate model fit info. Model traits invalid (units do not include parameter). Parameter name: " 324 param->scale = paramScales[*pos];
325 param->unit = paramUnits[*pos];
326 fit->AddParameter(param);
337 for (ModelTraitsInterface::ParameterNamesType::iterator pos = derivedNames.begin();
338 pos != derivedNames.end(); ++pos)
340 modelFit::Parameter::Pointer param = modelFit::Parameter::New();
344 if (derivedScales.find(*pos) == derivedScales.end())
347 "Cannot generate model fit info. Model traits invalid (scales do not include parameter). Parameter name: " 351 if (derivedUnits.find(*pos) == derivedUnits.end())
354 "Cannot generate model fit info. Model traits invalid (units do not include parameter). Parameter name: " 358 param->scale = derivedScales[*pos];
359 param->unit = derivedUnits[*pos];
360 fit->AddParameter(param);
367 for (ModelParameterizerBase::StaticParameterMapType::const_iterator pos = staticParamMap.begin();
368 pos != staticParamMap.end(); ++pos)
370 fit->staticParamMap.Add(pos->first, pos->second);
379 mitk::modelFit::ModelFitInfo::Pointer
385 inputImage, fitType, fitName, roiUID);
392 mitk::DataStorage::SetOfObjects::ConstPointer
415 mitk::DataStorage::SetOfObjects::ConstPointer nodes = storage->
GetDerivations(node, predicate,
418 for (mitk::DataStorage::SetOfObjects::ConstIterator pos = nodes->Begin(); pos != nodes->End();
MITKMODELFIT_EXPORT NodeUIDSetType GetFitUIDsOfNode(const mitk::DataNode *node, const mitk::DataStorage *storage)
void DeleteParameter(const std::string &name, const Parameter::Type &type)
Searches for the parameter with the given name and type in the fit's parameter list and deletes it if...
virtual StaticParameterMapType GetGlobalStaticParameters() const =0
virtual DerivedParamterScaleMapType GetDerivedParameterScales() const =0
static const std::string FIT_TYPE_PROPERTY_NAME()
Data management class that handles 'was created by' relations.
MITKMODELFIT_EXPORT DataStorage::SetOfObjects::ConstPointer GetNodesOfFit(const ModelFitInfo::UIDType &fitUID, const mitk::DataStorage *storage)
virtual ModellClassIDType GetClassID() const =0
virtual SetOfObjects::ConstPointer GetDerivations(const DataNode *node, const NodePredicateBase *condition=nullptr, bool onlyDirectDerivations=true) const =0
returns a set of derived objects for a given node.
Base of all data objects.
std::map< ParameterNameType, double > DerivedParamterScaleMapType
virtual ParamterUnitMapType GetParameterUnits() const =0
static const std::string MODEL_TYPE_PROPERTY_NAME()
DataNode::Pointer MITKMODELFIT_EXPORT GetNodeByModelFitUID(const mitk::DataStorage *storage, const NodeUIDType &uid)
virtual std::string GetXAxisUnit() const =0
static const std::string YAXIS_NAME_PROPERTY_NAME()
std::map< ParameterNameType, double > ParamterScaleMapType
Parameter::ConstPointer GetParameter(const std::string &name, const Parameter::Type &type) const
Searches for the parameter with the given name and type in the fit's parameter list and returns it...
static const std::string MODEL_NAME_PROPERTY_NAME()
mitk::NodeUIDType UIDType
mitk::Image::Pointer inputImage
MITKMODELFIT_EXPORT Parameter::Pointer ExtractParameterFromData(const mitk::BaseData *data)
Data class for modelfit properties that store a map of lists (e.g. static parameters).
StaticParameterMap staticParamMap
static void info(const char *fmt,...)
static const std::string FIT_UID_PROPERTY_NAME()
MITKMODELFIT_EXPORT ModelFitInfo::Pointer CreateFitInfoFromModelParameterizer(const ModelParameterizerBase *usedParameterizer, mitk::BaseData *inputImage, const std::string &fitType, const std::string &fitName="", const NodeUIDType roiUID="")
static const std::string MODEL_FUNCTION_PROPERTY_NAME()
void AddParameter(Parameter::Pointer p)
Adds the given parameter to this fit's parameter list if it doesn't exist already.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
std::vector< ParameterNameType > ParameterNamesType
ParameterNamesType DerivedParameterNamesType
static const std::string FIT_INPUT_DATA_PROPERTY_NAME()
virtual ParameterNamesType GetParameterNames() const =0
static const std::string XAXIS_NAME_PROPERTY_NAME()
SetOfObjects::ConstPointer GetSubset(const NodePredicateBase *condition) const
returns a set of data objects that meet the given condition(s)
virtual ParamterScaleMapType GetParameterScales() const =0
Image class for storing images.
static const std::string FIT_INPUT_IMAGEUID_PROPERTY_NAME()
NodeUIDType MITKMODELFIT_EXPORT EnsureModelFitUID(mitk::BaseData *data)
static Pointer New(const char *_arg)
virtual std::string GetYAxisName() const =0
MITKMODELFIT_EXPORT ModelFitInfo::Pointer CreateFitInfoFromNode(const ModelFitInfo::UIDType &uid, const mitk::DataStorage *storage)
Creates a new ModelFitInfo instance from the nodes in the passed storage. The fit will be identified ...
virtual std::string GetXName() const =0
static const std::string MODEL_X_PROPERTY_NAME()
const LookupTableType & GetLookupTable() const
Returns the map of lists.
mitk::PropertyList::Pointer GetPropertyList() const
Get the data's property list.
static const std::string MODEL_FUNCTION_CLASS_PROPERTY_NAME()
virtual std::string GetXAxisName() const =0
virtual FunctionStringType GetFunctionString() const =0
#define mitkThrowException(classname)
virtual std::string GetModelDisplayName() const =0
static const std::string FIT_INPUT_ROIUID_PROPERTY_NAME()
static const std::string YAXIS_UNIT_PROPERTY_NAME()
Class-specific exception for modelfits.
ScalarListLookupTable inputData
static const std::string FIT_STATIC_PARAMETERS_PROPERTY_NAME()
std::set< ModelFitInfo::UIDType > NodeUIDSetType
ParamListType::const_iterator ConstIterType
static const std::string FIT_NAME_PROPERTY_NAME()
const ParamListType & GetParameters() const
static const std::string XAXIS_UNIT_PROPERTY_NAME()
ModelBaseType::StaticParameterMapType StaticParameterMapType
virtual std::string GetModelType() const =0
std::vector< Parameter::Pointer > ParamListType
MITKMODELFIT_EXPORT const std::string GetMandatoryProperty(const mitk::DataNode *node, const std::string &prop)
Reads the string property with the given name from the data of the given node and returns its value...
std::map< ParameterNameType, std::string > ParamterUnitMapType
std::map< KeyType, ValueType > LookupTableType
virtual std::string GetYAxisUnit() const =0
Class for nodes of the DataTree.
bool GetName(std::string &nodeName, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="name") const
Convenience access method for accessing the name of an object (instance of StringProperty with proper...
std::map< ParameterNameType, std::string > DerivedParamterUnitMapType
virtual DerivedParameterNamesType GetDerivedParameterNames() const =0
virtual DerivedParamterUnitMapType GetDerivedParameterUnits() const =0