Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkBallModel.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 #include <vnl/vnl_cross.h>
17 #include <vnl/vnl_quaternion.h>
18 #include <mitkBallModel.h>
19 
20 using namespace mitk;
21 
22 template< class ScalarType >
24  : m_Diffusivity(0.001)
25  , m_BValue(1000)
26 {
27 
28 }
29 
30 template< class ScalarType >
32 {
33 
34 }
35 
36 template< class ScalarType >
38 {
39  ScalarType signal = 0;
40 
41  if (dir>=this->m_GradientList.size())
42  return signal;
43 
44  GradientType g = this->m_GradientList[dir];
45  ScalarType bVal = g.GetNorm(); bVal *= bVal;
46 
47  if (bVal>0.0001)
48  signal = std::exp( -m_BValue * bVal * m_Diffusivity );
49  else
50  signal = 1;
51 
52  return signal;
53 }
54 
55 template< class ScalarType >
57 {
58  PixelType signal;
59  signal.SetSize(this->m_GradientList.size());
60 
61  for( unsigned int i=0; i<this->m_GradientList.size(); i++)
62  {
63  GradientType g = this->m_GradientList[i];
64  ScalarType bVal = g.GetNorm(); bVal *= bVal;
65 
66  if (bVal>0.0001)
67  signal[i] = std::exp( -m_BValue * bVal * m_Diffusivity );
68  else
69  signal[i] = 1;
70  }
71 
72  return signal;
73 }
double ScalarType
DataCollection - Class to facilitate loading/accessing structured data.
DiffusionSignalModel< ScalarType >::GradientType GradientType
Definition: mitkBallModel.h:50
PixelType SimulateMeasurement()