ANIMA  4.0
animaMCMWeightedAverager.h
Go to the documentation of this file.
1 #pragma once
4 #include <animaBaseTensorTools.h>
5 
6 #include <itkLightObject.h>
7 #include <itkVariableLengthVector.h>
8 #include <itkSymmetricEigenAnalysis.h>
9 
10 #include <vnl/vnl_math.h>
11 #include <vnl/vnl_diag_matrix.h>
12 #include <vnl/vnl_matrix.h>
13 
14 #include <AnimaMCMBaseExport.h>
15 
16 namespace anima
17 {
18 
24 class ANIMAMCMBASE_EXPORT MCMWeightedAverager : public itk::LightObject
25 {
26 public:
28  typedef itk::LightObject Superclass;
29  typedef itk::SmartPointer<Self> Pointer;
30  typedef itk::SmartPointer<const Self> ConstPointer;
31 
33  itkTypeMacro(MCMWeightedAverager, itk::LightObject)
34 
35  itkNewMacro(Self)
36 
38  using MCMCompartmentPointer = MCMType::BaseCompartmentPointer;
39  using MCMPointer = MCMType::Pointer;
40  using EigenAnalysisType = itk::SymmetricEigenAnalysis < vnl_matrix <double>, vnl_diag_matrix<double>, vnl_matrix <double> >;
43  using LECalculatorPointer = typename LECalculatorType::Pointer;
44 
45  void SetInputModels(std::vector <MCMPointer> &models) {m_InputModels = models; m_UpToDate = false;}
46  void SetInputWeights(std::vector <double> &weights) {m_InputWeights = weights; m_UpToDate = false;}
47 
48  void SetNumberOfOutputDirectionalCompartments(unsigned int val);
49  void ResetNumberOfOutputDirectionalCompartments();
50 
51  void SetOutputModel(MCMType *model);
52  MCMPointer &GetOutputModel();
53  MCMPointer &GetUntouchedOutputModel();
54 
55  unsigned int GetOutputModelSize();
56 
57  void SetUpToDate(bool val) {m_UpToDate = val;}
58 
59  void Update();
60 
61 protected:
64 
65  void ComputeTensorDistanceMatrix();
66  virtual void ComputeNonTensorDistanceMatrix();
67 
68  void ComputeOutputTensorCompatibleModel();
69  virtual void ComputeOutputNonTensorModel();
70 
71 private:
72  std::vector <MCMPointer> m_InputModels;
73  std::vector <double> m_InputWeights;
74 
75  unsigned int m_NumberOfOutputDirectionalCompartments;
76 
77  MCMPointer m_OutputModel;
78  bool m_UpToDate;
79 
80 protected:
81  // Internal work variables
82  std::vector < itk::VariableLengthVector <double> > m_InternalLogTensors;
83 
84  std::vector <double> m_InternalOutputWeights;
85  std::vector <MCMCompartmentPointer> m_WorkCompartmentsVector;
86  std::vector <double> m_WorkCompartmentWeights;
87  vnl_matrix <double> m_InternalDistanceMatrix;
88  std::vector < std::vector <double> > m_InternalSpectralMemberships;
89 
90  vnl_matrix <double> m_InternalWorkMatrix, m_InternalWorkEigenVectors;
91  vnl_diag_matrix <double> m_InternalWorkEigenValues, m_InternalWorkEigenValuesInputSticks;
92  itk::VariableLengthVector <double> m_InternalOutputVector;
93 
97 };
98 
99 } // end namespace anima
itk::VariableLengthVector< double > m_InternalOutputVector
Computes a weighted average of input multi-compartment models. The output model is at the same time g...
STL namespace.
std::vector< double > m_WorkCompartmentWeights
itk::SmartPointer< Self > Pointer
std::vector< std::vector< double > > m_InternalSpectralMemberships
itk::SymmetricEigenAnalysis< vnl_matrix< double >, vnl_diag_matrix< double >, vnl_matrix< double > > EigenAnalysisType
vnl_diag_matrix< double > m_InternalWorkEigenValuesInputSticks
MCMType::BaseCompartmentPointer MCMCompartmentPointer
MultiCompartmentModel: holds several diffusion compartments, ordered by type It also handles weights ...
typename LECalculatorType::Pointer LECalculatorPointer
vnl_matrix< double > m_InternalDistanceMatrix
std::vector< itk::VariableLengthVector< double > > m_InternalLogTensors
vnl_matrix< double > m_InternalWorkMatrix
std::vector< MCMCompartmentPointer > m_WorkCompartmentsVector
std::vector< double > m_InternalOutputWeights
void SetInputWeights(std::vector< double > &weights)
SpectralClusterType m_InternalSpectralCluster
itk::SmartPointer< const Self > ConstPointer