00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #if defined(_MSC_VER)
00020 #pragma warning ( disable : 4786 )
00021 #endif
00022
00023 #ifndef __itkNonUniformBSpline_h
00024 #define __itkNonUniformBSpline_h
00025
00026 #include <vector>
00027
00028 #include "itkPoint.h"
00029 #include "itkObject.h"
00030 #include "itkArray.h"
00031
00032 namespace itk {
00033
00047 template < unsigned int TDimension = 3 >
00048 class NonUniformBSpline
00049 : public Object
00050 {
00051 public:
00055 typedef NonUniformBSpline Self;
00056 typedef Object Superclass;
00057 typedef SmartPointer < Self > Pointer;
00058 typedef SmartPointer < const Self > ConstPointer;
00059 typedef double ScalarType;
00060 typedef itk::Point< ScalarType, TDimension > PointType;
00061 typedef std::vector < PointType > PointListType;
00062 typedef PointListType * PointListPointer;
00063 typedef std::vector < double > KnotListType;
00064 typedef std::vector<double> CoordinateListType;
00065 typedef itk::Point<double, TDimension > ControlPointType;
00066 typedef std::vector< ControlPointType > ControlPointListType;
00067 typedef ControlPointListType * ControlPointListPointer;
00068 typedef std::vector<double> ChordLengthListType;
00069
00071 itkNewMacro( Self );
00072
00074 itkTypeMacro( NonUniformBSpline, Object );
00075
00079 void SetPoints( PointListType & newPoints );
00080
00084 PointListType& GetPoints()
00085 {
00086 return m_Points;
00087 }
00088
00093 void SetKnots( KnotListType & newKnots);
00094
00098 KnotListType& GetKnots();
00099
00103 void ComputeChordLengths();
00104
00109 PointType EvaluateSpline(const Array<double> & p) const;
00110 PointType EvaluateSpline( double t ) const;
00111
00115 void ComputeControlPoints();
00116
00120 void SetControlPoints( ControlPointListType& ctrlpts );
00121
00125 ControlPointListType& GetControlPoints()
00126 {
00127 return m_ControlPoints;
00128 }
00129
00136 double NonUniformBSplineFunctionRecursive(unsigned int order, unsigned int i, double t) const;
00137
00141 void SetSplineOrder(unsigned int order)
00142 {
00143 m_SplineOrder = order;
00144 this->Modified();
00145 }
00146
00150 unsigned int GetSplineOrder()
00151 {
00152 return m_SplineOrder;
00153 }
00154
00155 protected:
00156
00160 NonUniformBSpline();
00161
00165 virtual ~NonUniformBSpline();
00166
00170 virtual void PrintSelf( std::ostream& os, Indent indent ) const;
00171
00175 PointListType m_Points;
00176
00180 KnotListType m_Knots;
00181
00185 ControlPointListType m_ControlPoints;
00186
00190 ChordLengthListType m_ChordLength;
00191
00195 ChordLengthListType m_CumulativeChordLength;
00196
00200 unsigned int m_SplineOrder;
00201
00205 unsigned int m_SpatialDimension;
00206
00207 };
00208
00209 }
00210
00211 #ifndef ITK_MANUAL_INSTANTIATION
00212 #include "itkNonUniformBSpline.txx"
00213 #endif
00214
00215
00216 #endif // __itkNonUniformBSpline_h