NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkRelaxStreamlinesFilter.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef itkRelaxStreamlinesFilter_h
16 #define itkRelaxStreamlinesFilter_h
17 
18 #include <itkImage.h>
19 #include <itkVector.h>
20 #include <itkPoint.h>
22 #include <itkVectorInterpolateImageFunction.h>
23 #include <itkInterpolateImageFunction.h>
24 
25 
26 namespace itk {
45 template < class TImageType, typename TScalarType, unsigned int NDimensions>
46 class ITK_EXPORT RelaxStreamlinesFilter :
47  public BaseCTEStreamlinesFilter<TImageType, TScalarType, NDimensions>
48 {
49 public:
50 
54  typedef SmartPointer<Self> Pointer;
55  typedef SmartPointer<const Self> ConstPointer;
56 
58  itkNewMacro(Self);
59 
61  itkTypeMacro(RelaxStreamlinesFilter, BaseStreamlinesFilter);
62 
64  itkStaticConstMacro(Dimension, unsigned int, NDimensions);
65 
67  typedef Vector< TScalarType, NDimensions > InputVectorImagePixelType;
69  typedef typename InputVectorImageType::Pointer InputVectorImagePointer;
70  typedef typename InputVectorImageType::ConstPointer InputVectorImageConstPointer;
72  typedef TScalarType InputScalarImagePixelType;
74  typedef Point<TScalarType, NDimensions> InputScalarImagePointType;
75  typedef typename InputScalarImageType::SpacingType InputScalarImageSpacingType;
76  typedef typename InputScalarImageType::Pointer InputScalarImagePointer;
78  typedef typename InputScalarImageType::ConstPointer InputScalarImageConstPointer;
80  typedef InputScalarImageType OutputImageType;
82  typedef typename OutputImageType::Pointer OutputImagePointer;
83  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
85  typedef typename OutputImageType::SpacingType OutputImageSpacingType;
88  typedef VectorInterpolateImageFunction<InputVectorImageType
89  ,TScalarType
91  typedef typename VectorInterpolatorType::Pointer VectorInterpolatorPointer;
92  typedef typename VectorInterpolatorType::PointType VectorInterpolatorPointType;
93  typedef InterpolateImageFunction< InputScalarImageType
94  ,TScalarType > ScalarInterpolatorType;
95  typedef typename ScalarInterpolatorType::Pointer ScalarInterpolatorPointer;
96  typedef typename ScalarInterpolatorType::PointType ScalarInterpolatorPointType;
97 
99  void SetScalarImage(const InputScalarImageType *image) {this->SetNthInput(0, const_cast<InputScalarImageType *>(image)); }
100 
102  void SetVectorImage(const InputVectorImageType* image) { this->SetNthInput(1, const_cast<InputVectorImageType *>(image)); }
103 
105  void SetSegmentedImage(const InputScalarImageType *image) {this->SetNthInput(2, const_cast<InputScalarImageType *>(image)); }
106 
108  itkSetMacro(EpsilonConvergenceThreshold, double);
109  itkGetMacro(EpsilonConvergenceThreshold, double);
110 
112  itkSetMacro(MaximumNumberOfIterations, unsigned long int );
113  itkGetMacro(MaximumNumberOfIterations, unsigned long int );
114 
116  itkSetMacro(MaximumLength, double );
117  itkGetMacro(MaximumLength, double );
118 
120  itkSetMacro(InitializeBoundaries, bool);
121  itkGetMacro(InitializeBoundaries, bool);
122 
123  OutputImageType* GetL0Image() const { return m_L0Image.GetPointer(); }
124  OutputImageType* GetL1Image() const { return m_L1Image.GetPointer(); }
125 
126 protected:
129  void PrintSelf(std::ostream& os, Indent indent) const;
130 
131  // The main filter method. Note, single threaded.
132  virtual void GenerateData();
133 
134  // We set the whole of L0 and L1 image to zero,
135  // and extract the set of GM voxels. We then
136  // call this method to initialize the boundaries.
137  // The implementation in this class does nothing.
138  // However, derived classes can initialize points in
139  // the L0 and L1 image, and also change the size of
140  // the listOfGreyMatterPixels vector.
141  virtual void InitializeBoundaries(
142  std::vector<InputScalarImageIndexType>& completeListOfGreyMatterPixels,
143  InputScalarImageType* scalarImage,
144  InputVectorImageType* vectorImage,
145  OutputImageType* L0Image,
146  OutputImageType* L1Image,
147  std::vector<InputScalarImageIndexType>& L0greyList,
148  std::vector<InputScalarImageIndexType>& L1greyList
149  );
150 
152  virtual void SolvePDE(
153  bool isInnerBoundary,
154  std::vector<InputScalarImageIndexType>& listOfGreyPixels,
155  InputScalarImageType* scalarImage,
156  InputVectorImageType* vectorImage,
157  OutputImageType* outputImage
158  );
159 
162 
164  unsigned long int m_MaximumNumberOfIterations;
165 
168 
171 
172 private:
173 
177  RelaxStreamlinesFilter(const Self&);
178  void operator=(const Self&);
179 
181  OutputImagePointer m_L0Image;
182  OutputImagePointer m_L1Image;
183 
184 };
185 
186 } // end namespace
187 
188 #ifndef ITK_MANUAL_INSTANTIATION
189 #include "itkRelaxStreamlinesFilter.txx"
190 #endif
191 
192 #endif
OutputImageType * GetL1Image() const
Definition: itkRelaxStreamlinesFilter.h:124
OutputImageType::Pointer OutputImagePointer
Definition: itkRelaxStreamlinesFilter.h:82
unsigned long int m_MaximumNumberOfIterations
Definition: itkRelaxStreamlinesFilter.h:164
bool m_InitializeBoundaries
Definition: itkRelaxStreamlinesFilter.h:170
ImageType::SizeType SizeType
Definition: niftkMakeLapUSProbeBasicModel.cxx:31
double m_MaximumLength
Definition: itkRelaxStreamlinesFilter.h:167
InputScalarImageType::SpacingType InputScalarImageSpacingType
Definition: itkRelaxStreamlinesFilter.h:75
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: glew.h:4052
Point< TScalarType, NDimensions > InputScalarImagePointType
Definition: itkRelaxStreamlinesFilter.h:74
InputVectorImageType::IndexType InputVectorImageIndexType
Definition: itkRelaxStreamlinesFilter.h:71
Definition: niftkITKAffineResampleImage.cxx:74
Base class for filters that calculate thicknesses based on Laplacian streamlines. ...
Definition: itkBaseCTEStreamlinesFilter.h:36
ImageType::IndexType IndexType
Definition: niftkMakeLapUSProbeBasicModel.cxx:32
OutputImageType * GetL0Image() const
Definition: itkRelaxStreamlinesFilter.h:123
SmartPointer< const Self > ConstPointer
Definition: itkRelaxStreamlinesFilter.h:55
VectorInterpolateImageFunction< InputVectorImageType,TScalarType > VectorInterpolatorType
Definition: itkRelaxStreamlinesFilter.h:90
InputScalarImageType::ConstPointer InputScalarImageConstPointer
Definition: itkRelaxStreamlinesFilter.h:78
Vector< TScalarType, NDimensions > InputVectorImagePixelType
Definition: itkRelaxStreamlinesFilter.h:67
InterpolateImageFunction< InputScalarImageType,TScalarType > ScalarInterpolatorType
Definition: itkRelaxStreamlinesFilter.h:94
OutputImageType::SpacingType OutputImageSpacingType
Definition: itkRelaxStreamlinesFilter.h:85
OutputImageType::SizeType OutputImageSizeType
Definition: itkRelaxStreamlinesFilter.h:87
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
TScalarType InputScalarImagePixelType
Definition: itkRelaxStreamlinesFilter.h:72
Image< InputScalarImagePixelType, NDimensions > InputScalarImageType
Definition: itkRelaxStreamlinesFilter.h:73
BaseCTEStreamlinesFilter< TImageType, TScalarType, NDimensions > Superclass
Definition: itkRelaxStreamlinesFilter.h:53
Calculates length between two boundaries, solving PDE by iterative relaxation.
Definition: itkRelaxStreamlinesFilter.h:46
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30
ScalarInterpolatorType::PointType ScalarInterpolatorPointType
Definition: itkRelaxStreamlinesFilter.h:96
InputVectorImageType::Pointer InputVectorImagePointer
Definition: itkRelaxStreamlinesFilter.h:69
VectorInterpolatorType::PointType VectorInterpolatorPointType
Definition: itkRelaxStreamlinesFilter.h:92
OutputImageType::IndexType OutputImageIndexType
Definition: itkRelaxStreamlinesFilter.h:84
VectorInterpolatorType::Pointer VectorInterpolatorPointer
Definition: itkRelaxStreamlinesFilter.h:91
InputScalarImageType OutputImageType
Definition: itkRelaxStreamlinesFilter.h:80
void SetSegmentedImage(const InputScalarImageType *image)
Definition: itkRelaxStreamlinesFilter.h:105
InputScalarImageType::IndexType InputScalarImageIndexType
Definition: itkRelaxStreamlinesFilter.h:77
RelaxStreamlinesFilter Self
Definition: itkRelaxStreamlinesFilter.h:52
OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkRelaxStreamlinesFilter.h:83
Simultaneous itk::Image and itk::Array (and hence vnl_vector) class.
const unsigned int Dimension
Definition: niftkBreastDCEandADC.cxx:89
Image< InputVectorImagePixelType, NDimensions > InputVectorImageType
Definition: itkRelaxStreamlinesFilter.h:68
void SetScalarImage(const InputScalarImageType *image)
Definition: itkRelaxStreamlinesFilter.h:99
OutputImageType::RegionType OutputImageRegionType
Definition: itkRelaxStreamlinesFilter.h:86
void SetVectorImage(const InputVectorImageType *image)
Definition: itkRelaxStreamlinesFilter.h:102
InputScalarImageType::RegionType InputScalarImageRegionType
Definition: itkRelaxStreamlinesFilter.h:79
OutputImageType::PixelType OutputImagePixelType
Definition: itkRelaxStreamlinesFilter.h:81
double m_EpsilonConvergenceThreshold
Definition: itkRelaxStreamlinesFilter.h:161
ScalarInterpolatorType::Pointer ScalarInterpolatorPointer
Definition: itkRelaxStreamlinesFilter.h:95
SmartPointer< Self > Pointer
Definition: itkRelaxStreamlinesFilter.h:54
InputScalarImageType::Pointer InputScalarImagePointer
Definition: itkRelaxStreamlinesFilter.h:76
InputVectorImageType::ConstPointer InputVectorImageConstPointer
Definition: itkRelaxStreamlinesFilter.h:70