ANIMA  4.0
animaNODDICompartment.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <animaBaseCompartment.h>
4 #include <AnimaMCMExport.h>
5 
6 namespace anima
7 {
8 
9 class ANIMAMCM_EXPORT NODDICompartment : public BaseCompartment
10 {
11 public:
12  // Useful typedefs
16  typedef itk::SmartPointer<Self> Pointer;
17  typedef itk::SmartPointer<const Self> ConstPointer;
21 
22  // New macro
23  itkNewMacro(Self)
24 
25 
26  itkTypeMacro(NODDICompartment, BaseCompartment)
27 
28  DiffusionModelCompartmentType GetCompartmentType() ITK_OVERRIDE {return NODDI;}
29 
30  virtual double GetFourierTransformedDiffusionProfile(double smallDelta, double bigDelta, double gradientStrength, const Vector3DType &gradient) ITK_OVERRIDE;
31  virtual ListType &GetSignalAttenuationJacobian(double smallDelta, double bigDelta, double gradientStrength, const Vector3DType &gradient) ITK_OVERRIDE;
32  virtual double GetLogDiffusionProfile(const Vector3DType &sample) ITK_OVERRIDE;
33 
34  virtual void SetParametersFromVector(const ListType &params) ITK_OVERRIDE;
35  virtual ListType &GetParametersAsVector() ITK_OVERRIDE;
36 
37  virtual ListType &GetParameterLowerBounds() ITK_OVERRIDE;
38  virtual ListType &GetParameterUpperBounds() ITK_OVERRIDE;
39 
40  // Set constraints
41  void SetEstimateOrientationConcentration(bool arg);
42  void SetEstimateAxialDiffusivity(bool arg);
43  void SetEstimateExtraAxonalFraction(bool arg);
44 
45  void SetCompartmentVector(ModelOutputVectorType &compartmentVector) ITK_OVERRIDE;
46 
47  unsigned int GetCompartmentSize() ITK_OVERRIDE;
48  unsigned int GetNumberOfParameters() ITK_OVERRIDE;
49  ModelOutputVectorType &GetCompartmentVector() ITK_OVERRIDE;
50 
51  // Reimplement for handling modification flags
52  void SetOrientationTheta(double num) ITK_OVERRIDE;
53  void SetOrientationPhi(double num) ITK_OVERRIDE;
54  void SetOrientationConcentration(double num) ITK_OVERRIDE;
55  void SetExtraAxonalFraction(double num) ITK_OVERRIDE;
56  void SetAxialDiffusivity(double num) ITK_OVERRIDE;
57 
58  bool GetTensorCompatible() ITK_OVERRIDE {return false;}
59  const Matrix3DType &GetDiffusionTensor() ITK_OVERRIDE;
60  double GetApparentFractionalAnisotropy() ITK_OVERRIDE;
61 
62 protected:
63  NODDICompartment() : Superclass()
64  {
65  m_EstimateOrientationConcentration = true;
66  m_EstimateAxialDiffusivity = true;
67  m_EstimateExtraAxonalFraction = true;
68  m_ChangedConstraints = true;
69 
70  m_ModifiedParameters = true;
71  m_ModifiedConcentration = true;
72 
73  m_Tau1 = 2.0 / 3.0;
74  m_Tau1Deriv = 0.0;
75 
76  m_WatsonSHCoefficients.clear();
77  m_WatsonSHCoefficientDerivatives.clear();
78 
79  m_IntraAxonalSignal = 0;
80  m_IntraAngleDerivative = 0;
81  m_IntraKappaDerivative = 0;
82  m_IntraAxialDerivative = 0;
83  m_ExtraAxonalSignal = 0;
84 
85  m_CurrentBValue = -1.0;
86  m_CurrentGradient.fill(0.0);
87  }
88 
89  virtual ~NODDICompartment() {}
90 
92  void UpdateSignals(double bValue, const Vector3DType &gradient);
93 
95  void UpdateKappaValues();
96 
97 private:
98  bool m_EstimateOrientationConcentration, m_EstimateAxialDiffusivity, m_EstimateExtraAxonalFraction;
99  bool m_ChangedConstraints;
100  unsigned int m_NumberOfParameters;
101 
103  bool m_ModifiedParameters;
104  bool m_ModifiedConcentration;
105 
107  double m_CurrentBValue;
108  Vector3DType m_CurrentGradient;
109 
110  // Internal work variables for faster processing
111  std::vector <double> m_WatsonSHCoefficients, m_WatsonSHCoefficientDerivatives;
112  double m_Tau1, m_Tau1Deriv;
113  double m_ExtraAxonalSignal, m_IntraAxonalSignal;
114  double m_IntraAngleDerivative, m_IntraKappaDerivative, m_IntraAxialDerivative;
115 };
116 
117 } //end namespace anima
std::vector< double > ListType
itk::VariableLengthVector< double > ModelOutputVectorType
bool GetTensorCompatible() ITK_OVERRIDE
itk::Matrix< double, 3, 3 > Matrix3DType
vnl_vector_fixed< double, 3 > Vector3DType
itk::SmartPointer< const Self > ConstPointer
DiffusionModelCompartmentType
Superclass::Vector3DType Vector3DType
itk::SmartPointer< Self > Pointer
Superclass::ModelOutputVectorType ModelOutputVectorType
itk::SmartPointer< Self > Pointer
Superclass::Pointer BasePointer
Superclass::Matrix3DType Matrix3DType