Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 /*===================================================================
18 
19 This file is based heavily on a corresponding ITK filter.
20 
21 ===================================================================*/
22 
23 /*********************************
24  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
25  *********************************/
26 
27 #ifndef __itkNonUniformBSpline_h
28 #define __itkNonUniformBSpline_h
29 
30 #if defined(_MSC_VER)
31 #pragma warning ( disable : 4786 )
32 #endif
33 
34 #include <vector>
35 
36 #include "itkPoint.h"
37 #include "itkObject.h"
38 #include "itkObjectFactory.h"
39 #include "itkArray.h"
40 
41 namespace itk {
42 
56 template < unsigned int TDimension = 3 >
58  : public Object
59 {
60 public:
65  typedef Object Superclass;
68  typedef double ScalarType;
69  typedef itk::Point< ScalarType, TDimension > PointType;
70  typedef std::vector < PointType > PointListType;
71  typedef PointListType * PointListPointer;
72  typedef std::vector < double > KnotListType;
73  typedef std::vector<double> CoordinateListType;
74  typedef itk::Point<double, TDimension > ControlPointType;
75  typedef std::vector< ControlPointType > ControlPointListType;
76  typedef ControlPointListType * ControlPointListPointer;
77  typedef std::vector<double> ChordLengthListType;
78 
80  itkFactorylessNewMacro(Self)
81  itkCloneMacro(Self)
82 
84  itkTypeMacro( NonUniformBSpline, Object );
85 
89  void SetPoints( PointListType & newPoints );
90 
94  const PointListType & GetPoints() const;
95 
100  void SetKnots( KnotListType & newKnots);
101 
105  const KnotListType & GetKnots() const;
106 
110  void ComputeChordLengths();
111 
116  PointType EvaluateSpline(const Array<double> & p) const;
117  PointType EvaluateSpline( double t ) const;
118 
122  void ComputeControlPoints();
123 
127  void SetControlPoints( ControlPointListType& ctrlpts );
128 
132  const ControlPointListType & GetControlPoints() const;
133 
140  double NonUniformBSplineFunctionRecursive(unsigned int order, unsigned int i, double t) const;
141 
145  itkSetMacro( SplineOrder, unsigned int );
146  itkGetConstReferenceMacro( SplineOrder, unsigned int );
147 
148 
149 protected:
150 
154  NonUniformBSpline();
155 
159  virtual ~NonUniformBSpline();
160 
164  virtual void PrintSelf( std::ostream& os, Indent indent ) const override;
165 
169  PointListType m_Points;
170 
174  KnotListType m_Knots;
175 
179  ControlPointListType m_ControlPoints;
180 
184  ChordLengthListType m_ChordLength;
185 
189  ChordLengthListType m_CumulativeChordLength;
190 
194  unsigned int m_SplineOrder;
195 
199  unsigned int m_SpatialDimension;
200 
201 };
202 
203 } // end namespace itk
204 
205 #ifndef ITK_MANUAL_INSTANTIATION
207 #endif
208 
209 
210 #endif // __itkNonUniformBSpline_h
void SetControlPoints(ControlPointListType &ctrlpts)
const KnotListType & GetKnots() const
PointType EvaluateSpline(const Array< double > &p) const
virtual void PrintSelf(std::ostream &os, Indent indent) const override
SmartPointer< Self > Pointer
STL namespace.
SmartPointer< const Self > ConstPointer
ControlPointListType * ControlPointListPointer
std::vector< double > CoordinateListType
itk::Point< ScalarType, TDimension > PointType
void SetKnots(KnotListType &newKnots)
double NonUniformBSplineFunctionRecursive(unsigned int order, unsigned int i, double t) const
const PointListType & GetPoints() const
std::vector< ControlPointType > ControlPointListType
void SetPoints(PointListType &newPoints)
BSpline with nonuniform knot spacing.
ChordLengthListType m_CumulativeChordLength
const ControlPointListType & GetControlPoints() const
std::vector< PointType > PointListType
itk::Point< double, TDimension > ControlPointType
ChordLengthListType m_ChordLength
std::vector< double > ChordLengthListType
ControlPointListType m_ControlPoints
std::vector< double > KnotListType