Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
itkDwiPhantomGenerationFilter.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 /*=========================================================================
17 
18  Program: Insight Segmentation & Registration Toolkit
19  Module: $RCSfile: itkDiffusionTensor3DReconstructionImageFilter.h,v $
20  Language: C++
21  Date: $Date: 2006-03-27 17:01:06 $
22  Version: $Revision: 1.12 $
23 
24  Copyright (c) Insight Software Consortium. All rights reserved.
25  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
26 
27  This software is distributed WITHOUT ANY WARRANTY; without even
28  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
29  PURPOSE. See the above copyright notices for more information.
30 
31 =========================================================================*/
32 #ifndef __itkDwiPhantomGenerationFilter_h_
33 #define __itkDwiPhantomGenerationFilter_h_
34 
35 #include <itkImageSource.h>
36 #include <itkVectorImage.h>
37 #include <itkDiffusionTensor3D.h>
38 #include <itkMersenneTwisterRandomVariateGenerator.h>
39 #include <mitkFiberBundle.h>
40 
41 namespace itk{
42 
46 template< class TOutputScalarType >
47 class DwiPhantomGenerationFilter : public ImageSource< itk::VectorImage<TOutputScalarType,3> >
48 {
49 
50 public:
51 
55  typedef ImageSource< itk::VectorImage<TOutputScalarType,3> > Superclass;
56 
58  itkFactorylessNewMacro(Self)
59  itkCloneMacro(Self)
60 
62  itkTypeMacro(DwiPhantomGenerationFilter, ImageSource)
63 
64  typedef typename Superclass::OutputImageType OutputImageType;
65  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
66  typedef itk::VectorContainer< int, double > AnglesContainerType;
67  typedef Vector<double,3> GradientType;
68  typedef std::vector<GradientType> GradientListType;
69  typedef itk::Matrix<double, 3, 3> MatrixType;
70  typedef itk::Image<unsigned char, 3> ItkUcharImgType;
71  typedef itk::Image<float, 3> ItkFloatImgType;
72 
73  typedef Image< Vector< float, 3 >, 3> ItkDirectionImage;
74  typedef VectorContainer< unsigned int, ItkDirectionImage::Pointer > ItkDirectionImageContainer;
75 
76  void SetGradientList(GradientListType gradientList){m_GradientList = gradientList;}
77  void SetSignalRegions(std::vector< ItkUcharImgType::Pointer > signalRegions){m_SignalRegions = signalRegions;}
78  void SetTensorFA(std::vector< float > faList){m_TensorFA = faList;}
79  void SetTensorADC(std::vector< float > adcList){m_TensorADC = adcList;}
80  void SetTensorWeight(std::vector< float > weightList){m_TensorWeight = weightList;}
81  void SetTensorDirection(std::vector< vnl_vector_fixed<double, 3> > directionList){m_TensorDirection = directionList;}
82 
83  // input parameters
84  itkSetMacro( BValue, float )
85  itkSetMacro( SignalScale, float )
86  itkSetMacro( NoiseVariance, double )
87  itkSetMacro( GreyMatterAdc, float )
88  itkSetMacro( Spacing, mitk::Vector3D )
89  itkSetMacro( Origin, mitk::Point3D )
90  itkSetMacro( DirectionMatrix, MatrixType )
91  itkSetMacro( ImageRegion, ImageRegion<3> )
92  itkSetMacro( SimulateBaseline, bool )
93 
94  // output
95  itkGetMacro( DirectionImageContainer, ItkDirectionImageContainer::Pointer)
96  itkGetMacro( NumDirectionsImage, ItkUcharImgType::Pointer)
97  itkGetMacro( SNRImage, ItkFloatImgType::Pointer)
98  itkGetMacro( OutputFiberBundle, mitk::FiberBundle::Pointer)
99 
100 protected:
102  ~DwiPhantomGenerationFilter(){}
103 
104  void GenerateData();
105 
106 private:
107 
108  // image variables
109  itk::Vector<double> m_Spacing;
110  mitk::Point3D m_Origin;
111  itk::Matrix<double, 3, 3> m_DirectionMatrix;
112  ImageRegion<3> m_ImageRegion;
113  ItkDirectionImageContainer::Pointer m_DirectionImageContainer;
114  ItkUcharImgType::Pointer m_NumDirectionsImage;
115  ItkFloatImgType::Pointer m_SNRImage;
116  mitk::FiberBundle::Pointer m_OutputFiberBundle;
117 
118  // signal regions
119  std::vector< ItkUcharImgType::Pointer > m_SignalRegions;
120  std::vector< float > m_TensorFA;
121  std::vector< float > m_TensorADC;
122  std::vector< float > m_TensorWeight;
123  std::vector< vnl_vector_fixed<double, 3> > m_TensorDirection;
124 
125  // signal related variable
126  GradientListType m_GradientList;
127  std::vector< itk::DiffusionTensor3D<float> > m_TensorList;
128  float m_BValue;
129  float m_SignalScale;
131  int m_BaselineImages;
132  double m_MaxBaseline;
133  double m_MeanBaseline;
134  double m_NoiseVariance;
135  bool m_AddNoiseFlag; //* Checkbox flag to switch noise on and off. */
136  float m_GreyMatterAdc;
137  bool m_SimulateBaseline;
138  TOutputScalarType m_DefaultBaseline;
139 
140  double GetTensorL2Norm(itk::DiffusionTensor3D<float>& T);
141  void GenerateTensors();
142  typename OutputImageType::PixelType SimulateMeasurement(itk::DiffusionTensor3D<float>& tensor, float weight);
143  void AddNoise(typename OutputImageType::PixelType& pix);
144 };
145 
146 }
147 
148 #ifndef ITK_MANUAL_INSTANTIATION
150 #endif
151 
152 #endif //__itkDwiPhantomGenerationFilter_h_
153 
VectorContainer< unsigned int, ItkDirectionImage::Pointer > ItkDirectionImageContainer
void SetSignalRegions(std::vector< ItkUcharImgType::Pointer > signalRegions)
itk::SmartPointer< Self > Pointer
Generation of synthetic diffusion weighted images using a second rank tensor model.
Superclass::OutputImageType OutputImageType
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
void SetTensorDirection(std::vector< vnl_vector_fixed< double, 3 > > directionList)
std::vector< GradientType > GradientListType
itk::Image< unsigned char, 3 > ItkUcharImgType
itk::VectorContainer< int, double > AnglesContainerType
class ITK_EXPORT Image
void SetTensorWeight(std::vector< float > weightList)
Vector< ScalarType, 3 > Vector3D
Definition: mitkVector.h:134
void SetTensorADC(std::vector< float > adcList)
Superclass::OutputImageRegionType OutputImageRegionType
ImageSource< itk::VectorImage< TOutputScalarType, 3 > > Superclass
void SetTensorFA(std::vector< float > faList)
Point< ScalarType, 3 > Point3D
Definition: mitkPoint.h:99
void SetGradientList(GradientListType gradientList)
Image< Vector< float, 3 >, 3 > ItkDirectionImage
unsigned short PixelType