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 itkGetMacro( LevelSetValue, double );
00100
00102 itkSetClampMacro( NarrowBandwidth, double, 0.0,
00103 NumericTraits<double>::max());
00104
00106 itkGetMacro( NarrowBandwidth, double );
00107
00109 itkSetMacro( NarrowBanding, bool );
00110
00112 itkGetMacro( NarrowBanding, bool );
00113 itkBooleanMacro( NarrowBanding );
00114
00117 void SetInputNarrowBand( NodeContainer * ptr );
00118 itkGetObjectMacro( InputNarrowBand, NodeContainer );
00119
00122 NodeContainerPointer GetInsidePoints()
00123 { return m_InsidePoints; }
00124
00127 NodeContainerPointer GetOutsidePoints(void)
00128 { return m_OutsidePoints; }
00129
00132 void Locate();
00133
00134 protected:
00135 LevelSetNeighborhoodExtractor();
00136 ~LevelSetNeighborhoodExtractor(){};
00137 void PrintSelf( std::ostream& os, Indent indent ) const;
00138
00139 typename LevelSetImageType::PixelType GetLargeValue() const
00140 { return m_LargeValue; }
00141
00142 const NodeType& GetNodeUsedInCalculation(unsigned int idx) const
00143 { return m_NodesUsed[idx]; }
00144
00145 virtual void Initialize();
00146 virtual double CalculateDistance( IndexType& index );
00147
00148 void GenerateData();
00149
00150 bool GetLastPointIsInside() const
00151 { return m_LastPointIsInside; }
00152
00153 private:
00154 LevelSetNeighborhoodExtractor(const Self&);
00155 void operator=(const Self&);
00156
00157 void GenerateDataFull();
00158 void GenerateDataNarrowBand();
00159
00160 double m_LevelSetValue;
00161
00162 NodeContainerPointer m_InsidePoints;
00163 NodeContainerPointer m_OutsidePoints;
00164
00165 LevelSetConstPointer m_InputLevelSet;
00166
00167 bool m_NarrowBanding;
00168 double m_NarrowBandwidth;
00169 NodeContainerPointer m_InputNarrowBand;
00170
00171 signed long m_ImageSize[SetDimension];
00172 typename LevelSetImageType::PixelType m_LargeValue;
00173
00174 std::vector<NodeType> m_NodesUsed;
00175
00176 bool m_LastPointIsInside;
00177
00178 };
00179
00180
00181 }
00182
00183 #ifndef ITK_MANUAL_INSTANTIATION
00184 #include "itkLevelSetNeighborhoodExtractor.txx"
00185 #endif
00186
00187 #endif