| 1 |
|
|
| 2 |
HRD |
/*========================================================================= |
| 3 |
|
|
| 4 |
HRD |
Program: Insight Segmentation & Registration Toolkit |
| 5 |
HRD |
Module: $RCSfile: itkSphereSpatialFunction.h.html,v $ |
| 6 |
HRD |
Language: C++ |
| 7 |
HRD |
Date: $Date: 2006/01/17 19:15:48 $ |
| 8 |
|
Version: $Revision: 1.4 $ |
| 9 |
|
|
| 10 |
HRD |
Copyright (c) Insight Software Consortium. All rights reserved. |
| 11 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 12 |
|
|
| 13 |
HRD |
This software is distributed WITHOUT ANY WARRANTY; without even |
| 14 |
HRD |
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 15 |
|
PURPOSE. See the above copyright notices for more information. |
| 16 |
HRD |
|
| 17 |
|
=========================================================================*/ |
| 18 |
|
#ifndef __itkSphereSpatialFunction_h |
| 19 |
|
#define __itkSphereSpatialFunction_h |
| 20 |
|
|
| 21 |
|
#include "itkInteriorExteriorSpatialFunction.h" |
| 22 |
|
|
| 23 |
|
namespace itk |
| 24 |
|
{ |
| 25 |
|
|
| 26 |
|
/** \class SphereSpatialFunction |
| 27 |
|
* \brief Spatial function implementation of a sphere |
| 28 |
|
* |
| 29 |
|
* Implements a function that returns 0 for points inside or on the surface |
| 30 |
|
* of a sphere, 1 for points outside the sphere |
| 31 |
|
* |
| 32 |
|
* \ingroup SpatialFunctions |
| 33 |
|
*/ |
| 34 |
LEN |
template <unsigned int VImageDimension=3,typename TInput=Point<double,VImageDimension> > |
| 35 |
|
class ITK_EXPORT SphereSpatialFunction |
| 36 |
|
: public InteriorExteriorSpatialFunction<VImageDimension,TInput> |
| 37 |
|
{ |
| 38 |
|
public: |
| 39 |
|
/** Standard class typedefs. */ |
| 40 |
|
typedef SphereSpatialFunction<VImageDimension,TInput> Self; |
| 41 |
TDA |
typedef InteriorExteriorSpatialFunction<VImageDimension,TInput> Superclass; |
| 42 |
TDA |
typedef SmartPointer<Self> Pointer; |
| 43 |
TDA |
typedef SmartPointer<const Self> ConstPointer; |
| 44 |
|
|
| 45 |
|
/** Method for creation through the object factory. */ |
| 46 |
|
itkNewMacro(Self); |
| 47 |
|
|
| 48 |
|
/** Run-time type information (and related methods). */ |
| 49 |
|
itkTypeMacro(SphereSpatialFunction,InteriorExteriorSpatialFunction); |
| 50 |
|
|
| 51 |
|
/** Input type for the function. */ |
| 52 |
|
typedef typename Superclass::InputType InputType; |
| 53 |
|
|
| 54 |
|
/** Output type for the function. */ |
| 55 |
|
typedef typename Superclass::OutputType OutputType; |
| 56 |
|
|
| 57 |
|
/** Evaluates the function at a given position */ |
| 58 |
|
OutputType Evaluate(const InputType& position) const; |
| 59 |
|
|
| 60 |
|
/** Get and set the center of the sphere. */ |
| 61 |
|
itkGetMacro( Center, InputType); |
| 62 |
|
itkSetMacro( Center, InputType); |
| 63 |
|
|
| 64 |
|
/** Get and set the radius of the sphere */ |
| 65 |
|
itkGetMacro( Radius, double); |
| 66 |
|
itkSetMacro( Radius, double); |
| 67 |
|
|
| 68 |
|
protected: |
| 69 |
|
SphereSpatialFunction(); |
| 70 |
|
virtual ~SphereSpatialFunction(); |
| 71 |
|
void PrintSelf(std::ostream& os, Indent indent) const; |
| 72 |
|
|
| 73 |
|
private: |
| 74 |
|
SphereSpatialFunction(const Self&); //purposely not implemented |
| 75 |
|
void operator=(const Self&); //purposely not implemented |
| 76 |
|
|
| 77 |
|
/** The center of the sphere (of the same type as Input). */ |
| 78 |
|
InputType m_Center; |
| 79 |
|
|
| 80 |
|
/** The radius of the sphere. */ |
| 81 |
|
double m_Radius; |
| 82 |
|
|
| 83 |
|
}; |
| 84 |
|
|
| 85 |
|
} // end namespace itk |
| 86 |
|
|
| 87 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 88 |
|
#include "itkSphereSpatialFunction.txx" |
| 89 |
|
#endif |
| 90 |
|
|
| 91 |
|
#endif |
| 92 |
|
|