00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _itkFastMarchingUpwindGradientImageFilter_h
00019 #define _itkFastMarchingUpwindGradientImageFilter_h
00020
00021 #include "itkFastMarchingImageFilter.h"
00022 #include "itkImage.h"
00023
00024 namespace itk
00025 {
00057 template <
00058 class TLevelSet,
00059 class TSpeedImage = Image<float,::itk::GetImageDimension<TLevelSet>::ImageDimension> >
00060 class ITK_EXPORT FastMarchingUpwindGradientImageFilter :
00061 public FastMarchingImageFilter<TLevelSet,TSpeedImage>
00062 {
00063
00064 public:
00066 typedef FastMarchingUpwindGradientImageFilter Self;
00067 typedef FastMarchingImageFilter<TLevelSet,TSpeedImage> Superclass;
00068 typedef SmartPointer<Self> Pointer;
00069 typedef SmartPointer<const Self> ConstPointer;
00070
00072 itkNewMacro(Self);
00073
00075 itkTypeMacro(FastMarchingUpwindGradientImageFilter, FastMarchingImageFilter);
00076
00078 typedef typename Superclass::LevelSetType LevelSetType;
00079 typedef typename Superclass::SpeedImageType SpeedImageType;
00080 typedef typename Superclass::LevelSetImageType LevelSetImageType;
00081 typedef typename Superclass::LevelSetPointer LevelSetPointer;
00082 typedef typename Superclass::SpeedImageConstPointer SpeedImageConstPointer;
00083 typedef typename Superclass::LabelImageType LabelImageType;
00084 typedef typename Superclass::PixelType PixelType;
00085 typedef typename Superclass::AxisNodeType AxisNodeType;
00086 typedef typename Superclass::NodeType NodeType;
00087 typedef typename Superclass::NodeContainer NodeContainer;
00088 typedef typename Superclass::NodeContainerPointer NodeContainerPointer;
00089 typedef typename Superclass::IndexType IndexType;
00090 typedef typename Superclass::OutputSpacingType OutputSpacingType;
00091 typedef typename Superclass::LevelSetIndexType LevelSetIndexType;
00092
00094 itkStaticConstMacro(SetDimension, unsigned int,Superclass::SetDimension);
00095
00099 void SetTargetPoints( NodeContainer * points )
00100 {
00101 m_TargetPoints = points;
00102 this->Modified();
00103 };
00104
00106 NodeContainerPointer GetTargetPoints( )
00107 { return m_TargetPoints; };
00108
00110 typedef CovariantVector<PixelType,
00111 itkGetStaticConstMacro(SetDimension)> GradientPixelType;
00112
00114 typedef Image<GradientPixelType,
00115 itkGetStaticConstMacro(SetDimension)> GradientImageType;
00116
00118 typedef typename GradientImageType::Pointer GradientImagePointer;
00119
00121 GradientImagePointer GetGradientImage() const
00122 { return m_GradientImage; };
00123
00126 itkSetMacro( GenerateGradientImage, bool );
00127
00129 itkGetConstReferenceMacro( GenerateGradientImage, bool );
00130 itkBooleanMacro( GenerateGradientImage );
00131
00135 itkSetMacro( TargetOffset, double );
00137 itkGetConstReferenceMacro( TargetOffset, double );
00138
00142 itkSetMacro( TargetReachedMode, int );
00143 itkGetConstReferenceMacro( TargetReachedMode, int );
00144 void SetTargetReachedModeToOneTarget()
00145 { this->SetTargetReachedMode(OneTarget); }
00146 void SetTargetReachedModeToAllTargets()
00147 { this->SetTargetReachedMode(AllTargets); }
00148
00150 itkGetConstReferenceMacro( TargetValue, double );
00151
00152 enum
00153 {
00154 OneTarget,
00155 AllTargets
00156 };
00157
00158 protected:
00159 FastMarchingUpwindGradientImageFilter();
00160 ~FastMarchingUpwindGradientImageFilter(){};
00161 void PrintSelf( std::ostream& os, Indent indent ) const;
00162
00163 virtual void Initialize( LevelSetImageType * );
00164
00165 virtual void UpdateNeighbors( const IndexType& index,
00166 const SpeedImageType *, LevelSetImageType * );
00167
00168 virtual void ComputeGradient( const IndexType& index ,
00169 const LevelSetImageType * output,
00170 const LabelImageType * labelImage,
00171 GradientImageType * gradientImage);
00172
00173 private:
00174 FastMarchingUpwindGradientImageFilter(const Self&);
00175 void operator=(const Self&);
00176
00177 NodeContainerPointer m_TargetPoints;
00178 NodeContainerPointer m_ReachedTargetPoints;
00179
00180 GradientImagePointer m_GradientImage;
00181
00182 bool m_GenerateGradientImage;
00183
00184 double m_TargetOffset;
00185
00186 int m_TargetReachedMode;
00187
00188 double m_TargetValue;
00189
00190 };
00191
00192 }
00193
00194
00195 #ifndef ITK_MANUAL_INSTANTIATION
00196 #include "itkFastMarchingUpwindGradientImageFilter.txx"
00197 #endif
00198
00199 #endif