| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkSphereSignedDistanceFunction.h.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:48 $ |
| 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 |
DEF |
#ifndef _itkSphereSignedDistanceFunction_h |
| 18 |
DEF |
#define _itkSphereSignedDistanceFunction_h |
| 19 |
|
|
| 20 |
|
#include "itkShapeSignedDistanceFunction.h" |
| 21 |
|
#include "itkVector.h" |
| 22 |
|
|
| 23 |
|
namespace itk |
| 24 |
|
{ |
| 25 |
|
|
| 26 |
|
/** \class SphereSignedDistanceFunction |
| 27 |
|
* \brief Compute the signed distance from a N-dimensional sphere. |
| 28 |
|
* |
| 29 |
|
* A instance of sphere is defined by a set parameters. The first parameter |
| 30 |
|
* is the radius and the next SpaceDimension parameters represent the center. |
| 31 |
|
* The first parameter forms the set of ShapeParameters and the remaining |
| 32 |
|
* parameters the set of PoseParameters. |
| 33 |
|
* |
| 34 |
|
* This class is templated over the coordinate representation type |
| 35 |
|
* (e.g. float or double) and the space dimension. |
| 36 |
|
* |
| 37 |
|
* \sa ShapeSignedDistanceFunction |
| 38 |
|
* \ingroup ImageFunctions |
| 39 |
|
* |
| 40 |
|
* */ |
| 41 |
|
template <typename TCoordRep, unsigned int VSpaceDimension> |
| 42 |
|
class ITK_EXPORT SphereSignedDistanceFunction : |
| 43 |
IND |
**public ShapeSignedDistanceFunction< TCoordRep, VSpaceDimension > |
| 44 |
|
{ |
| 45 |
|
public: |
| 46 |
|
/** Standard class typedefs. */ |
| 47 |
|
typedef SphereSignedDistanceFunction Self; |
| 48 |
TDA |
typedef ShapeSignedDistanceFunction< TCoordRep, VSpaceDimension > Superclass; |
| 49 |
TDA |
typedef SmartPointer<Self> Pointer; |
| 50 |
TDA |
typedef SmartPointer<const Self> ConstPointer; |
| 51 |
|
|
| 52 |
|
/** Run-time type information (and related methods). */ |
| 53 |
|
itkTypeMacro(SphereSignedDistanceFunction, ShapeSignedDistancFunction); |
| 54 |
|
|
| 55 |
|
/** New macro for creation of through the object factory.*/ |
| 56 |
|
itkNewMacro( Self ); |
| 57 |
|
|
| 58 |
|
/** OutputType typedef support. */ |
| 59 |
|
typedef typename Superclass::OutputType OutputType; |
| 60 |
|
|
| 61 |
|
/** InputeType typedef support. */ |
| 62 |
|
typedef typename Superclass::InputType InputType; |
| 63 |
|
|
| 64 |
|
/** Dimension underlying input image. */ |
| 65 |
|
itkStaticConstMacro(SpaceDimension, unsigned int, Superclass::SpaceDimension); |
| 66 |
|
|
| 67 |
|
/** CoordRep typedef support. */ |
| 68 |
|
typedef typename Superclass::CoordRepType CoordRepType; |
| 69 |
|
|
| 70 |
|
/** Point typedef support. */ |
| 71 |
|
typedef typename Superclass::PointType PointType; |
| 72 |
|
|
| 73 |
|
/** Type of the shape parameters. */ |
| 74 |
|
typedef typename Superclass::ParametersType ParametersType; |
| 75 |
|
|
| 76 |
|
/** A sphere is defined by a set of shape parameters. The first parameter |
| 77 |
LEN |
* is the radius and the next SpaceDimension parameters represent the center. */ |
| 78 |
|
virtual void SetParameters( const ParametersType & ); |
| 79 |
|
virtual unsigned int GetNumberOfShapeParameters(void) const |
| 80 |
|
{ return 1; } |
| 81 |
|
virtual unsigned int GetNumberOfPoseParameters(void) const |
| 82 |
|
{ return SpaceDimension; } |
| 83 |
|
|
| 84 |
|
/** Evaluate the signed distance from a shape at a given position. */ |
| 85 |
|
virtual OutputType Evaluate( const PointType& point ) const; |
| 86 |
|
|
| 87 |
|
protected: |
| 88 |
|
SphereSignedDistanceFunction(); |
| 89 |
|
~SphereSignedDistanceFunction(){}; |
| 90 |
|
|
| 91 |
|
void PrintSelf(std::ostream& os, Indent indent) const; |
| 92 |
|
|
| 93 |
|
private: |
| 94 |
|
SphereSignedDistanceFunction( const Self& ); //purposely not implemented |
| 95 |
|
void operator=( const Self& ); //purposely not implemented |
| 96 |
|
|
| 97 |
LEN |
typedef Vector<CoordRepType,itkGetStaticConstMacro(SpaceDimension)> VectorType; |
| 98 |
|
|
| 99 |
|
VectorType m_Translation; |
| 100 |
|
double m_Radius; |
| 101 |
|
|
| 102 |
|
}; |
| 103 |
|
|
| 104 |
|
} // namespace itk |
| 105 |
|
|
| 106 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 107 |
|
#include "itkSphereSignedDistanceFunction.txx" |
| 108 |
|
#endif |
| 109 |
|
|
| 110 |
|
#endif |
| 111 |
|
|