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 /********************************* 00019 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 00020 *********************************/ 00021 00022 #ifndef __itkNonUniformBSpline_h 00023 #define __itkNonUniformBSpline_h 00024 00025 #if defined(_MSC_VER) 00026 #pragma warning ( disable : 4786 ) 00027 #endif 00028 00029 #include <vector> 00030 00031 #include "itkPoint.h" 00032 #include "itkObject.h" 00033 #include "itkObjectFactory.h" 00034 #include "itkArray.h" 00035 00036 namespace itk { 00037 00051 template < unsigned int TDimension = 3 > 00052 class NonUniformBSpline 00053 : public Object 00054 { 00055 public: 00059 typedef NonUniformBSpline Self; 00060 typedef Object Superclass; 00061 typedef SmartPointer < Self > Pointer; 00062 typedef SmartPointer < const Self > ConstPointer; 00063 typedef double ScalarType; 00064 typedef itk::Point< ScalarType, TDimension > PointType; 00065 typedef std::vector < PointType > PointListType; 00066 typedef PointListType * PointListPointer; 00067 typedef std::vector < double > KnotListType; 00068 typedef std::vector<double> CoordinateListType; 00069 typedef itk::Point<double, TDimension > ControlPointType; 00070 typedef std::vector< ControlPointType > ControlPointListType; 00071 typedef ControlPointListType * ControlPointListPointer; 00072 typedef std::vector<double> ChordLengthListType; 00073 00075 itkNewMacro( Self ); 00076 00078 itkTypeMacro( NonUniformBSpline, Object ); 00079 00083 void SetPoints( PointListType & newPoints ); 00084 00088 const PointListType & GetPoints() const; 00089 00094 void SetKnots( KnotListType & newKnots); 00095 00099 const KnotListType & GetKnots() const; 00100 00104 void ComputeChordLengths(); 00105 00110 PointType EvaluateSpline(const Array<double> & p) const; 00111 PointType EvaluateSpline( double t ) const; 00112 00116 void ComputeControlPoints(); 00117 00121 void SetControlPoints( ControlPointListType& ctrlpts ); 00122 00126 const ControlPointListType & GetControlPoints() const; 00127 00134 double NonUniformBSplineFunctionRecursive(unsigned int order, unsigned int i, double t) const; 00135 00139 itkSetMacro( SplineOrder, unsigned int ); 00140 itkGetConstReferenceMacro( SplineOrder, unsigned int ); 00141 00142 00143 protected: 00144 00148 NonUniformBSpline(); 00149 00153 virtual ~NonUniformBSpline(); 00154 00158 virtual void PrintSelf( std::ostream& os, Indent indent ) const; 00159 00163 PointListType m_Points; 00164 00168 KnotListType m_Knots; 00169 00173 ControlPointListType m_ControlPoints; 00174 00178 ChordLengthListType m_ChordLength; 00179 00183 ChordLengthListType m_CumulativeChordLength; 00184 00188 unsigned int m_SplineOrder; 00189 00193 unsigned int m_SpatialDimension; 00194 00195 }; 00196 00197 } // end namespace itk 00198 00199 #ifndef ITK_MANUAL_INSTANTIATION 00200 #include "itkNonUniformBSpline.txx" 00201 #endif 00202 00203 00204 #endif // __itkNonUniformBSpline_h