Medical Imaging Interaction Toolkit  2021.10.99-1c4db16f
Medical Imaging Interaction Toolkit
mitkItkNonUniformBSpline.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 /*===================================================================
14 
15 This file is based heavily on a corresponding ITK filter.
16 
17 ===================================================================*/
18 
19 /*********************************
20  This file was taken from ITK, CVS version 1.8 to circumvent a bug in ITK release 3.18 (see http://public.kitware.com/Bug/view.php?id=10633
21  *********************************/
22 
23 #ifndef __itkNonUniformBSpline_h
24 #define __itkNonUniformBSpline_h
25 
26 #if defined(_MSC_VER)
27 #pragma warning ( disable : 4786 )
28 #endif
29 
30 #include <vector>
31 
32 #include "itkPoint.h"
33 #include "itkObject.h"
34 #include "itkObjectFactory.h"
35 #include "itkArray.h"
36 
37 namespace itk {
38 
52 template < unsigned int TDimension = 3 >
54  : public Object
55 {
56 public:
61  typedef Object Superclass;
64  typedef double ScalarType;
65  typedef itk::Point< ScalarType, TDimension > PointType;
66  typedef std::vector < PointType > PointListType;
67  typedef PointListType * PointListPointer;
68  typedef std::vector < double > KnotListType;
69  typedef std::vector<double> CoordinateListType;
70  typedef itk::Point<double, TDimension > ControlPointType;
71  typedef std::vector< ControlPointType > ControlPointListType;
72  typedef ControlPointListType * ControlPointListPointer;
73  typedef std::vector<double> ChordLengthListType;
74 
76  itkFactorylessNewMacro(Self);
77  itkCloneMacro(Self);
78 
80  itkTypeMacro( NonUniformBSpline, Object );
81 
85  void SetPoints( PointListType & newPoints );
86 
90  const PointListType & GetPoints() const;
91 
96  void SetKnots( KnotListType & newKnots);
97 
101  const KnotListType & GetKnots() const;
102 
106  void ComputeChordLengths();
107 
112  PointType EvaluateSpline(const Array<double> & p) const;
113  PointType EvaluateSpline( double t ) const;
114 
118  void ComputeControlPoints();
119 
123  void SetControlPoints( ControlPointListType& ctrlpts );
124 
128  const ControlPointListType & GetControlPoints() const;
129 
136  double NonUniformBSplineFunctionRecursive(unsigned int order, unsigned int i, double t) const;
137 
141  itkSetMacro( SplineOrder, unsigned int );
142  itkGetConstReferenceMacro( SplineOrder, unsigned int );
143 
144 
145 protected:
146 
151 
155  ~NonUniformBSpline() override;
156 
160  void PrintSelf( std::ostream& os, Indent indent ) const override;
161 
165  PointListType m_Points;
166 
170  KnotListType m_Knots;
171 
175  ControlPointListType m_ControlPoints;
176 
180  ChordLengthListType m_ChordLength;
181 
185  ChordLengthListType m_CumulativeChordLength;
186 
190  unsigned int m_SplineOrder;
191 
195  unsigned int m_SpatialDimension;
196 
197 };
198 
199 } // end namespace itk
200 
201 #ifndef ITK_MANUAL_INSTANTIATION
202 #include "mitkItkNonUniformBSpline.txx"
203 #endif
204 
205 
206 #endif // __itkNonUniformBSpline_h
~NonUniformBSpline() override
void SetControlPoints(ControlPointListType &ctrlpts)
void PrintSelf(std::ostream &os, Indent indent) const override
SmartPointer< Self > Pointer
SmartPointer< const Self > ConstPointer
ControlPointListType * ControlPointListPointer
std::vector< double > CoordinateListType
itk::Point< ScalarType, TDimension > PointType
const PointListType & GetPoints() const
PointType EvaluateSpline(const Array< double > &p) const
void SetKnots(KnotListType &newKnots)
std::vector< ControlPointType > ControlPointListType
void SetPoints(PointListType &newPoints)
const ControlPointListType & GetControlPoints() const
BSpline with nonuniform knot spacing.
ChordLengthListType m_CumulativeChordLength
std::vector< PointType > PointListType
itk::Point< double, TDimension > ControlPointType
const KnotListType & GetKnots() const
ChordLengthListType m_ChordLength
std::vector< double > ChordLengthListType
double NonUniformBSplineFunctionRecursive(unsigned int order, unsigned int i, double t) const
ControlPointListType m_ControlPoints
std::vector< double > KnotListType