DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkDWIGeneratorBase.h
Go to the documentation of this file.
1 
18 #ifndef __itkDWIGeneratorBase_h
19 #define __itkDWIGeneratorBase_h
20 
21 #include "itkPeakContainerHelper.h"
22 #include "itkImage.h"
23 #include "itkImageSource.h"
24 
25 #include <tr1/memory>
28 
29 namespace itk
30 {
31 
39 template <class TOutputImage, class TScalarImage=Image<double,3> >
40 class ITK_EXPORT DWIGeneratorBase : public ImageSource<TOutputImage>
41 {
42 public:
45  typedef ImageSource<TOutputImage> Superclass;
46  typedef SmartPointer<Self> Pointer;
47 
48  // [>* Method for creation through the object factory. <]
49  // itkNewMacro(Self);
50 
52  itkTypeMacro(DWIGeneratorBase, ImageSource);
53 
55  typedef TOutputImage OutputImageType;
56  typedef typename OutputImageType::Pointer OutputImagePointer;
57  typedef typename OutputImageType::SizeType OutputImageSizeType;
58  typedef typename OutputImageType::SpacingType OutputImageSpacingType;
59  typedef typename OutputImageType::IndexType OutputImageIndexType;
60  typedef typename OutputImageType::PointType OutputImagePointType;
61  typedef typename OutputImageType::DirectionType OutputImageDirectionType;
62  typedef typename OutputImageType::RegionType OutputImageRegionType;
63  typedef typename OutputImageType::PixelType OutputImagePixelType;
64  typedef typename OutputImageType::InternalPixelType OutputImageInternalPixelType;
65 
67  itkStaticConstMacro(OutputImageDimension, unsigned int, OutputImageType::ImageDimension);
68 
70 // typedef Image<float, OutputImageDimension> ScalarImageType;
71  typedef TScalarImage ScalarImageType;
72  typedef typename ScalarImageType::Pointer ScalarImagePointer;
73 
75  typedef double PrecisionType;
78  typedef utl_shared_ptr<MatrixType > MatrixPointer;
79  typedef std::vector<PrecisionType> STDVectorType;
80  typedef utl_shared_ptr<STDVectorType> STDVectorPointer;
81 
83  typedef typename std::vector<double> DiffusionParameterValuesType;
84  typedef typename std::vector<DiffusionParameterValuesType> DiffusionParameterContainerType;
85 
88 
91 
94 
100  typedef enum
101  {
102  SYMMETRICAL_TENSOR_IN_CARTESIAN_COORDS=0,
105  CYLINDER_SPHERICAL_MODEL
106  } ModelType;
107 
108  itkSetEnumMacro( ModelType, ModelType );
109  itkGetEnumMacro( ModelType, ModelType );
110 
111  itkSetObjectMacro(SamplingSchemeQSpace, SamplingSchemeQSpaceType);
112  itkGetObjectMacro(SamplingSchemeQSpace, SamplingSchemeQSpaceType);
113 
114  itkSetObjectMacro(SamplingSchemeRSpace, SamplingSchemeRSpaceType);
115  itkGetObjectMacro(SamplingSchemeRSpace, SamplingSchemeRSpaceType);
116 
117  itkSetObjectMacro(CylinderModel, CylinderModelType);
118  itkGetObjectMacro(CylinderModel, CylinderModelType);
119 
120  itkSetMacro(PeakType, PeakType);
121  itkGetMacro(PeakType, PeakType);
122 
123  itkSetMacro( B0Scale, double );
124  itkGetMacro( B0Scale, double );
125 
127  itkSetMacro( OutputSize, OutputImageSizeType );
128  itkGetMacro( OutputSize, OutputImageSizeType );
129 
130  unsigned int
132  {
133  return m_SamplingSchemeQSpace->GetNumberOfSamples();
134  }
135  unsigned int
137  {
138  return m_SamplingSchemeRSpace->GetNumberOfSamples();
139  }
140 
142  itkSetMacro(NoiseSigma, double);
143  itkGetMacro(NoiseSigma, double);
144  itkSetMacro(SNR, double);
145  itkGetMacro(SNR, double);
146  itkSetMacro(ODFOrder, unsigned int);
147  itkGetMacro(ODFOrder, unsigned int);
148 
149  itkSetMacro(MaxNumberOfPeaks, int);
150  itkGetMacro(MaxNumberOfPeaks, int);
151 
152  itkSetGetBooleanMacro(IsOutputDWI);
153  itkSetGetBooleanMacro(IsOutputEAP);
154  itkSetGetBooleanMacro(IsOutputODF);
155  itkSetGetBooleanMacro(IsOutputRTO);
156  itkSetGetBooleanMacro(IsOutputMSD);
157 
159  ScalarImageType* GetB0Image()
160  {
161  return dynamic_cast< ScalarImageType* >(this->ProcessObject::GetOutput(1) );
162  }
163 
164  OutputImageType* GetDWIImage()
165  {
166  return dynamic_cast< OutputImageType* >(this->ProcessObject::GetOutput(0) );
167  }
168 
169  OutputImageType* GetODFImage()
170  {
171  return dynamic_cast< OutputImageType* >(this->ProcessObject::GetOutput(2) );
172  }
173 
174  OutputImageType* GetEAPImage()
175  {
176  return dynamic_cast< OutputImageType* >(this->ProcessObject::GetOutput(3) );
177  }
178 
179  OutputImageType* GetPeakImage()
180  {
181  return dynamic_cast< OutputImageType* >(this->ProcessObject::GetOutput(4) );
182  }
183 
184  ScalarImageType* GetRTOImage()
185  {
186  return dynamic_cast< ScalarImageType* >(this->ProcessObject::GetOutput(5) );
187  }
188  ScalarImageType* GetMSDImage()
189  {
190  return dynamic_cast< ScalarImageType* >(this->ProcessObject::GetOutput(6) );
191  }
192 
193 protected:
195  ~DWIGeneratorBase();
196 
197  typename LightObject::Pointer InternalClone() const ITK_OVERRIDE;
198  void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE;
199 
200  void GenerateData() ITK_OVERRIDE =0;
201 
203  virtual void Initialization();
205  virtual void AllocateOutputs() ITK_OVERRIDE;
206 
207  SamplingSchemeQSpacePointer m_SamplingSchemeQSpace;
208 
209  SamplingSchemeRSpacePointer m_SamplingSchemeRSpace;
210 
216 
217  double m_NoiseSigma;
218  double m_SNR;
219 
220  unsigned int m_ODFOrder;
221 
222  ModelType m_ModelType;
223  double m_B0Scale;
224 
227 
228  CylinderModelPointer m_CylinderModel;
229 
230  OutputImageSizeType m_OutputSize;
231  OutputImageSpacingType m_OutputSpacing;
232  OutputImagePointType m_OutputOrigin;
233  OutputImageDirectionType m_OutputDirection;
234 
235 private:
236  DWIGeneratorBase(const Self&); //purposely not implemented
237  void operator=(const Self&); //purposely not implemented
238 
239 
240 };
241 
242 
243 } //namespace ITK
244 
245 
246 #if !defined(ITK_MANUAL_INSTANTIATION) && !defined(__itkDWIGeneratorBase_hxx)
247 #include "itkDWIGeneratorBase.hxx"
248 #endif
249 
250 #endif
OutputImageSizeType m_OutputSize
NDArray is a N-Dimensional array class (row-major, c version)
Definition: utlFunctors.h:131
CylinderModelGenerator< double > CylinderModelType
OutputImageType * GetEAPImage()
unsigned int GetNumberOfQSpaceSamples() const
ImageSource< TOutputImage > Superclass
OutputImageType::RegionType OutputImageRegionType
std::vector< PrecisionType > STDVectorType
CylinderModelType::Pointer CylinderModelPointer
unsigned int GetNumberOfRSpaceSamples() const
OutputImageType::SpacingType OutputImageSpacingType
ScalarImageType * GetMSDImage()
utl::NDArray< PrecisionType, 1 > VectorType
CylinderModelPointer m_CylinderModel
utl::NDArray< PrecisionType, 2 > MatrixType
SamplingSchemeQSpace< double > SamplingSchemeQSpaceType
OutputImageType * GetDWIImage()
#define ITK_OVERRIDE
Definition: utlITKMacro.h:46
SamplingSchemeQSpacePointer m_SamplingSchemeQSpace
ScalarImageType * GetRTOImage()
OutputImagePointType m_OutputOrigin
OutputImageDirectionType m_OutputDirection
utl_shared_ptr< STDVectorType > STDVectorPointer
OutputImageType * GetPeakImage()
ScalarImageType * GetB0Image()
std::vector< double > DiffusionParameterValuesType
utl_shared_ptr< MatrixType > MatrixPointer
SamplingSchemeRSpacePointer m_SamplingSchemeRSpace
OutputImageType::PixelType OutputImagePixelType
ScalarImageType::Pointer ScalarImagePointer
OutputImageType::IndexType OutputImageIndexType
OutputImageType::InternalPixelType OutputImageInternalPixelType
this class describes sampling in a 3D space (Q space or R space).
this class describes sampling in Q space.
SmartPointer< Self > Pointer
OutputImageType * GetODFImage()
Generate DWI data based on provided parameter file.
OutputImageSpacingType m_OutputSpacing
std::vector< DiffusionParameterValuesType > DiffusionParameterContainerType
SmartPointer< Self > Pointer
OutputImageType::SizeType OutputImageSizeType
SamplingScheme3D< double > SamplingSchemeRSpaceType
OutputImageType::PointType OutputImagePointType
SamplingSchemeRSpaceType::Pointer SamplingSchemeRSpacePointer
OutputImageType::Pointer OutputImagePointer
SamplingSchemeQSpaceType::Pointer SamplingSchemeQSpacePointer
OutputImageType::DirectionType OutputImageDirectionType
#define itkSetGetBooleanMacro(name)
Definition: utlITKMacro.h:139