Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkEnergyComputer.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 _ENCOMP
18 #define _ENCOMP
19 
20 #include <MitkFiberTrackingExports.h>
22 #include <mitkParticleGrid.h>
23 #include <mitkSphereInterpolator.h>
24 #include <itkMersenneTwisterRandomVariateGenerator.h>
25 
26 using namespace mitk;
27 
31 class MITKFIBERTRACKING_EXPORT EnergyComputer
32 {
33 
34 public:
35 
36  //typedef itk::Vector<float, QBALL_ODFSIZE> OdfVectorType;
37  //typedef itk::Image<OdfVectorType, 3> ItkQBallImgType;
38  typedef itk::Image<float, 3> ItkFloatImageType;
39  typedef itk::Statistics::MersenneTwisterRandomVariateGenerator ItkRandGenType;
40 
41  EnergyComputer(ItkFloatImageType* mask, ParticleGrid* particleGrid, SphereInterpolator* interpolator, ItkRandGenType* randGen);
42  void SetParameters(float particleWeight, float particleWidth, float connectionPotential, float curvThres, float inexBalance, float particlePotential);
43 
44  // get random position inside mask
45  void DrawRandomPosition(vnl_vector_fixed<float, 3>& R);
46 
47  // external energy calculation
48  virtual float ComputeExternalEnergy(vnl_vector_fixed<float, 3>& R, vnl_vector_fixed<float, 3>& N, Particle* dp) =0;
49 
50  // internal energy calculation
51  virtual float ComputeInternalEnergyConnection(Particle *p1,int ep1) = 0;
52  virtual float ComputeInternalEnergyConnection(Particle *p1,int ep1, Particle *p2, int ep2) = 0;
53  virtual float ComputeInternalEnergy(Particle *dp) = 0;
54 
55  int GetNumActiveVoxels();
56 
57 protected:
58 
59  vnl_matrix_fixed<float, 3, 3> m_RotationMatrix;
62  ItkRandGenType* m_RandGen;
63  ItkFloatImageType* m_Mask;
64  vnl_vector_fixed<int, 3> m_Size;
65  vnl_vector_fixed<float, 3> m_Spacing;
66  std::vector< float > m_CumulatedSpatialProbability;
67  std::vector< int > m_ActiveIndices; // indices inside mask
68 
69  bool m_UseTrilinearInterpolation; // is deactivated if less than 3 image slices are available
70  int m_NumActiveVoxels; // voxels inside mask
71  float m_ConnectionPotential; // larger value results in larger energy value -> higher proposal acceptance probability
72  float m_ParticleChemicalPotential; // larger value results in larger energy value -> higher proposal acceptance probability
73  float gamma_s;
74  float gamma_reg_s;
75  float m_ParticleWeight; // defines how much one particle contributes to the artificial signal
76  float m_ExtStrength; // weighting factor for external energy
77  float m_IntStrength; // weighting factor for internal energy
78  float m_ParticleLength; // particle length
79  float m_SquaredParticleLength; // squared particle length
80  float m_CurvatureThreshold; // maximum angle accepted between two connected particles
81 
82  float SpatProb(vnl_vector_fixed<float, 3> pos);
83  float EvaluateOdf(vnl_vector_fixed<float, 3> &pos, vnl_vector_fixed<float, 3> dir);
84  float mbesseli0(float x);
85  float mexp(float x);
86 };
87 
88 #endif
std::vector< int > m_ActiveIndices
A particle is the basic element of the Gibbs fiber tractography method.
Definition: mitkParticle.h:30
vnl_vector_fixed< float, 3 > m_Spacing
std::vector< float > m_CumulatedSpatialProbability
Contains and manages particles.
Calculates internal and external energy of the new particle configuration proposal.
vnl_matrix_fixed< float, 3, 3 > m_RotationMatrix
DataCollection - Class to facilitate loading/accessing structured data.
SphereInterpolator * m_SphereInterpolator
Lookuptable based trilinear interpolation of spherically arranged scalar values.
itk::Image< float, 3 > ItkFloatImageType
vnl_vector_fixed< int, 3 > m_Size
ItkRandGenType * m_RandGen
ParticleGrid * m_ParticleGrid
bool m_UseTrilinearInterpolation
itk::Statistics::MersenneTwisterRandomVariateGenerator ItkRandGenType
float m_ParticleChemicalPotential
ItkFloatImageType * m_Mask