Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkDescriptivePharmacokineticBrixModelTest.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 #include "mitkTestingMacros.h"
14 #include "mitkVector.h"
15 
17 
18 
19 
20 int mitkDescriptivePharmacokineticBrixModelTest(int /*argc*/ , char*[] /*argv[]*/){
21 
22  MITK_TEST_BEGIN("DescriptivePharmacokineticBrixModel")
23 
26  mitk::ModelBase::ParametersType testparameters(4);
27 
32 
33 
34 
35  for (int i = 0; i<22; ++i)
36  {
37  // time grid in seconds, 14s between frames
38  grid[i]=(double) 14*i;
39  }
40  //injection time in minutes --> 60s
41  double injectiontime = 0.5;
43  testmodel->SetTimeGrid(grid);
44  testmodel->SetTau(injectiontime);
45 
46  CPPUNIT_ASSERT_MESSAGE("Check number of parameters in Model.", 4 == testmodel->GetNumberOfParameters());
47  output = testmodel->GetSignal(testparameters);
48  //precision of output ?
49  MITK_TEST_CONDITION_REQUIRED(mitk::Equal(1,output[0], 1e-6, true)==true,"Check Output signal values - 0");
50  MITK_TEST_CONDITION_REQUIRED(mitk::Equal(1,output[4], 1e-6, true)==true,"Check Output signal values - 4");
51  MITK_TEST_CONDITION_REQUIRED(mitk::Equal(1.003338,output[5], 1e-6, true)==true,"Check Output signal values - 5");
52  MITK_TEST_CONDITION_REQUIRED(mitk::Equal(1.238392,output[6], 1e-6, true)==true,"Check Output signal values - 6");
53  MITK_TEST_CONDITION_REQUIRED(mitk::Equal(1.669835,output[7], 1e-6, true)==true,"Check Output signal values - 7");
54  MITK_TEST_CONDITION_REQUIRED(mitk::Equal(1.982948,output[8], 1e-6, true)==true,"Check Output signal values - 8");
55  MITK_TEST_CONDITION_REQUIRED(mitk::Equal(2.089685,output[9], 1e-6, true)==true,"Check Output signal values - 9");
56  MITK_TEST_CONDITION_REQUIRED(mitk::Equal(2.113611,output[10], 1e-6, true)==true,"Check Output signal values - 10");
57 
59 
60 }
ModelTraitsInterface::ParametersType ParametersType
Definition: mitkModelBase.h:59
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
itk::Array< double > TimeGridType
Definition: mitkModelBase.h:62
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
ModelTraitsInterface::ModelResultType ModelResultType
Definition: mitkModelBase.h:55
int mitkDescriptivePharmacokineticBrixModelTest(int, char *[])
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
and MITK_TEST_END()