Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkAstroStickModel.h
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 #ifndef _MITK_AstroStickModel_H
18 #define _MITK_AstroStickModel_H
19 
21 #include <itkPointShell.h>
22 
23 namespace mitk {
24 
30 template< class ScalarType = double >
31 class AstroStickModel : public DiffusionSignalModel< ScalarType >
32 {
33 public:
34 
36  template< class OtherType >AstroStickModel(AstroStickModel<OtherType>* model)
37  {
38  this->m_CompartmentId = model->m_CompartmentId;
39  this->m_T2 = model->GetT2();
40  this->m_FiberDirection = model->GetFiberDirection();
41  this->m_GradientList = model->GetGradientList();
43  this->m_RandGen = model->GetRandomGenerator();
44 
45  this->m_BValue = model->GetBvalue();
46  this->m_Diffusivity = model->GetDiffusivity();
47  this->m_Sticks = model->GetSticks();
48  this->m_NumSticks = model->GetNumSticks();
49  this->m_RandomizeSticks = model->GetRandomizeSticks();
50  }
52 
56 
58  PixelType SimulateMeasurement();
59  ScalarType SimulateMeasurement(unsigned int dir);
60 
61 
62  void SetFiberDirection(GradientType fiberDirection){ this->m_FiberDirection = fiberDirection; }
63  void SetGradientList(GradientListType gradientList) { this->m_GradientList = gradientList; }
64 
65  void SetRandomizeSticks(bool randomize=true){ m_RandomizeSticks=randomize; }
67 
68  void SetBvalue(double bValue) { m_BValue = bValue; }
69  double GetBvalue() { return m_BValue; }
70 
71  void SetDiffusivity(double diffusivity) { m_Diffusivity = diffusivity; }
72  double GetDiffusivity() { return m_Diffusivity; }
73 
74  void SetNumSticks(unsigned int order)
75  {
76  vnl_matrix<double> sticks;
77  switch (order)
78  {
79  case 1:
80  m_NumSticks = 12;
81  sticks = itk::PointShell<12, vnl_matrix_fixed<double, 3, 12> >::DistributePointShell()->as_matrix();
82  break;
83  case 2:
84  m_NumSticks = 42;
85  sticks = itk::PointShell<42, vnl_matrix_fixed<double, 3, 42> >::DistributePointShell()->as_matrix();
86  break;
87  case 3:
88  m_NumSticks = 92;
89  sticks = itk::PointShell<92, vnl_matrix_fixed<double, 3, 92> >::DistributePointShell()->as_matrix();
90  break;
91  case 4:
92  m_NumSticks = 162;
93  sticks = itk::PointShell<162, vnl_matrix_fixed<double, 3, 162> >::DistributePointShell()->as_matrix();
94  break;
95  case 5:
96  m_NumSticks = 252;
97  sticks = itk::PointShell<252, vnl_matrix_fixed<double, 3, 252> >::DistributePointShell()->as_matrix();
98  break;
99  default:
100  m_NumSticks = 42;
101  sticks = itk::PointShell<42, vnl_matrix_fixed<double, 3, 42> >::DistributePointShell()->as_matrix();
102  break;
103  }
104  for (int i=0; i<m_NumSticks; i++)
105  {
106  GradientType stick;
107  stick[0] = sticks.get(0,i); stick[1] = sticks.get(1,i); stick[2] = sticks.get(2,i);
108  stick.Normalize();
109  m_Sticks.push_back(stick);
110  }
111  }
112  unsigned int GetNumSticks(){ return m_NumSticks; }
113  GradientListType GetSticks(){ return m_Sticks; }
114 
115 protected:
116 
117  GradientType GetRandomDirection();
118  double m_BValue;
119  double m_Diffusivity;
120  GradientListType m_Sticks;
121  unsigned int m_NumSticks;
123 };
124 
125 }
126 
127 #include "mitkAstroStickModel.cpp"
128 
129 #endif
130 
GradientListType m_Sticks
Stick container.
GradientType GetRandomDirection()
GradientType m_FiberDirection
Needed to generate anisotropc signal to determin direction of anisotropy.
unsigned int m_CompartmentId
GUI flag. Which compartment is this model assigned to?
unsigned int m_NumSticks
Number of sticks.
double ScalarType
void SetNumSticks(unsigned int order)
DataCollection - Class to facilitate loading/accessing structured data.
void SetFiberDirection(GradientType fiberDirection)
ItkRandGenType::Pointer m_RandGen
Random number generator.
GradientListType m_GradientList
Diffusion gradient direction container.
ItkDoubleImgType::Pointer m_VolumeFractionImage
Tissue specific volume fraction for each voxel (only relevant for non fiber compartments) ...
std::vector< GradientType > GradientListType
Abstract class for diffusion signal models.
DiffusionSignalModel< ScalarType >::GradientType GradientType
itk::Vector< double, 3 > GradientType
DiffusionSignalModel< ScalarType >::PixelType PixelType
void SetDiffusivity(double diffusivity)
Scalar diffusion constant.
double m_Diffusivity
Scalar diffusion constant.
GradientListType GetSticks()
void SetBvalue(double bValue)
b-value used to generate the artificial signal
DiffusionSignalModel< ScalarType >::GradientListType GradientListType
AstroStickModel(AstroStickModel< OtherType > *model)
ItkDoubleImgType::Pointer GetVolumeFractionImage()
Generates the diffusion signal using a collection of idealised cylinder with zero radius: e^(-bd(ng)²...
void SetGradientList(GradientListType gradientList)
double m_BValue
b-value used to generate the artificial signal
void SetRandomizeSticks(bool randomize=true)
Random stick configuration in each voxel.
double m_T2
Tissue specific transversal relaxation time.
ItkRandGenType::Pointer GetRandomGenerator()