00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkLevelSetNeighborhoodExtractor_h
00018 #define __itkLevelSetNeighborhoodExtractor_h
00019
00020 #include "itkLightProcessObject.h"
00021 #include "itkLevelSet.h"
00022 #include "itkIndex.h"
00023
00024 namespace itk
00025 {
00026
00055 template <class TLevelSet>
00056 class ITK_EXPORT LevelSetNeighborhoodExtractor :
00057 public LightProcessObject
00058 {
00059 public:
00061 typedef LevelSetNeighborhoodExtractor Self;
00062 typedef LightProcessObject Superclass;
00063 typedef SmartPointer<Self> Pointer;
00064 typedef SmartPointer<const Self> ConstPointer;
00065
00067 itkNewMacro(Self);
00068
00070 itkTypeMacro(LevelSetNeighborhoodExtractor, Object);
00071
00073 typedef LevelSetTypeDefault<TLevelSet> LevelSetType;
00074 typedef typename LevelSetType::LevelSetImageType LevelSetImageType;
00075 typedef typename LevelSetType::LevelSetPointer LevelSetPointer;
00076 typedef typename LevelSetType::LevelSetConstPointer LevelSetConstPointer;
00077 typedef typename LevelSetType::PixelType PixelType;
00078 typedef typename LevelSetType::NodeType NodeType;
00079 typedef typename LevelSetType::NodeContainer NodeContainer;
00080 typedef typename LevelSetType::NodeContainerPointer NodeContainerPointer;
00081
00083 itkStaticConstMacro(SetDimension, unsigned int,
00084 LevelSetType::SetDimension);
00085
00087 typedef Index<itkGetStaticConstMacro(SetDimension)> IndexType;
00088
00090 itkSetConstObjectMacro( InputLevelSet, LevelSetImageType );
00091
00093 itkGetConstObjectMacro( InputLevelSet, LevelSetImageType );
00094
00096 itkSetMacro( LevelSetValue, double );
00097
00099 itkGetConstMacro( LevelSetValue, double );
00100
00102 itkSetClampMacro( NarrowBandwidth, double, 0.0,
00103 NumericTraits<double>::max());
00104
00106 itkGetConstMacro( NarrowBandwidth, double );
00107
00109 itkSetMacro( NarrowBanding, bool );
00110
00112 itkGetConstMacro( NarrowBanding, bool );
00113 itkBooleanMacro( NarrowBanding );
00115
00118 void SetInputNarrowBand( NodeContainer * ptr );
00119 itkGetObjectMacro( InputNarrowBand, NodeContainer );
00121
00124 NodeContainerPointer GetInsidePoints()
00125 { return m_InsidePoints; }
00126
00129 NodeContainerPointer GetOutsidePoints(void)
00130 { return m_OutsidePoints; }
00131
00134 void Locate();
00135
00136 protected:
00137 LevelSetNeighborhoodExtractor();
00138 ~LevelSetNeighborhoodExtractor(){};
00139 void PrintSelf( std::ostream& os, Indent indent ) const;
00140
00141 typename LevelSetImageType::PixelType GetLargeValue() const
00142 { return m_LargeValue; }
00143
00144 const NodeType& GetNodeUsedInCalculation(unsigned int idx) const
00145 { return m_NodesUsed[idx]; }
00146
00147 virtual void Initialize();
00148 virtual double CalculateDistance( IndexType& index );
00149
00150 void GenerateData();
00151
00152 bool GetLastPointIsInside() const
00153 { return m_LastPointIsInside; }
00154
00155 private:
00156 LevelSetNeighborhoodExtractor(const Self&);
00157 void operator=(const Self&);
00158
00159 void GenerateDataFull();
00160 void GenerateDataNarrowBand();
00161
00162 double m_LevelSetValue;
00163
00164 NodeContainerPointer m_InsidePoints;
00165 NodeContainerPointer m_OutsidePoints;
00166
00167 LevelSetConstPointer m_InputLevelSet;
00168
00169 bool m_NarrowBanding;
00170 double m_NarrowBandwidth;
00171 NodeContainerPointer m_InputNarrowBand;
00172
00173 signed long m_ImageSize[SetDimension];
00174 typename LevelSetImageType::PixelType m_LargeValue;
00175
00176 std::vector<NodeType> m_NodesUsed;
00177
00178 bool m_LastPointIsInside;
00179
00180 };
00181
00182
00183 }
00184
00185 #ifndef ITK_MANUAL_INSTANTIATION
00186 #include "itkLevelSetNeighborhoodExtractor.txx"
00187 #endif
00188
00189 #endif
00190