ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkNonUniformBSpline.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkNonUniformBSpline_h
19 #define itkNonUniformBSpline_h
20 #if !defined( ITK_LEGACY_REMOVE )
21 
22 
23 #include <vector>
24 
25 #include "itkPoint.h"
26 #include "itkObject.h"
27 #include "itkObjectFactory.h"
28 #include "itkArray.h"
29 
30 namespace itk
31 {
47 template< unsigned int TDimension = 3 >
48 class NonUniformBSpline:
49  public Object
50 {
51 public:
55  typedef NonUniformBSpline Self;
56  typedef Object Superclass;
57  typedef SmartPointer< Self > Pointer;
58  typedef SmartPointer< const Self > ConstPointer;
59  typedef double ScalarType;
60  typedef itk::Point< ScalarType, TDimension > PointType;
61  typedef std::vector< PointType > PointListType;
62  typedef PointListType * PointListPointer;
63  typedef std::vector< double > KnotListType;
64  typedef std::vector< double > CoordinateListType;
65  typedef itk::Point< double, TDimension > ControlPointType;
66  typedef std::vector< ControlPointType > ControlPointListType;
67  typedef ControlPointListType * ControlPointListPointer;
68  typedef std::vector< double > ChordLengthListType;
69 
71  itkNewMacro(Self);
72 
74  itkTypeMacro(NonUniformBSpline, Object);
75 
79  void SetPoints(PointListType & newPoints);
80 
84  const PointListType & GetPoints() const;
85 
90  void SetKnots(KnotListType & newKnots);
91 
95  const KnotListType & GetKnots() const;
96 
100  void ComputeChordLengths();
101 
106  PointType EvaluateSpline(const Array< double > & p) const;
107 
108  PointType EvaluateSpline(double t) const;
109 
113  void ComputeControlPoints();
114 
118  void SetControlPoints(ControlPointListType & ctrlpts);
119 
123  const ControlPointListType & GetControlPoints() const;
124 
131  double NonUniformBSplineFunctionRecursive(unsigned int order, unsigned int i, double t) const;
132 
136  itkSetMacro(SplineOrder, unsigned int);
137  itkGetConstReferenceMacro(SplineOrder, unsigned int);
139 
140 protected:
141 
145  NonUniformBSpline();
146 
150  virtual ~NonUniformBSpline();
151 
155  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
156 
160  PointListType m_Points;
161 
165  KnotListType m_Knots;
166 
170  ControlPointListType m_ControlPoints;
171 
175  ChordLengthListType m_ChordLength;
176 
180  ChordLengthListType m_CumulativeChordLength;
181 
185  unsigned int m_SplineOrder;
186 
190  unsigned int m_SpatialDimension;
191 };
192 } // end namespace itk
193 
194 #ifndef ITK_MANUAL_INSTANTIATION
195 #include "itkNonUniformBSpline.hxx"
196 #endif
197 
198 #endif //#if !defined( ITK_LEGACY_REMOVE )
199 #endif // itkNonUniformBSpline_h
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:51