DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkBasisMatrixGenerator.h
Go to the documentation of this file.
1 
18 #ifndef __itkBasisMatrixGenerator_h
19 #define __itkBasisMatrixGenerator_h
20 
21 #include "itkObject.h"
22 #include <vnl/vnl_matrix.h>
23 #include <vnl/vnl_vector.h>
24 
25 #include <tr1/memory>
27 
28 namespace itk
29 {
30 
39 template <typename TElement = double>
40 class ITK_EXPORT BasisMatrixGenerator: public Object
41 {
42 public:
45  typedef Object Superclass;
46  typedef SmartPointer<Self> Pointer;
47  typedef SmartPointer<const Self> ConstPointer;
48 
50  itkTypeMacro(BasisMatrixGenerator, Object);
51 
53  itkNewMacro(Self);
54 
58  typedef utl_shared_ptr<MatrixType> MatrixPointer;
59  typedef utl_shared_ptr<VectorType> VectorPointer;
60  typedef std::vector<double> STDVectorType;
61  typedef utl_shared_ptr<STDVectorType > STDVectorPointer;
62 
65 
68 
69  itkSetObjectMacro(SamplingSchemeQSpace, SamplingSchemeQSpaceType);
70  itkGetObjectMacro(SamplingSchemeQSpace, SamplingSchemeQSpaceType);
71 
72  itkSetObjectMacro(SamplingSchemeRSpace, SamplingSchemeRSpaceType);
73  itkGetObjectMacro(SamplingSchemeRSpace, SamplingSchemeRSpaceType);
74 
75  typedef enum
76  {
77  DWI=0,
78  EAP,
79  ODF
80  } OutputType;
81 
82 
83  // itkSetMacro(QBasisMatrix, MatrixPointer);
84  itkGetMacro(QBasisMatrixForDWI, MatrixPointer);
85 
86  // itkSetMacro(RBasisMatrix, MatrixPointer);
87  itkGetMacro(RBasisMatrixForEAP, MatrixPointer);
88  itkGetMacro(RBasisMatrixForODF, MatrixPointer);
89 
90  itkSetMacro(MD0, double);
91  itkGetMacro(MD0, double);
92  itkSetMacro(ODFOrder, int);
93  itkGetMacro(ODFOrder, int);
94 
95  itkSetMacro(OutputType, OutputType);
96  itkGetMacro(OutputType, OutputType);
97 
98  virtual void ComputeBasisMatrix()
99  {
100  }
101 
102  virtual void Flip(const int flipx, const int flipy, const int flipz)
103  {
104  }
105 
106  // [>* Generate basis in Q space for DWI <]
107  // virtual MatrixPointer ComputeQBasisMatrixForDWI()
108  // {return MatrixPointer();}
109  // [>* Generate basis in R space for EAP<]
110  // virtual MatrixPointer ComputeRBasisMatrixForEAP()
111  // {return MatrixPointer();}
112  // [>* Generate basis in R space for ODF<]
113  // virtual MatrixPointer ComputeRBasisMatrixForODF()
114  // {return MatrixPointer();}
115 
116  virtual int GetNumberOfSamples() const
117  {
118  return m_OutputType==DWI? m_SamplingSchemeQSpace->GetNumberOfSamples() : m_SamplingSchemeRSpace->GetNumberOfSamples();
119  }
120  virtual int GetNumberOfBasis() const
121  {
122  return -1;
123  }
124  virtual MatrixPointer GetBasisMatrix() const
125  {
126  MatrixPointer mat;
127  if (m_OutputType==DWI)
128  mat = m_QBasisMatrixForDWI;
129  else if (m_OutputType==EAP)
130  mat = m_RBasisMatrixForEAP;
131  else if (m_OutputType==ODF)
132  mat = m_RBasisMatrixForODF;
133  return mat;
134  }
135 
136 protected:
139  {}
140 
141  virtual void VerifyInputParameters() const;
142 
143  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
144  typename LightObject::Pointer InternalClone() const ITK_OVERRIDE;
145 
147  SamplingSchemeQSpacePointer m_SamplingSchemeQSpace;
148 
150  SamplingSchemeRSpacePointer m_SamplingSchemeRSpace;
151 
152  MatrixPointer m_QBasisMatrixForDWI;
153 
154  MatrixPointer m_RBasisMatrixForEAP;
155  MatrixPointer m_RBasisMatrixForODF;
156 
158  double m_MD0;
159 
162 
163  OutputType m_OutputType;
164 
165 private:
166  BasisMatrixGenerator(const Self&); //purposely not implemented
167  void operator=(const Self&); //purposely not implemented
168 
169 };
170 
171 } // end namespace itk
172 
173 // Define instantiation macro for this template.
174 #define ITK_TEMPLATE_BasisMatrixGenerator(_, EXPORT, x, y) namespace itk { \
175  _(2(class EXPORT BasisMatrixGenerator< ITK_TEMPLATE_2 x >)) \
176  namespace Templates { typedef BasisMatrixGenerator< ITK_TEMPLATE_2 x > BasisMatrixGenerator##y; } \
177  }
178 
179 #if ITK_TEMPLATE_EXPLICIT
180 # include "Templates/itkBasisMatrixGenerator+-.h"
181 #endif
182 
183 #if !defined(ITK_MANUAL_INSTANTIATION) && !defined(__itkBasisMatrixGenerator_hxx)
184 # include "itkBasisMatrixGenerator.hxx"
185 #endif
186 
187 
188 #endif
SamplingScheme3D< double > SamplingSchemeRSpaceType
std::vector< double > STDVectorType
virtual int GetNumberOfBasis() const
utl::NDArray< double, 2 > MatrixType
utl_shared_ptr< VectorType > VectorPointer
SamplingSchemeRSpacePointer m_SamplingSchemeRSpace
utl_shared_ptr< STDVectorType > STDVectorPointer
virtual MatrixPointer GetBasisMatrix() const
utl::NDArray< double, 1 > VectorType
#define ITK_OVERRIDE
Definition: utlITKMacro.h:46
utl_shared_ptr< MatrixType > MatrixPointer
SmartPointer< const Self > ConstPointer
this class describes sampling in a 3D space (Q space or R space).
virtual int GetNumberOfSamples() const
virtual void Flip(const int flipx, const int flipy, const int flipz)
this class describes sampling in Q space.
SmartPointer< Self > Pointer
SamplingSchemeQSpace< double > SamplingSchemeQSpaceType
SamplingSchemeQSpacePointer m_SamplingSchemeQSpace
SamplingSchemeRSpaceType::Pointer SamplingSchemeRSpacePointer
SamplingSchemeQSpaceType::Pointer SamplingSchemeQSpacePointer