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 itkGetConstMacro( LevelSetValue, double );
00090
00093 itkSetMacro( NarrowBanding, bool );
00094 itkGetConstMacro( NarrowBanding, bool );
00095 itkBooleanMacro( NarrowBanding );
00097
00099 itkSetClampMacro( InputNarrowBandwidth, double, 0.0,
00100 NumericTraits<double>::max());
00101 itkGetConstMacro( InputNarrowBandwidth, double );
00103
00105 itkSetClampMacro( OutputNarrowBandwidth, double, 0.0,
00106 NumericTraits<double>::max());
00107 itkGetConstMacro( OutputNarrowBandwidth, double );
00109
00112 void SetNarrowBandwidth( double value )
00113 {
00114 this->SetInputNarrowBandwidth(value);
00115 this->SetOutputNarrowBandwidth(value);
00116 }
00118
00120 void SetInputNarrowBand( NodeContainer * ptr );
00121 NodeContainerPointer GetInputNarrowBand() const
00122 { return m_InputNarrowBand; }
00124
00126 NodeContainerPointer GetOutputNarrowBand() const
00127 { return m_OutputNarrowBand; }
00128
00129 #ifdef ITK_USE_CONCEPT_CHECKING
00130
00131 itkConceptMacro(LevelSetDoubleAdditiveOperatorsCheck,
00132 (Concept::AdditiveOperators<PixelType, double>));
00133 itkConceptMacro(LevelSetOStreamWritableCheck,
00134 (Concept::OStreamWritable<PixelType>));
00135
00137 #endif
00138
00139 protected:
00140 ReinitializeLevelSetImageFilter();
00141 ~ReinitializeLevelSetImageFilter(){};
00142 void PrintSelf(std::ostream& os, Indent indent) const;
00143
00147 typedef Image<float, itkGetStaticConstMacro(SetDimension) > SpeedImageType;
00148 typedef LevelSetNeighborhoodExtractor<TLevelSet> LocatorType;
00149 typedef FastMarchingImageFilter<TLevelSet, SpeedImageType> FastMarchingImageFilterType;
00150
00151 void GenerateData();
00152 virtual void GenerateDataFull();
00153 virtual void GenerateDataNarrowBand();
00154 virtual void AllocateOutput();
00155
00156 virtual void GenerateInputRequestedRegion();
00157 virtual void EnlargeOutputRequestedRegion( DataObject * );
00158
00159 void SetOutputNarrowBand( NodeContainer *ptr )
00160 { m_OutputNarrowBand = ptr; }
00161
00162 private:
00163 ReinitializeLevelSetImageFilter(const Self&);
00164 void operator=(const Self&);
00165
00166 double m_LevelSetValue;
00167
00168 typename LocatorType::Pointer m_Locator;
00169 typename FastMarchingImageFilterType::Pointer m_Marcher;
00170
00171 bool m_NarrowBanding;
00172 double m_InputNarrowBandwidth;
00173 double m_OutputNarrowBandwidth;
00174 NodeContainerPointer m_InputNarrowBand;
00175 NodeContainerPointer m_OutputNarrowBand;
00176
00177 };
00178
00179 }
00180
00181 #ifndef ITK_MANUAL_INSTANTIATION
00182 #include "itkReinitializeLevelSetImageFilter.txx"
00183 #endif
00184
00185 #endif
00186