Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkRawShModel.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_RawShModel_H
18 #define _MITK_RawShModel_H
19 
21 #include <mitkImage.h>
23 
24 namespace mitk {
25 
31 template< class ScalarType = double >
32 class RawShModel : public DiffusionSignalModel< ScalarType >
33 {
34 public:
35 
36  RawShModel();
37  template< class OtherType >RawShModel(RawShModel<OtherType>* model)
38  {
39  this->m_CompartmentId = model->m_CompartmentId;
40  this->m_T2 = model->GetT2();
41  this->m_FiberDirection = model->GetFiberDirection();
42  this->m_GradientList = model->GetGradientList();
44  this->m_RandGen = model->GetRandomGenerator();
45 
46  this->m_AdcRange = model->GetAdcRange();
47  this->m_FaRange = model->GetFaRange();
48  this->m_ShCoefficients = model->GetShCoefficients();
49  this->m_B0Signal = model->GetB0Signals();
50  this->m_SphCoords = model->GetSphericalCoordinates();
51  this->m_ShOrder = model->GetShOrder();
52  this->m_ModelIndex = model->GetModelIndex();
53  this->m_MaxNumKernels = model->GetMaxNumKernels();
54  }
55  ~RawShModel();
56 
57  typedef itk::Image< double, 3 > ItkDoubleImageType;
58  typedef itk::Image< unsigned char, 3 > ItkUcharImageType;
59  typedef itk::Image< itk::DiffusionTensor3D< double >, 3 > TensorImageType;
64  typedef itk::Matrix< double, 3, 3 > MatrixType;
65 
67  PixelType SimulateMeasurement();
68  ScalarType SimulateMeasurement(unsigned int dir);
69 
70  bool SetShCoefficients(vnl_vector< double > shCoefficients, double b0);
71  void SetFiberDirection(GradientType fiberDirection);
72  void SetGradientList(GradientListType gradientList) { this->m_GradientList = gradientList; }
73  void SetFaRange(double min, double max){ m_FaRange.first = min; m_FaRange.second = max; }
74  void SetAdcRange(double min, double max){ m_AdcRange.first = min; m_AdcRange.second = max; }
75  void SetMaxNumKernels(unsigned int max){ m_MaxNumKernels = max; }
76  unsigned int GetNumberOfKernels();
77  std::pair< double, double > GetFaRange(){ return m_FaRange; }
78  std::pair< double, double > GetAdcRange(){ return m_AdcRange; }
79  unsigned int GetMaxNumKernels(){ return m_MaxNumKernels; }
80  void Clear();
81 
82  std::vector< vnl_vector< double > > GetShCoefficients(){ return m_ShCoefficients; }
83  std::vector< double > GetB0Signals(){ return m_B0Signal; }
84  vnl_matrix<double> GetSphericalCoordinates(){ return m_SphCoords; }
85  unsigned int GetShOrder(){ return m_ShOrder; }
86  int GetModelIndex(){ return m_ModelIndex; }
87 
88  double GetBaselineSignal(int index){ return m_B0Signal.at(index); }
89  vnl_vector< double > GetCoefficients(int listIndex){ return m_ShCoefficients.at(listIndex); }
90 
92 
93 protected:
94 
95  void Cart2Sph( GradientListType gradients );
96  void RandomModel();
97 
98  std::vector< vnl_vector< double > > m_ShCoefficients;
99  std::vector< double > m_B0Signal;
100  std::vector< GradientType > m_PrototypeMaxDirection;
101  vnl_matrix<double> m_SphCoords;
102  std::pair< double, double > m_AdcRange;
103  std::pair< double, double > m_FaRange;
104  unsigned int m_ShOrder;
106  unsigned int m_MaxNumKernels;
107 };
108 
109 }
110 
111 #include "mitkRawShModel.cpp"
112 
113 #endif
114 
bool SetShCoefficients(vnl_vector< double > shCoefficients, double b0)
GradientType m_FiberDirection
Needed to generate anisotropc signal to determin direction of anisotropy.
RawShModel(RawShModel< OtherType > *model)
void Cart2Sph(GradientListType gradients)
itk::SmartPointer< Self > Pointer
itk::Matrix< double, 3, 3 > MatrixType
unsigned int m_CompartmentId
GUI flag. Which compartment is this model assigned to?
PixelType SimulateMeasurement()
void SetFaRange(double min, double max)
DiffusionSignalModel< ScalarType >::GradientListType GradientListType
bool SampleKernels(Image::Pointer diffImg, ItkUcharImageType::Pointer maskImage, TensorImageType::Pointer tensorImage=NULL, QballFilterType::CoefficientImageType::Pointer coeffImage=NULL, ItkDoubleImageType::Pointer adcImage=NULL)
DiffusionSignalModel< ScalarType >::PixelType PixelType
double ScalarType
unsigned int m_ShOrder
void SetFiberDirection(GradientType fiberDirection)
std::vector< double > m_B0Signal
itk::Image< double, 3 > ItkDoubleImageType
DataCollection - Class to facilitate loading/accessing structured data.
ItkRandGenType::Pointer m_RandGen
Random number generator.
itk::AnalyticalDiffusionQballReconstructionImageFilter< short, short, float, 2, QBALL_ODFSIZE > QballFilterType
GradientListType m_GradientList
Diffusion gradient direction container.
ItkDoubleImgType::Pointer m_VolumeFractionImage
Tissue specific volume fraction for each voxel (only relevant for non fiber compartments) ...
unsigned int GetNumberOfKernels()
DiffusionSignalModel< ScalarType >::GradientType GradientType
std::vector< GradientType > GradientListType
unsigned int GetMaxNumKernels()
void SetAdcRange(double min, double max)
Abstract class for diffusion signal models.
std::vector< vnl_vector< double > > GetShCoefficients()
vnl_matrix< double > GetSphericalCoordinates()
double GetBaselineSignal(int index)
itk::Vector< double, 3 > GradientType
std::vector< double > GetB0Signals()
itk::Image< unsigned char, 3 > ItkUcharImageType
The spherical harmonic representation of a prototype diffusion weighted MR signal is used to obtain t...
unsigned int GetShOrder()
std::pair< double, double > GetFaRange()
This class takes as input one or more reference image (acquired in the absence of diffusion sensitizi...
std::pair< double, double > GetAdcRange()
itk::Image< itk::DiffusionTensor3D< double >, 3 > TensorImageType
std::vector< GradientType > m_PrototypeMaxDirection
static T max(T x, T y)
Definition: svm.cpp:70
std::vector< vnl_vector< double > > m_ShCoefficients
std::pair< double, double > m_AdcRange
void SetGradientList(GradientListType gradientList)
static T min(T x, T y)
Definition: svm.cpp:67
vnl_matrix< double > m_SphCoords
void SetMaxNumKernels(unsigned int max)
ItkDoubleImgType::Pointer GetVolumeFractionImage()
std::pair< double, double > m_FaRange
vnl_vector< double > GetCoefficients(int listIndex)
double m_T2
Tissue specific transversal relaxation time.
unsigned int m_MaxNumKernels
ItkRandGenType::Pointer GetRandomGenerator()