KWStyle - itkParametricPath.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkParametricPath.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:43 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17
18 DEF #ifndef _itkParametricPath_h
19 DEF #define _itkParametricPath_h
20
21 #include "itkPath.h"
22 #include "itkContinuousIndex.h"
23 #include "itkIndex.h"
24 #include "itkOffset.h"
25 #include "itkVector.h"
26
27 namespace itk
28 {
29
30
31 /** \class ParametricPath
32  * \brief  Represent a parametric path through ND Space
33  *
34  * This virtual class is intended to represent a parametric path through an
35  * image.   A parametric path maps a single floating-point 1D parameter (usually
36  * designated as either time or arc-length) to a floating-point ND point in
37  * continuous image index space. This mapping is done via the abstract
38  * Evaluate() method, which must be overridden in all instantiable subclasses.
39  * Parametric paths are required to be continuous.  They may be open or form a
40  * closed loop. A parametric path may cross itself several times, although the
41  * end point is constrained to have a unique spatial location unless it is
42  * shared with and only with the starting point (a path tracing the number "9,"
43  * starting at the bottom and ending in the middle of the right side, would
44  * therefore be illegal).  Classic applications of this class include the
45  * representation of contours in 2D images and path smoothing.  Another use of a
46  * path is to guide the movement of an iterator through an image.
47  *
48  * \sa EllipseParametricPath
49  * \sa PolyLineParametricPath
50  * \sa FourierSeriesPath
51  * \sa OrthogonallyCorrectedParametricPath
52  * \sa ChainCodePath
53  * \sa Path
54  * \sa ContinuousIndex
55  * \sa Index
56  * \sa Offset
57  * \sa Vector
58  *
59  * \ingroup PathObjects
60  */
61 template <unsigned int VDimension>
62 class ITK_EXPORT ParametricPath : public
63 Path< double, ContinuousIndex<double,VDimension>, VDimension >
64 {
65 public:
66   /** Standard class typedefs. */
67   typedef ParametricPath Self;
68 TDA   typedef Path<double,ContinuousIndex<double,VDimension>,VDimension> Superclass;
69 TDA   typedef SmartPointer<Self>  Pointer;
70 TDA   typedef SmartPointer<const Self>  ConstPointer;
71   
72   /** Run-time type information (and related methods). */
73   itkTypeMacro(ParametricPath, Path);
74   
75   /** Input type */
76   typedef typename Superclass::InputType  InputType;
77   
78   /** Output type */
79   typedef typename Superclass::OutputType OutputType;
80   
81   
82   /** All paths must be mapable to index space */
83   typedef ContinuousIndex<double,VDimension>  ContinuousIndexType;
84   typedef Index<  VDimension >                IndexType;
85   typedef Offset< VDimension >                OffsetType;
86   typedef Vector<double,VDimension>           VectorType;            
87
88
89   /** Return the nearest index to the parametric path at the specified location.
90    * This is a wrapper to Evaluate(). */
91   virtual IndexType EvaluateToIndex( const InputType & input ) const;
92   
93   /** Increment the input variable passed by reference such that the ND index of
94    * the path  moves to its next vertex-connected (8-connected in 2D) neighbor. 
95    * Return the Index-space offset of the path from its prior input to its new
96    * input.  If the path is unable to increment, input is not changed and an
97    * offset of Zero is returned. Children are not required to implement bounds
98    * checking.
99    *
100    * This is a fairly slow, iterative algorithm that numerically converges to
101    * the next index along the path, in a vertex-connected (8-connected in 2D)
102    * fashion.  When possible, children of this class should overload this
103    * function with something more efficient.
104    *
105    * WARNING:  This default implementation REQUIRES that the ND endpoint of
106    * the path be either unique or coincident only with the startpoint, since it
107    * uses the endpoint as a stopping condition. */
108   virtual OffsetType IncrementInput(InputType & input) const;
109   
110   /** Evaluate the first derivative of the ND output with respect to the 1D
111 IND ***** input.  This is a very simple and naive numerical derivative, and it
112 IND ***** sould be overloaded with a proper closed-form derivative function in
113 IND ***** all children.  Nevertheless, users who need to create their own parametric
114 IND ***** classes for their private research need not reimplement this function if
115 IND ***** their work does not need the derivative operator. */
116   virtual VectorType EvaluateDerivative(const InputType & input) const;
117   
118   itkSetMacro( DefaultInputStepSize, InputType )
119   itkGetConstReferenceMacro( DefaultInputStepSize, InputType )
120   
121   
122 protected:
123   ParametricPath();
124   ~ParametricPath(){}
125   void PrintSelf(std::ostream &os, Indent indent) const;
126   
127   /** Default 1D input increment amount to trace along the path.  Also, the
128    * value used by the defualt implementation of EvaluateDerivative() for
129    * numerically approximating the derivative with the change over a single
130    * default-sized step.  (NOTE that the default implementation of
131    * EvaluateDerivative() should never be used in practice, but users or lazzy
132    * developers may nevertheless unwisely choose to do so anyway.)  For integer-
133    * input-types, 1 is probably the correct value.  For double-input-types,
134    * either 1 or 0.1 are probably good values.  This value should be set in the
135    * constructor of all instantiable children.  Values set in child constructors
136    * overwrite values set in parent constructors. */
137   InputType m_DefaultInputStepSize;
138   
139 private:
140   ParametricPath(const Self&); //purposely not implemented
141   void operator=(const Self&); //purposely not implemented
142   
143 };
144
145
146 // There are non-templated subclasses of ParametricPath
147 // (ex. OrthogonallyCorrected2DParametricPath which is a subclass of
148 // ParametricPath<2>).  We need force all consumers of
149 // ParametericPath<2> to get it from the ITKCommon library.
150 WCM // itkParametricPath.cxx will put ParametricPath<2> in the the
151 // ITKCommon library. Everyone else using a ParametericPath<2> will
152 // load it from the dll.
153 #if (defined(_WIN32) || defined(WIN32)) && !defined(ITKSTATIC) 
154 #  ifndef ITKCommon_EXPORTS
155 IND *****template class __declspec(dllimport) ParametricPath<2>;
156 #endif
157 #endif
158
159 // namespace itk
160
161 #ifndef ITK_MANUAL_INSTANTIATION
162 #include "itkParametricPath.txx"
163 #endif
164
165 #endif
166

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:38PM
© Kitware Inc.