DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkDiffusionModelGenerator.h
Go to the documentation of this file.
1 
18 #ifndef __itkDiffusionModelGenerator_h
19 #define __itkDiffusionModelGenerator_h
20 
21 #include "itkObject.h"
23 
24 namespace itk
25 {
26 
34 template<class PreciseType = double>
35 class ITK_EXPORT DiffusionModelGenerator : public Object
36 {
37 public:
40  typedef Object Superclass;
41  typedef SmartPointer<Self> Pointer;
42  typedef SmartPointer<const Self> ConstPointer;
43 
45  itkNewMacro(Self);
46 
48  itkTypeMacro(DiffusionModelGenerator, Object);
49 
50  typedef vnl_matrix<double> MatrixType;
51  typedef vnl_vector<double> VectorType;
52  typedef utl_shared_ptr<MatrixType> MatrixPointer;
53  typedef utl_shared_ptr<VectorType> VectorPointer;
54  typedef std::vector<double> STDVectorType;
55  typedef utl_shared_ptr<STDVectorType > STDVectorPointer;
56 
59 
62 
63  typedef SamplingSchemeQSpaceType::PointType PointType;
64 
65  itkSetObjectMacro(SamplingSchemeQSpace, SamplingSchemeQSpaceType);
66  itkGetObjectMacro(SamplingSchemeQSpace, SamplingSchemeQSpaceType);
67  itkSetObjectMacro(SamplingSchemeRSpace, SamplingSchemeRSpaceType);
68  itkGetObjectMacro(SamplingSchemeRSpace, SamplingSchemeRSpaceType);
69 
70  itkSetMacro(ODFOrder, int);
71  itkGetMacro(ODFOrder, int);
72 
73  itkGetMacro(DWISamples, VectorPointer);
74  itkGetMacro(ODFSamples, VectorPointer);
75  itkGetMacro(EAPSamples, VectorPointer);
76 
77  virtual void Rotate (const MatrixType& mat)
78  {
79  }
80 
81  virtual void ComputeDWISamples ()
82  {
83  }
84 
85  virtual void ComputeEAPSamples ()
86  {
87  }
88 
89  virtual void ComputeODFSamples ()
90  {
91  }
92 
93  virtual void VerifyInputParameters() const
94  {
95  utlGlobalException(m_SamplingSchemeQSpace->GetNumberOfSamples()>0 && m_SamplingSchemeRSpace->GetNumberOfSamples()>0
96  && (std::fabs(m_SamplingSchemeQSpace->GetDeltaBig()- m_SamplingSchemeRSpace->GetDeltaBig())>1e-8 || std::fabs(m_SamplingSchemeQSpace->GetDeltaSmall()- m_SamplingSchemeRSpace->GetDeltaSmall())>1e-8)
97  , "inconsistent m_DeltaBig or m_DeltaSmall in m_SamplingSchemeQSpace and m_SamplingSchemeRSpace");
98  }
99 
100 protected:
102  DiffusionModelGenerator () : Superclass(),
103  m_DWISamples(new VectorType()),
104  m_ODFSamples(new VectorType()),
105  m_EAPSamples(new VectorType())
106  {
107  m_ODFOrder = 2;
108  m_SamplingSchemeQSpace = SamplingSchemeQSpaceType::New();
109  m_SamplingSchemeRSpace = SamplingSchemeRSpaceType::New();
110  }
111 
113  {
114  }
115 
116  void PrintSelf(std::ostream& os, Indent indent) const
117  {
118  Superclass::PrintSelf(os, indent);
119  if (m_SamplingSchemeQSpace->GetNumberOfSamples()>0)
120  {
121  os << indent << "m_SamplingSchemeQSpace = " << m_SamplingSchemeQSpace << std::endl;
122  utl::PrintVnlVector(*m_DWISamples, "m_DWISamples", " ", os<<indent);
123  }
124  if (m_SamplingSchemeRSpace->GetNumberOfSamples()>0)
125  {
126  os << indent << "m_SamplingSchemeRSpace = " << m_SamplingSchemeRSpace << std::endl;
127  PrintVar1(true, m_ODFOrder, os<<indent);
128  utl::PrintVnlVector(*m_EAPSamples, "m_EAPSamples", " ", os<<indent);
129  utl::PrintVnlVector(*m_ODFSamples, "m_ODFSamples", " ", os<<indent);
130  }
131  }
132 
133  typename LightObject::Pointer InternalClone() const
134  {
135  typename LightObject::Pointer loPtr = Superclass::InternalClone();
136 
137  typename Self::Pointer rval = dynamic_cast<Self *>(loPtr.GetPointer());
138  if(rval.IsNull())
139  {
140  itkExceptionMacro(<< "downcast to type " << this->GetNameOfClass()<< " failed.");
141  }
142 
143  rval->m_SamplingSchemeQSpace = m_SamplingSchemeQSpace;
144  rval->m_SamplingSchemeRSpace = m_SamplingSchemeRSpace;
145  rval->m_ODFOrder = m_ODFOrder;
146 
147  rval->m_DWISamples = m_DWISamples;
148  rval->m_ODFSamples = m_ODFSamples;
149  rval->m_EAPSamples = m_EAPSamples;
150 
151  return loPtr;
152  }
153 
155  SamplingSchemeQSpacePointer m_SamplingSchemeQSpace;
157  SamplingSchemeRSpacePointer m_SamplingSchemeRSpace;
158 
160 
161  VectorPointer m_DWISamples;
162  VectorPointer m_ODFSamples;
163  VectorPointer m_EAPSamples;
164 
165 private :
166  DiffusionModelGenerator(const Self&); //purposely not implemented
167  void operator=(const Self&); //purposely not implemented
168 };
169 
170 }
171 
172 #endif
utl_shared_ptr< STDVectorType > STDVectorPointer
void PrintVnlVector(const vnl_vector< T > &vec, const std::string &str="", const char *separate=" ", std::ostream &os=std::cout)
Definition: utlVNL.h:253
generate ground truth DWI/EAP/ODF ets from a given model
#define PrintVar1(cond, var, os)
Definition: utlCoreMacro.h:447
SamplingSchemeQSpaceType::PointType PointType
SamplingSchemeRSpaceType::Pointer SamplingSchemeRSpacePointer
utl_shared_ptr< MatrixType > MatrixPointer
void PrintSelf(std::ostream &os, Indent indent) const
utl_shared_ptr< VectorType > VectorPointer
SmartPointer< const Self > ConstPointer
#define utlGlobalException(cond, expout)
Definition: utlCoreMacro.h:372
this class describes sampling in a 3D space (Q space or R space).
this class describes sampling in Q space.
SmartPointer< Self > Pointer
LightObject::Pointer InternalClone() const
SamplingScheme3D< double > SamplingSchemeRSpaceType
SamplingSchemeQSpaceType::Pointer SamplingSchemeQSpacePointer
SamplingSchemeQSpacePointer m_SamplingSchemeQSpace
SamplingSchemeQSpace< double > SamplingSchemeQSpaceType
SamplingSchemeRSpacePointer m_SamplingSchemeRSpace
virtual void Rotate(const MatrixType &mat)
virtual void VerifyInputParameters() const