25 node->SetName(
"Param1");
27 node->SetData(testImage);
57 inputNode->SetName(
"Input");
59 inputNode->SetData(image);
62 storage->Add(inputNode);
64 mitk::DataStorage::SetOfObjects::Pointer parents = mitk::DataStorage::SetOfObjects::New();
65 parents->push_back(inputNode);
70 node1->SetData(paramImage);
71 node1->SetName(
"Param1");
93 storage->Add(node1,parents);
97 node2->SetName(
"Param2");
99 node2->SetData(paramImage2);
121 storage->Add(node2, parents);
125 node3->SetName(
"Param_Other");
127 node3->SetData(paramImage3);
142 storage->Add(node3, parents);
151 mitk::modelFit::Parameter::Pointer p = mitk::modelFit::Parameter::New();
153 mitk::modelFit::ModelFitInfo::Pointer fit = mitk::modelFit::ModelFitInfo::New();
154 fit->AddParameter(p);
156 "Testing if AddParameter successfully adds a parameter.");
158 mitk::modelFit::Parameter::ConstPointer resultParam = fit->GetParameter(
"test",
161 "Testing if GetParameter returns NULL for wrong parameter.");
165 "Testing if GetParameter returns the correct parameter.");
170 "Testing if GetParameter returns the correct parameter with a " <<
171 "non-default type.");
175 "Testing if DeleteParameter fails for wrong parameter.");
179 "Testing if DeleteParameter successfully removes a parameter.");
191 "Testing if GetMandatoryProperty returns the correct value.");
196 "Testing if CreateFitInfoFromNode returns NULL for invalid node.");
199 "Testing if CreateFitInfoFromNode returns NULL for node with " <<
200 "missing properties.");
205 "Testing if CreateFitInfoFromNode returns a valid model fit info.");
207 resultFit->uid ==
"Fit1" &&
208 resultFit->fitName ==
"MyName1" &&
209 resultFit->modelType ==
"TestModels" &&
210 resultFit->modelName ==
"TestModel_1" &&
211 resultFit->function ==
""&&
212 resultFit->functionClassID ==
"ModelClass" &&
213 resultFit->x ==
"myX" &&
215 resultFit->xAxisUnit ==
"h" &&
217 resultFit->yAxisUnit ==
"kg" &&
218 resultFit->GetParameters().size() == 2,
219 "Testing if CreateFitInfoFromNode creates a fit with correct attributes.");
223 "Testing if param 1 exists.");
226 "Testing if param 1 is configured correctly.");
230 "Testing if param 2 exists.");
232 testNode = storage->GetNamedNode(
"Param2");
234 "Testing if param 2 is configured correctly.");
237 "Testing if GetNodesOfFit works correctly for Fit1");
240 "Testing if GetNodesOfFit works correctly for Fit1");
243 "Testing if GetNodesOfFit works correctly for unkown fits.");
246 "Testing if GetNodesOfFit works correctly for illegal calls.");
248 testNode = storage->GetNamedNode(
"Input");
252 uidSet.find(
"Fit1")!=uidSet.end() &&
253 uidSet.find(
"Fit2")!=uidSet.end(),
254 "Testing if GetFitUIDsOfNode works correctly.");
259 "Testing if GetFitUIDsOfNode works correctly with invalid node.");
264 "Testing if GetFitUIDsOfNode works correctly with invalid storage.");
MITKMODELFIT_EXPORT NodeUIDSetType GetFitUIDsOfNode(const mitk::DataNode *node, const mitk::DataStorage *storage)
mitk::DataNode::Pointer generateModelFitTestNode()
static const std::string FIT_TYPE_PROPERTY_NAME()
MITKMODELFIT_EXPORT DataStorage::SetOfObjects::ConstPointer GetNodesOfFit(const ModelFitInfo::UIDType &fitUID, const mitk::DataStorage *storage)
int mitkModelFitInfoTest(int, char *[])
static const std::string MODEL_TYPE_PROPERTY_NAME()
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
static const std::string YAXIS_NAME_PROPERTY_NAME()
static const std::string PARAMETER_UNIT_PROPERTY_NAME()
static const std::string MODEL_NAME_PROPERTY_NAME()
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
static const std::string XAXIS_NAME_VALUE_DEFAULT()
static const std::string YAXIS_NAME_VALUE_DEFAULT()
#define MITK_TEST_FOR_EXCEPTION(EXCEPTIONCLASS, STATEMENT)
Simplified version of MITK_TEST_FOR_EXCEPTION_BEGIN / END for a single statement. ...
static const std::string FIT_UID_PROPERTY_NAME()
mitk::StandaloneDataStorage::Pointer generateModelFitTestStorage()
static const std::string MODEL_FUNCTION_PROPERTY_NAME()
static const std::string PARAMETER_TYPE_VALUE_DERIVED_PARAMETER()
static const std::string XAXIS_NAME_PROPERTY_NAME()
static const std::string FIT_INPUT_IMAGEUID_PROPERTY_NAME()
NodeUIDType MITKMODELFIT_EXPORT EnsureModelFitUID(mitk::BaseData *data)
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 ...
mitk::Image::Pointer image
static const std::string MODEL_X_PROPERTY_NAME()
static const std::string MODEL_FUNCTION_CLASS_PROPERTY_NAME()
static const std::string PARAMETER_TYPE_VALUE_PARAMETER()
static const std::string YAXIS_UNIT_PROPERTY_NAME()
Class-specific exception for modelfits.
static const std::string FIT_TYPE_VALUE_PIXELBASED()
std::set< ModelFitInfo::UIDType > NodeUIDSetType
static const std::string FIT_NAME_PROPERTY_NAME()
static const std::string XAXIS_UNIT_PROPERTY_NAME()
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...
static const std::string PARAMETER_NAME_PROPERTY_NAME()
static const std::string PARAMETER_TYPE_PROPERTY_NAME()