NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkBSplineOperator.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 itkBSplineOperator_h
16 #define itkBSplineOperator_h
17 
18 #include <itkNeighborhoodOperator.h>
19 #include <math.h>
20 
21 namespace itk {
22 
35 template<class TPixel,unsigned int VDimension=2,
36  class TAllocator = NeighborhoodAllocator<TPixel> >
37 class ITK_EXPORT BSplineOperator
38  : public NeighborhoodOperator<TPixel, VDimension, TAllocator>
39 {
40 public:
41 
44  typedef NeighborhoodOperator<TPixel, VDimension, TAllocator> Superclass;
45 
47  BSplineOperator() { this->m_Spacing = 1.0; };
48 
50  BSplineOperator(const Self &other)
51  : NeighborhoodOperator<TPixel, VDimension, TAllocator>(other)
52  {
53  m_Spacing = other.m_Spacing;
54  }
55 
57  Self &operator=(const Self &other)
58  {
59  Superclass::operator=(other);
60  m_Spacing = other.m_Spacing;
61  return *this;
62  }
63 
65  void SetSpacing(double spacing) { this->m_Spacing = spacing; }
66  double GetSpacing() { return this->m_Spacing; }
67 
68 protected:
69 
70  typedef typename Superclass::CoefficientVector CoefficientVector;
71 
73  CoefficientVector GenerateCoefficients();
74 
76  void Fill(const CoefficientVector& coeff)
77  {
78  this->FillCenteredDirectional(coeff);
79  }
80 
81 private:
82 
84  double m_Spacing;
85 
87  const char *GetNameOfClass() { return "itkBSplineOperator"; }
88 
89 };
90 
91 template <class TPixel, unsigned int VDimension, class TContainer>
92 std::ostream & operator<<(std::ostream &os, const BSplineOperator<TPixel,VDimension,TContainer> &bspline)
93 {
94  os << "BSplineOperator:" << std::endl;
95  os << " Radius:" << bspline.GetRadius() << std::endl;
96  os << " Size:" << bspline.GetSize() << std::endl;
97  os << " DataBuffer:" << bspline.GetBufferReference() << std::endl;
98 
99  for (unsigned int i = 0; i < bspline.Size(); i++)
100  {
101  os << " " << i << ":" << bspline[i] << std::endl;
102  }
103  return os;
104 }
105 
106 } // namespace itk
107 
108 
109 #ifndef ITK_MANUAL_INSTANTIATION
110 #include "itkBSplineOperator.txx"
111 #endif
112 
113 #endif
double GetSpacing()
Definition: itkBSplineOperator.h:66
void Fill(const CoefficientVector &coeff)
Definition: itkBSplineOperator.h:76
BSplineOperator Self
Definition: itkBSplineOperator.h:43
Definition: niftkITKAffineResampleImage.cxx:74
Superclass::CoefficientVector CoefficientVector
Definition: itkBSplineOperator.h:70
void SetSpacing(double spacing)
Definition: itkBSplineOperator.h:65
Self & operator=(const Self &other)
Definition: itkBSplineOperator.h:57
BSplineOperator()
Definition: itkBSplineOperator.h:47
BSplineOperator(const Self &other)
Definition: itkBSplineOperator.h:50
A NeighborhoodOperator whose coefficients are a one dimensional, discrete BSpline kernel...
Definition: itkBSplineOperator.h:37
NeighborhoodOperator< TPixel, VDimension, TAllocator > Superclass
Definition: itkBSplineOperator.h:44