| 1 |
|
|
| 2 |
HRD |
/*========================================================================= |
| 3 |
|
|
| 4 |
HRD |
Program: Insight Segmentation & Registration Toolkit |
| 5 |
HRD |
Module: $RCSfile: itkConicShellInteriorExteriorSpatialFunction.h.html,v $ |
| 6 |
HRD |
Language: C++ |
| 7 |
HRD |
Date: $Date: 2006/01/17 19:15:34 $ |
| 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 __itkConicShellInteriorExteriorSpatialFunction_h |
| 19 |
|
#define __itkConicShellInteriorExteriorSpatialFunction_h |
| 20 |
|
|
| 21 |
|
#include "vnl/vnl_vector.h" |
| 22 |
|
#include "itkInteriorExteriorSpatialFunction.h" |
| 23 |
|
#include "itkCovariantVector.h" |
| 24 |
|
|
| 25 |
|
namespace itk |
| 26 |
|
{ |
| 27 |
|
|
| 28 |
|
/** |
| 29 |
|
* \class ConicShellInteriorExteriorSpatialFunction |
| 30 |
|
* \brief Spatial function implementation of a conic shell |
| 31 |
|
* |
| 32 |
|
* We are creating search areas from BoundaryPoint1 in which to look for |
| 33 |
|
* candidate BoundaryPoint2's with which to form core atoms. Assume the |
| 34 |
|
* "worst case" that BoundaryPoint2 is somewhere in that search area pointing |
| 35 |
|
* directly at BoundaryPoint1. |
| 36 |
|
* |
| 37 |
LEN |
* The search area (ConicShell?) from each BoundaryPoint1 has the following parameters: |
| 38 |
|
* |
| 39 |
|
* DistanceMax and DistanceMin from the location of the BoundaryPoint |
| 40 |
|
* |
| 41 |
|
* AngleMax from the line along the gradient at the boundary point. |
| 42 |
|
* This is determined in n dimensions by taking the dot product of two vectors, |
| 43 |
|
* (1) the normalized gradient at BoundaryPoint1 and |
| 44 |
|
* (2) the normalized vector from BoundaryPoint1 to BoundaryPoint2. |
| 45 |
|
* |
| 46 |
|
* If the absolute value of that dot product is greater than (1 - epsilon) |
| 47 |
|
* then you are in the ConicShell. This epsilon is the same one determining |
| 48 |
|
* face-to-faceness in the IEEE TMI paper. |
| 49 |
|
* |
| 50 |
LEN |
* Polarity, i.e. which direction along the gradient of BoundaryPoint1 you want to look. |
| 51 |
|
* |
| 52 |
|
* \ingroup SpatialFunctions |
| 53 |
|
* |
| 54 |
|
* */ |
| 55 |
|
|
| 56 |
|
template <unsigned int VDimension=3, typename TInput=Point<double,3> > |
| 57 |
|
class ITK_EXPORT ConicShellInteriorExteriorSpatialFunction: |
| 58 |
IND |
****public InteriorExteriorSpatialFunction<VDimension, TInput> |
| 59 |
|
{ |
| 60 |
|
public: |
| 61 |
|
|
| 62 |
|
/** Standard class typedefs. */ |
| 63 |
|
typedef ConicShellInteriorExteriorSpatialFunction Self; |
| 64 |
TDA |
typedef InteriorExteriorSpatialFunction<VDimension> Superclass; |
| 65 |
TDA |
typedef SmartPointer<Self> Pointer; |
| 66 |
TDA |
typedef SmartPointer<const Self> ConstPointer; |
| 67 |
|
|
| 68 |
|
/** Run time information. */ |
| 69 |
LEN |
itkTypeMacro(ConicShellInteriorExteriorSpatialFunction,InteriorExteriorSpatialFunction); |
| 70 |
|
|
| 71 |
|
/** Method for creation through the object factory. */ |
| 72 |
|
itkNewMacro(Self); |
| 73 |
|
|
| 74 |
|
/** Input type for the function. */ |
| 75 |
|
typedef typename Superclass::InputType InputType; |
| 76 |
|
|
| 77 |
|
/** Output type for the function. */ |
| 78 |
|
typedef typename Superclass::OutputType OutputType; |
| 79 |
|
|
| 80 |
|
/** The type of vector used to store the gradient info. */ |
| 81 |
|
typedef CovariantVector<double, VDimension> GradientType; |
| 82 |
|
|
| 83 |
|
/** Evaluates the function at a given position */ |
| 84 |
|
OutputType Evaluate(const InputType& position) const; |
| 85 |
|
|
| 86 |
|
/** Set/Get the origin of the function. */ |
| 87 |
|
itkGetMacro( Origin, InputType); |
| 88 |
|
itkSetMacro( Origin, InputType); |
| 89 |
|
|
| 90 |
|
/** Set/Get the gradient at the origin of the function. */ |
| 91 |
|
GradientType GetOriginGradient() {return m_OriginGradient;} |
| 92 |
|
void SetOriginGradient(GradientType grad); |
| 93 |
|
|
| 94 |
|
/** Set/Get the minimum search distance. */ |
| 95 |
|
itkGetMacro( DistanceMin, double); |
| 96 |
|
itkSetMacro( DistanceMin, double); |
| 97 |
|
|
| 98 |
|
/** Set/Get the maximum search distance. */ |
| 99 |
|
itkGetMacro( DistanceMax, double); |
| 100 |
|
itkSetMacro( DistanceMax, double); |
| 101 |
|
|
| 102 |
|
/** Set/Get the tolerance of the in/out comparison. */ |
| 103 |
|
itkGetMacro( Epsilon, double); |
| 104 |
|
itkSetMacro( Epsilon, double); |
| 105 |
|
|
| 106 |
|
/** Set/Get direction along the gradient to search. */ |
| 107 |
|
itkGetMacro( Polarity, bool); |
| 108 |
|
itkSetMacro( Polarity, bool); |
| 109 |
|
|
| 110 |
|
protected: |
| 111 |
|
ConicShellInteriorExteriorSpatialFunction(); |
| 112 |
|
virtual ~ConicShellInteriorExteriorSpatialFunction(); |
| 113 |
|
void PrintSelf(std::ostream& os, Indent indent) const; |
| 114 |
|
|
| 115 |
|
private: |
| 116 |
LEN |
ConicShellInteriorExteriorSpatialFunction(const Self&); //purposely not implemented |
| 117 |
|
void operator=(const Self&); //purposely not implemented |
| 118 |
|
|
| 119 |
|
/** The origin of the conic shell */ |
| 120 |
|
InputType m_Origin; |
| 121 |
|
|
| 122 |
|
/** The gradient at the origin */ |
| 123 |
|
GradientType m_OriginGradient; |
| 124 |
|
|
| 125 |
|
double m_DistanceMin; |
| 126 |
|
double m_DistanceMax; |
| 127 |
|
double m_Epsilon; |
| 128 |
|
bool m_Polarity; |
| 129 |
|
|
| 130 |
|
}; |
| 131 |
|
|
| 132 |
|
} // end namespace itk |
| 133 |
|
|
| 134 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 135 |
|
#include "itkConicShellInteriorExteriorSpatialFunction.txx" |
| 136 |
|
#endif |
| 137 |
|
|
| 138 |
|
#endif |
| 139 |
|
|