| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkPolyLineParametricPath.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:45 $ |
| 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 _itkPolyLineParametricPathPath_h |
| 19 |
DEF |
#define _itkPolyLineParametricPathPath_h |
| 20 |
|
|
| 21 |
|
#include "itkParametricPath.h" |
| 22 |
|
#include "itkVectorContainer.h" |
| 23 |
|
#include "itkContinuousIndex.h" |
| 24 |
|
#include "itkIndex.h" |
| 25 |
|
#include "itkOffset.h" |
| 26 |
|
#include "itkVector.h" |
| 27 |
|
|
| 28 |
|
namespace itk |
| 29 |
|
{ |
| 30 |
|
|
| 31 |
|
|
| 32 |
|
/** \class PolyLineParametricPath |
| 33 |
|
* \brief Represent a path of line segments through ND Space |
| 34 |
|
* |
| 35 |
|
* This class is intended to represent parametric paths through an image, where |
| 36 |
|
* the paths are composed of line segments. Each line segment traverses one |
| 37 |
|
* unit of input. A classic application of this class is the representation of |
| 38 |
|
* contours in 2D images, especially when the contours only need to be |
| 39 |
|
* approximately correct. Another use of a path is to guide the movement of an |
| 40 |
|
* iterator through an image. |
| 41 |
|
* |
| 42 |
|
* \sa EllipseParametricPath |
| 43 |
|
* \sa FourierSeriesPath |
| 44 |
|
* \sa OrthogonallyCorrectedParametricPath |
| 45 |
|
* \sa ParametricPath |
| 46 |
|
* \sa ChainCodePath |
| 47 |
|
* \sa Path |
| 48 |
|
* \sa ContinuousIndex |
| 49 |
|
* \sa Index |
| 50 |
|
* \sa Offset |
| 51 |
|
* \sa Vector |
| 52 |
|
* |
| 53 |
|
* \ingroup PathObjects |
| 54 |
|
*/ |
| 55 |
|
template <unsigned int VDimension> |
| 56 |
|
class ITK_EXPORT PolyLineParametricPath : public |
| 57 |
|
ParametricPath< VDimension > |
| 58 |
|
{ |
| 59 |
|
public: |
| 60 |
|
/** Standard class typedefs. */ |
| 61 |
|
typedef PolyLineParametricPath Self; |
| 62 |
|
typedef ParametricPath<VDimension> Superclass; |
| 63 |
|
typedef SmartPointer<Self> Pointer; |
| 64 |
|
typedef SmartPointer<const Self> ConstPointer; |
| 65 |
|
|
| 66 |
|
/** Run-time type information (and related methods). */ |
| 67 |
|
itkTypeMacro(PolyLineParametricPath, ParametricPath); |
| 68 |
|
|
| 69 |
|
/** Input type */ |
| 70 |
|
typedef typename Superclass::InputType InputType; |
| 71 |
|
|
| 72 |
|
/** Output type */ |
| 73 |
|
typedef typename Superclass::OutputType OutputType; |
| 74 |
|
|
| 75 |
|
|
| 76 |
|
/** Basic data-structure types used */ |
| 77 |
|
typedef ContinuousIndex<double,VDimension> ContinuousIndexType; |
| 78 |
|
typedef Index< VDimension > IndexType; |
| 79 |
|
typedef Offset< VDimension > OffsetType; |
| 80 |
|
typedef Point<double,VDimension> PointType; |
| 81 |
|
typedef Vector<double,VDimension> VectorType; |
| 82 |
|
typedef ContinuousIndexType VertexType; |
| 83 |
|
typedef VectorContainer<unsigned, VertexType> VertexListType; |
| 84 |
|
typedef typename VertexListType::Pointer VertexListPointer; |
| 85 |
|
|
| 86 |
|
|
| 87 |
|
/** Return the location of the parametric path at the specified location. */ |
| 88 |
|
virtual OutputType Evaluate( const InputType & input ) const; |
| 89 |
|
|
| 90 |
|
///** Evaluate the first derivative of the ND output with respect to the 1D |
| 91 |
|
// * input. This is an exact, algebraic function. */ |
| 92 |
|
//virtual VectorType EvaluateDerivative(const InputType & input) const; |
| 93 |
|
|
| 94 |
|
/** Add a vertex (and a connecting line segment to the previous vertex). |
| 95 |
|
* Adding a vertex has the additional effect of extending the domain of the |
| 96 |
|
* PolyLineParametricPath by 1.0 (each pair of consecutive verticies is |
| 97 |
|
* seperated by one unit of input). */ |
| 98 |
|
inline void AddVertex( const ContinuousIndexType & vertex ) |
| 99 |
|
{ |
| 100 |
|
m_VertexList->InsertElement( m_VertexList->Size(), vertex ); |
| 101 |
|
this->Modified(); |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
/** Where does the path end? This value is necessary for IncrementInput() to |
| 105 |
|
* know how to go to the end of a path. Since each line segment covers one |
| 106 |
|
* unit of input, this is the number of verticies - 1. */ |
| 107 |
|
virtual inline InputType EndOfInput() const |
| 108 |
|
{ |
| 109 |
|
return m_VertexList->Size() - 1; |
| 110 |
|
} |
| 111 |
|
|
| 112 |
|
/** New() method for dynamic construction */ |
| 113 |
|
itkNewMacro( Self ); |
| 114 |
|
|
| 115 |
|
/** Needed for Pipelining */ |
| 116 |
|
virtual void Initialize(void) |
| 117 |
|
{ |
| 118 |
|
m_VertexList->Initialize(); |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
/** Return the container of Vertices as a const object. */ |
| 122 |
|
itkGetConstObjectMacro( VertexList, VertexListType ); |
| 123 |
|
|
| 124 |
|
protected: |
| 125 |
|
PolyLineParametricPath(); |
| 126 |
|
~PolyLineParametricPath(){} |
| 127 |
|
void PrintSelf(std::ostream& os, Indent indent) const; |
| 128 |
|
|
| 129 |
|
private: |
| 130 |
|
PolyLineParametricPath(const Self&); //purposely not implemented |
| 131 |
|
void operator=(const Self&); //purposely not implemented |
| 132 |
|
|
| 133 |
|
VertexListPointer m_VertexList; |
| 134 |
|
}; |
| 135 |
|
|
| 136 |
|
} // namespace itk |
| 137 |
|
|
| 138 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 139 |
|
#include "itkPolyLineParametricPath.txx" |
| 140 |
|
#endif |
| 141 |
|
|
| 142 |
|
#endif |
| 143 |
|
|