itkFastMarchingUpwindGradientImageFilter.h
Go to the documentation of this file.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
00090 typedef typename Superclass::IndexType IndexType;
00091 typedef typename Superclass::OutputSpacingType OutputSpacingType;
00092 typedef typename Superclass::LevelSetIndexType LevelSetIndexType;
00093
00094 typedef typename Superclass::OutputPointType PointType;
00095
00096
00098 itkStaticConstMacro(SetDimension, unsigned int,Superclass::SetDimension);
00099
00103 void SetTargetPoints( NodeContainer * points )
00104 {
00105 m_TargetPoints = points;
00106 this->Modified();
00107 };
00109
00111 NodeContainerPointer GetTargetPoints( )
00112 { return m_TargetPoints; }
00113
00115 NodeContainerPointer GetReachedTargetPoints( )
00116 { return m_ReachedTargetPoints; }
00117
00119 typedef CovariantVector<PixelType,
00120 itkGetStaticConstMacro(SetDimension)> GradientPixelType;
00121
00123 typedef Image<GradientPixelType,
00124 itkGetStaticConstMacro(SetDimension)> GradientImageType;
00125
00127 typedef typename GradientImageType::Pointer GradientImagePointer;
00128
00130 GradientImagePointer GetGradientImage() const
00131 { return m_GradientImage; }
00132
00135 itkSetMacro( GenerateGradientImage, bool );
00136
00138 itkGetConstReferenceMacro( GenerateGradientImage, bool );
00139 itkBooleanMacro( GenerateGradientImage );
00141
00145 itkSetMacro( TargetOffset, double );
00146
00148 itkGetConstReferenceMacro( TargetOffset, double );
00149
00153 itkSetMacro( TargetReachedMode, int );
00154 itkGetConstReferenceMacro( TargetReachedMode, int );
00155 void SetTargetReachedModeToNoTargets()
00156 { this->SetTargetReachedMode(NoTargets); }
00157 void SetTargetReachedModeToOneTarget()
00158 { this->SetTargetReachedMode(OneTarget); }
00159 void SetTargetReachedModeToSomeTargets( long numberOfTargets )
00160 {
00161 this->SetTargetReachedMode(SomeTargets);
00162 m_NumberOfTargets = numberOfTargets;
00163 }
00164 void SetTargetReachedModeToAllTargets()
00165 { this->SetTargetReachedMode(AllTargets); }
00167
00169 itkGetConstReferenceMacro( NumberOfTargets, long );
00170
00175 itkGetConstReferenceMacro( TargetValue, double );
00176
00177 enum
00178 {
00179 NoTargets,
00180 OneTarget,
00181 SomeTargets,
00182 AllTargets
00183 };
00184
00185 #ifdef ITK_USE_CONCEPT_CHECKING
00186
00187 itkConceptMacro(LevelSetDoubleDivisionOperatorsCheck,
00188 (Concept::DivisionOperators<typename TLevelSet::PixelType, double>));
00189
00191 #endif
00192
00193 protected:
00194 FastMarchingUpwindGradientImageFilter();
00195 ~FastMarchingUpwindGradientImageFilter(){};
00196 void PrintSelf( std::ostream& os, Indent indent ) const;
00197
00198 virtual void Initialize( LevelSetImageType * );
00199
00200 void GenerateData();
00201
00202 virtual void UpdateNeighbors( const IndexType& index,
00203 const SpeedImageType *, LevelSetImageType * );
00204
00205 virtual void ComputeGradient( const IndexType& index ,
00206 const LevelSetImageType * output,
00207 const LabelImageType * labelImage,
00208 GradientImageType * gradientImage);
00209
00210 private:
00211 FastMarchingUpwindGradientImageFilter(const Self&);
00212 void operator=(const Self&);
00213
00214 NodeContainerPointer m_TargetPoints;
00215 NodeContainerPointer m_ReachedTargetPoints;
00216
00217 GradientImagePointer m_GradientImage;
00218
00219 bool m_GenerateGradientImage;
00220
00221 double m_TargetOffset;
00222
00223 int m_TargetReachedMode;
00224
00225 double m_TargetValue;
00226
00227 long m_NumberOfTargets;
00228
00229 };
00230
00231 }
00232
00233
00234 #ifndef ITK_MANUAL_INSTANTIATION
00235 #include "itkFastMarchingUpwindGradientImageFilter.txx"
00236 #endif
00237
00238 #endif
00239