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 };
00105
00107 NodeContainerPointer GetTargetPoints( )
00108 { return m_TargetPoints; };
00109
00111 NodeContainerPointer GetReachedTargetPoints( )
00112 { return m_ReachedTargetPoints; };
00113
00115 typedef CovariantVector<PixelType,
00116 itkGetStaticConstMacro(SetDimension)> GradientPixelType;
00117
00119 typedef Image<GradientPixelType,
00120 itkGetStaticConstMacro(SetDimension)> GradientImageType;
00121
00123 typedef typename GradientImageType::Pointer GradientImagePointer;
00124
00126 GradientImagePointer GetGradientImage() const
00127 { return m_GradientImage; };
00128
00131 itkSetMacro( GenerateGradientImage, bool );
00132
00134 itkGetConstReferenceMacro( GenerateGradientImage, bool );
00135 itkBooleanMacro( GenerateGradientImage );
00137
00141 itkSetMacro( TargetOffset, double );
00142
00144 itkGetConstReferenceMacro( TargetOffset, double );
00145
00149 itkSetMacro( TargetReachedMode, int );
00150 itkGetConstReferenceMacro( TargetReachedMode, int );
00151 void SetTargetReachedModeToNoTargets()
00152 { this->SetTargetReachedMode(NoTargets); }
00153 void SetTargetReachedModeToOneTarget()
00154 { this->SetTargetReachedMode(OneTarget); }
00155 void SetTargetReachedModeToSomeTargets( long numberOfTargets )
00156 { this->SetTargetReachedMode(SomeTargets);
00157 m_NumberOfTargets = numberOfTargets; }
00158 void SetTargetReachedModeToAllTargets()
00159 { this->SetTargetReachedMode(AllTargets); }
00161
00163 itkGetConstReferenceMacro( TargetValue, double );
00164
00165 enum
00166 {
00167 NoTargets,
00168 OneTarget,
00169 SomeTargets,
00170 AllTargets
00171 };
00172
00173 #ifdef ITK_USE_CONCEPT_CHECKING
00174
00175 itkConceptMacro(LevelSetDoubleDivisionOperatorsCheck,
00176 (Concept::DivisionOperators<typename TLevelSet::PixelType, double>));
00177
00179 #endif
00180
00181 protected:
00182 FastMarchingUpwindGradientImageFilter();
00183 ~FastMarchingUpwindGradientImageFilter(){};
00184 void PrintSelf( std::ostream& os, Indent indent ) const;
00185
00186 virtual void Initialize( LevelSetImageType * );
00187
00188 void GenerateData();
00189
00190 virtual void UpdateNeighbors( const IndexType& index,
00191 const SpeedImageType *, LevelSetImageType * );
00192
00193 virtual void ComputeGradient( const IndexType& index ,
00194 const LevelSetImageType * output,
00195 const LabelImageType * labelImage,
00196 GradientImageType * gradientImage);
00197
00198 private:
00199 FastMarchingUpwindGradientImageFilter(const Self&);
00200 void operator=(const Self&);
00201
00202 NodeContainerPointer m_TargetPoints;
00203 NodeContainerPointer m_ReachedTargetPoints;
00204
00205 GradientImagePointer m_GradientImage;
00206
00207 bool m_GenerateGradientImage;
00208
00209 double m_TargetOffset;
00210
00211 int m_TargetReachedMode;
00212
00213 double m_TargetValue;
00214
00215 long m_NumberOfTargets;
00216
00217 };
00218
00219 }
00220
00221
00222 #ifndef ITK_MANUAL_INSTANTIATION
00223 #include "itkFastMarchingUpwindGradientImageFilter.txx"
00224 #endif
00225
00226 #endif
00227