NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkOrderedTraversalStreamlinesFilter.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 itkOrderedTraversalStreamlinesFilter_h
16 #define itkOrderedTraversalStreamlinesFilter_h
17 
18 #include <itkImage.h>
19 #include <itkVector.h>
21 #include <itkVectorInterpolateImageFunction.h>
22 #include <itkInterpolateImageFunction.h>
23 
24 #include <queue>
25 
26 namespace itk {
45 template < class TImageType, typename TScalarType=double, unsigned int NDimensions=3 >
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(OrderedTraversalStreamlinesFilter, 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 typename InputScalarImageType::PointType InputScalarImagePointType;
75  typedef typename InputScalarImageType::Pointer InputScalarImagePointer;
77  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;
86 
87  typedef VectorInterpolateImageFunction<InputVectorImageType
88  ,TScalarType
90  typedef typename VectorInterpolatorType::Pointer VectorInterpolatorPointer;
91  typedef typename VectorInterpolatorType::PointType VectorInterpolatorPointType;
92  typedef InterpolateImageFunction< InputScalarImageType
93  ,TScalarType > ScalarInterpolatorType;
94  typedef typename ScalarInterpolatorType::Pointer ScalarInterpolatorPointer;
95  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 
104 protected:
107  void PrintSelf(std::ostream& os, Indent indent) const;
108 
109  // The main filter method. Note, single threaded.
110  virtual void GenerateData();
111 
112  // Typedefs used internally.
113  typedef std::pair<TScalarType, InputScalarImageIndexType> Pair;
114  typedef std::multimap<TScalarType, InputScalarImageIndexType> MinMap;
115  typedef typename MinMap::iterator MinMapIterator;
116  typedef typename MinMap::reverse_iterator MinMapReverseIterator;
117 
118 private:
119 
123  OrderedTraversalStreamlinesFilter(const Self&);
124  void operator=(const Self&);
125 
131  OutputImagePixelType GetLaplacian(const InputScalarImageIndexType& index,
132  const int& offset,
133  const typename InputScalarImageType::Pointer& scalarImage);
139  OutputImagePixelType Solve(const InputScalarImageIndexType& index,
140  const int& offset,
141  const typename InputVectorImageType::Pointer& vectorImage,
142  const typename OutputImageType::Pointer& distanceImage);
143 
148  bool IsNextToBoundary(const InputScalarImageIndexType& index,
149  const typename InputScalarImageType::Pointer& scalarImage,
150  const typename StatusImageType::Pointer& statusImage,
151  const InputScalarImagePixelType& threshold);
152 
158  void DoOrderedTraversal(const int& offset,
159  const InputScalarImagePixelType& threshold,
160  const typename InputScalarImageType::Pointer& scalarImage,
161  const typename InputVectorImageType::Pointer& vectorImage,
162  const typename OutputImageType::Pointer& distanceImage);
163 
164  // TODO: Sort these out, make them const static.
165  unsigned char BOUNDARY;
166  unsigned char FIRST_PASS;
167  unsigned char UNVISITED;
168  unsigned char VISITED;
169  unsigned char SOLVED;
170 
171 };
172 
173 } // end namespace
174 
175 #ifndef ITK_MANUAL_INSTANTIATION
176 #include "itkOrderedTraversalStreamlinesFilter.txx"
177 #endif
178 
179 #endif
InputScalarImageType::IndexType InputScalarImageIndexType
Definition: itkOrderedTraversalStreamlinesFilter.h:76
InputScalarImageType::PointType InputScalarImagePointType
Definition: itkOrderedTraversalStreamlinesFilter.h:74
MinMap::reverse_iterator MinMapReverseIterator
Definition: itkOrderedTraversalStreamlinesFilter.h:116
InputVectorImageType::ConstPointer InputVectorImageConstPointer
Definition: itkOrderedTraversalStreamlinesFilter.h:70
ImageType::SizeType SizeType
Definition: niftkMakeLapUSProbeBasicModel.cxx:31
OutputImageType::Pointer OutputImagePointer
Definition: itkOrderedTraversalStreamlinesFilter.h:82
VectorInterpolateImageFunction< InputVectorImageType,TScalarType > VectorInterpolatorType
Definition: itkOrderedTraversalStreamlinesFilter.h:89
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: glew.h:4052
InputScalarImageType::ConstPointer InputScalarImageConstPointer
Definition: itkOrderedTraversalStreamlinesFilter.h:77
OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkOrderedTraversalStreamlinesFilter.h:83
OutputImageType::SpacingType OutputImageSpacingType
Definition: itkOrderedTraversalStreamlinesFilter.h:85
~OrderedTraversalStreamlinesFilter()
Definition: itkOrderedTraversalStreamlinesFilter.h:106
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
void SetScalarImage(const InputScalarImageType *image)
Definition: itkOrderedTraversalStreamlinesFilter.h:99
InterpolateImageFunction< InputScalarImageType,TScalarType > ScalarInterpolatorType
Definition: itkOrderedTraversalStreamlinesFilter.h:93
GLintptr offset
Definition: glew.h:1666
Image< InputScalarImagePixelType, NDimensions > InputScalarImageType
Definition: itkOrderedTraversalStreamlinesFilter.h:73
InputScalarImageType OutputImageType
Definition: itkOrderedTraversalStreamlinesFilter.h:80
std::multimap< TScalarType, InputScalarImageIndexType > MinMap
Definition: itkOrderedTraversalStreamlinesFilter.h:114
Image< unsigned char, Dimension > StatusImageType
Definition: itkOrderedTraversalStreamlinesFilter.h:96
MinMap::iterator MinMapIterator
Definition: itkOrderedTraversalStreamlinesFilter.h:115
InputScalarImageType::Pointer InputScalarImagePointer
Definition: itkOrderedTraversalStreamlinesFilter.h:75
VectorInterpolatorType::PointType VectorInterpolatorPointType
Definition: itkOrderedTraversalStreamlinesFilter.h:91
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
OutputImageType::IndexType OutputImageIndexType
Definition: itkOrderedTraversalStreamlinesFilter.h:84
ScalarInterpolatorType::PointType ScalarInterpolatorPointType
Definition: itkOrderedTraversalStreamlinesFilter.h:95
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30
InputVectorImageType::IndexType InputVectorImageIndexType
Definition: itkOrderedTraversalStreamlinesFilter.h:71
ScalarInterpolatorType::Pointer ScalarInterpolatorPointer
Definition: itkOrderedTraversalStreamlinesFilter.h:94
OutputImageType::PixelType OutputImagePixelType
Definition: itkOrderedTraversalStreamlinesFilter.h:81
Calculates length between two boundaries, solving PDE by ordered traversal.
Definition: itkOrderedTraversalStreamlinesFilter.h:46
GLuint index
Definition: glew.h:1798
InputScalarImageType::RegionType InputScalarImageRegionType
Definition: itkOrderedTraversalStreamlinesFilter.h:78
Image< InputVectorImagePixelType, NDimensions > InputVectorImageType
Definition: itkOrderedTraversalStreamlinesFilter.h:68
OrderedTraversalStreamlinesFilter Self
Definition: itkOrderedTraversalStreamlinesFilter.h:52
void SetVectorImage(const InputVectorImageType *image)
Definition: itkOrderedTraversalStreamlinesFilter.h:102
SmartPointer< Self > Pointer
Definition: itkOrderedTraversalStreamlinesFilter.h:54
SmartPointer< const Self > ConstPointer
Definition: itkOrderedTraversalStreamlinesFilter.h:55
Simultaneous itk::Image and itk::Array (and hence vnl_vector) class.
const unsigned int Dimension
Definition: niftkBreastDCEandADC.cxx:89
TScalarType InputScalarImagePixelType
Definition: itkOrderedTraversalStreamlinesFilter.h:72
InputScalarImageType::SizeType InputScalarImageSizeType
Definition: itkOrderedTraversalStreamlinesFilter.h:79
InputVectorImageType::Pointer InputVectorImagePointer
Definition: itkOrderedTraversalStreamlinesFilter.h:69
Vector< TScalarType, NDimensions > InputVectorImagePixelType
Definition: itkOrderedTraversalStreamlinesFilter.h:67
VectorInterpolatorType::Pointer VectorInterpolatorPointer
Definition: itkOrderedTraversalStreamlinesFilter.h:90
std::pair< TScalarType, InputScalarImageIndexType > Pair
Definition: itkOrderedTraversalStreamlinesFilter.h:113
BaseCTEStreamlinesFilter< TImageType, TScalarType, NDimensions > Superclass
Definition: itkOrderedTraversalStreamlinesFilter.h:53