00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _itkReinitializeLevelSetImageFilter_h
00018 #define _itkReinitializeLevelSetImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkLevelSet.h"
00022 #include "itkLevelSetNeighborhoodExtractor.h"
00023 #include "itkFastMarchingImageFilter.h"
00024
00025 namespace itk
00026 {
00054 template <class TLevelSet>
00055 class ITK_EXPORT ReinitializeLevelSetImageFilter :
00056 public ImageToImageFilter<TLevelSet,TLevelSet>
00057 {
00058 public:
00060 typedef ReinitializeLevelSetImageFilter Self;
00061 typedef ImageToImageFilter<TLevelSet,TLevelSet> Superclass;
00062 typedef SmartPointer<Self> Pointer;
00063 typedef SmartPointer<const Self> ConstPointer;
00064
00066 itkNewMacro(Self);
00067
00069 itkTypeMacro(ReinitializeLevelSetImageFilter, ImageToImageFilter);
00070
00072 typedef LevelSetTypeDefault<TLevelSet> LevelSetType;
00073 typedef typename LevelSetType::LevelSetImageType LevelSetImageType;
00074 typedef typename LevelSetType::LevelSetPointer LevelSetPointer;
00075 typedef typename LevelSetType::LevelSetConstPointer LevelSetConstPointer;
00076 typedef typename LevelSetType::PixelType PixelType;
00077 typedef typename LevelSetType::NodeType NodeType;
00078 typedef typename LevelSetType::NodeContainer NodeContainer;
00079 typedef typename LevelSetType::NodeContainerPointer NodeContainerPointer;
00080
00082 itkStaticConstMacro(SetDimension, unsigned int,
00083 LevelSetType::SetDimension);
00084
00087 itkSetMacro( LevelSetValue, double );
00088 itkGetMacro( LevelSetValue, double );
00089
00092 itkSetMacro( NarrowBanding, bool );
00093 itkGetMacro( NarrowBanding, bool );
00094 itkBooleanMacro( NarrowBanding );
00095
00097 itkSetClampMacro( InputNarrowBandwidth, double, 0.0,
00098 NumericTraits<double>::max());
00099 itkGetMacro( InputNarrowBandwidth, double );
00100
00102 itkSetClampMacro( OutputNarrowBandwidth, double, 0.0,
00103 NumericTraits<double>::max());
00104 itkGetMacro( OutputNarrowBandwidth, double );
00105
00108 void SetNarrowBandwidth( double value )
00109 {
00110 this->SetInputNarrowBandwidth(value);
00111 this->SetOutputNarrowBandwidth(value);
00112 }
00113
00115 void SetInputNarrowBand( NodeContainer * ptr );
00116 NodeContainerPointer GetInputNarrowBand() const
00117 { return m_InputNarrowBand; }
00118
00120 NodeContainerPointer GetOutputNarrowBand() const
00121 { return m_OutputNarrowBand; }
00122
00123 protected:
00124 ReinitializeLevelSetImageFilter();
00125 ~ReinitializeLevelSetImageFilter(){};
00126 void PrintSelf(std::ostream& os, Indent indent) const;
00127
00131 typedef Image<float, itkGetStaticConstMacro(SetDimension) > SpeedImageType;
00132 typedef LevelSetNeighborhoodExtractor<TLevelSet> LocatorType;
00133 typedef FastMarchingImageFilter<TLevelSet, SpeedImageType> FastMarchingImageFilterType;
00134
00135 void GenerateData();
00136 virtual void GenerateDataFull();
00137 virtual void GenerateDataNarrowBand();
00138 virtual void AllocateOutput();
00139
00140 virtual void GenerateInputRequestedRegion();
00141 virtual void EnlargeOutputRequestedRegion( DataObject * );
00142
00143 void SetOutputNarrowBand( NodeContainer *ptr )
00144 { m_OutputNarrowBand = ptr; }
00145
00146 private:
00147 ReinitializeLevelSetImageFilter(const Self&);
00148 void operator=(const Self&);
00149
00150 double m_LevelSetValue;
00151
00152 typename LocatorType::Pointer m_Locator;
00153 typename FastMarchingImageFilterType::Pointer m_Marcher;
00154
00155 bool m_NarrowBanding;
00156 double m_InputNarrowBandwidth;
00157 double m_OutputNarrowBandwidth;
00158 NodeContainerPointer m_InputNarrowBand;
00159 NodeContainerPointer m_OutputNarrowBand;
00160
00161 };
00162
00163 }
00164
00165 #ifndef ITK_MANUAL_INSTANTIATION
00166 #include "itkReinitializeLevelSetImageFilter.txx"
00167 #endif
00168
00169 #endif