Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkLinkModels.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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include <mitkLinkModels.h>
18 #include <cmath>
19 #include <limits>
20 
22 {
23  lowerBound = std::log( std::numeric_limits<double>::epsilon());
24  upperBound = -lowerBound;
25 }
26 
27 double mitk::LogItLinking::Link(double mu)
28 {
29  return std::log(mu / (1 - mu));
30 }
31 
32 double mitk::LogItLinking::DLink(double mu)
33 {
34  return 1 / (mu * (1 - mu));
35 }
36 
38 {
39  double result;
40  if (eta < lowerBound)
41  {
42  result = 1 / (1 + std::exp(-lowerBound));
43  }
44  else if (eta > upperBound)
45  {
46  result = 1 / (1 + std::exp(-upperBound));
47  }
48  else
49  {
50  result = (1 / (1 + std::exp(-eta)));
51  }
52  if (result <0 ) result = 0;
53  if (result > 1) result = 1;
54 
55  return result;
56 }
double Link(double mu)
double DLink(double mu)
double InverseLink(double eta)