Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkStickModel.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 <mitkStickModel.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  this->m_FiberDirection.Normalize();
45 
46  GradientType g = this->m_GradientList[dir];
47  ScalarType bVal = g.GetNorm(); bVal *= bVal;
48 
49  if (bVal>0.0001)
50  {
51  ScalarType dot = this->m_FiberDirection*g;
52  signal = std::exp( -m_BValue * bVal * m_Diffusivity*dot*dot );
53  }
54  else
55  signal = 1;
56 
57  return signal;
58 }
59 
60 template< class ScalarType >
62 {
63  this->m_FiberDirection.Normalize();
64  PixelType signal;
65  signal.SetSize(this->m_GradientList.size());
66 
67  for( unsigned int i=0; i<this->m_GradientList.size(); i++)
68  {
69  GradientType g = this->m_GradientList[i];
70  ScalarType bVal = g.GetNorm(); bVal *= bVal;
71 
72  if (bVal>0.0001)
73  {
74  ScalarType dot = this->m_FiberDirection*g;
75  signal[i] = std::exp( -m_BValue * bVal * m_Diffusivity*dot*dot );
76  }
77  else
78  signal[i] = 1;
79  }
80 
81  return signal;
82 }
PixelType SimulateMeasurement()
double ScalarType
DataCollection - Class to facilitate loading/accessing structured data.
itk::Vector< double, 3 > GradientType