ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkNonUniformBSpline.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkNonUniformBSpline_h
00019 #define __itkNonUniformBSpline_h
00020 
00021 
00022 #include <vector>
00023 
00024 #include "itkPoint.h"
00025 #include "itkObject.h"
00026 #include "itkObjectFactory.h"
00027 #include "itkArray.h"
00028 
00029 namespace itk
00030 {
00045 template< unsigned int TDimension = 3 >
00046 class NonUniformBSpline:
00047   public Object
00048 {
00049 public:
00053   typedef NonUniformBSpline                    Self;
00054   typedef Object                               Superclass;
00055   typedef SmartPointer< Self >                 Pointer;
00056   typedef SmartPointer< const Self >           ConstPointer;
00057   typedef double                               ScalarType;
00058   typedef itk::Point< ScalarType, TDimension > PointType;
00059   typedef std::vector< PointType >             PointListType;
00060   typedef PointListType *                      PointListPointer;
00061   typedef std::vector< double >                KnotListType;
00062   typedef std::vector< double >                CoordinateListType;
00063   typedef itk::Point< double, TDimension >     ControlPointType;
00064   typedef std::vector< ControlPointType >      ControlPointListType;
00065   typedef ControlPointListType *               ControlPointListPointer;
00066   typedef std::vector< double >                ChordLengthListType;
00067 
00069   itkNewMacro(Self);
00070 
00072   itkTypeMacro(NonUniformBSpline, Object);
00073 
00077   void SetPoints(PointListType & newPoints);
00078 
00082   const PointListType & GetPoints() const;
00083 
00088   void SetKnots(KnotListType & newKnots);
00089 
00093   const KnotListType & GetKnots() const;
00094 
00098   void ComputeChordLengths();
00099 
00104   PointType  EvaluateSpline(const Array< double > & p) const;
00105 
00106   PointType  EvaluateSpline(double t) const;
00107 
00111   void ComputeControlPoints();
00112 
00116   void SetControlPoints(ControlPointListType & ctrlpts);
00117 
00121   const ControlPointListType & GetControlPoints() const;
00122 
00129   double NonUniformBSplineFunctionRecursive(unsigned int order, unsigned int i, double t) const;
00130 
00134   itkSetMacro(SplineOrder, unsigned int);
00135   itkGetConstReferenceMacro(SplineOrder, unsigned int);
00136 protected:
00138 
00142   NonUniformBSpline();
00143 
00147   virtual ~NonUniformBSpline();
00148 
00152   virtual void PrintSelf(std::ostream & os, Indent indent) const;
00153 
00157   PointListType m_Points;
00158 
00162   KnotListType m_Knots;
00163 
00167   ControlPointListType m_ControlPoints;
00168 
00172   ChordLengthListType m_ChordLength;
00173 
00177   ChordLengthListType m_CumulativeChordLength;
00178 
00182   unsigned int m_SplineOrder;
00183 
00187   unsigned int m_SpatialDimension;
00188 };
00189 } // end namespace itk
00190 
00191 #ifndef ITK_MANUAL_INSTANTIATION
00192 #include "itkNonUniformBSpline.hxx"
00193 #endif
00194 
00195 #endif // __itkNonUniformBSpline_h
00196