00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkNonUniformBSpline.h,v $ 00005 Language: C++ 00006 Date: $Date: 2010-04-30 17:00:49 $ 00007 Version: $Revision: 1.8 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef __itkNonUniformBSpline_h 00019 #define __itkNonUniformBSpline_h 00020 00021 #if defined(_MSC_VER) 00022 #pragma warning ( disable : 4786 ) 00023 #endif 00024 00025 #include <vector> 00026 00027 #include "itkPoint.h" 00028 #include "itkObject.h" 00029 #include "itkObjectFactory.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 const PointListType & GetPoints() const; 00085 00090 void SetKnots( KnotListType & newKnots); 00091 00095 const KnotListType & GetKnots() const; 00096 00100 void ComputeChordLengths(); 00101 00106 PointType EvaluateSpline(const Array<double> & p) const; 00107 PointType EvaluateSpline( double t ) const; 00109 00113 void ComputeControlPoints(); 00114 00118 void SetControlPoints( ControlPointListType& ctrlpts ); 00119 00123 const ControlPointListType & GetControlPoints() const; 00124 00131 double NonUniformBSplineFunctionRecursive(unsigned int order, unsigned int i, double t) const; 00132 00136 itkSetMacro( SplineOrder, unsigned int ); 00137 itkGetConstReferenceMacro( SplineOrder, unsigned int ); 00139 00140 00141 protected: 00142 00146 NonUniformBSpline(); 00147 00151 virtual ~NonUniformBSpline(); 00152 00156 virtual void PrintSelf( std::ostream& os, Indent indent ) const; 00157 00161 PointListType m_Points; 00162 00166 KnotListType m_Knots; 00167 00171 ControlPointListType m_ControlPoints; 00172 00176 ChordLengthListType m_ChordLength; 00177 00181 ChordLengthListType m_CumulativeChordLength; 00182 00186 unsigned int m_SplineOrder; 00187 00191 unsigned int m_SpatialDimension; 00192 00193 }; 00194 00195 } // end namespace itk 00196 00197 #ifndef ITK_MANUAL_INSTANTIATION 00198 #include "itkNonUniformBSpline.txx" 00199 #endif 00200 00201 00202 #endif // __itkNonUniformBSpline_h 00203