00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkSobelOperator_h
00019 #define __itkSobelOperator_h
00020
00021 #include "itkExceptionObject.h"
00022 #include "itkNeighborhoodOperator.h"
00023 #include "itkVector.h"
00024
00025 namespace itk {
00026
00067 template<class TPixel, unsigned int VDimension=2,
00068 class TAllocator = NeighborhoodAllocator<TPixel> >
00069 class ITK_EXPORT AnnulusOperator
00070 : public NeighborhoodOperator<TPixel, VDimension, TAllocator>
00071 {
00072 public:
00074 typedef AnnulusOperator Self;
00075 typedef NeighborhoodOperator<TPixel, VDimension, TAllocator> Superclass;
00076
00078 typedef typename Superclass::SizeType SizeType;
00079 typedef typename Superclass::OffsetType OffsetType;
00080 typedef Vector<double, VDimension> SpacingType;
00081
00082 itkTypeMacro(AnnulusOperator, NeighborhoodOperator);
00083
00084 AnnulusOperator()
00085 : NeighborhoodOperator<TPixel, VDimension, TAllocator>(),
00086 m_Normalize(false), m_BrightCenter(false),
00087 m_InteriorValue(NumericTraits<PixelType>::Zero),
00088 m_AnnulusValue(NumericTraits<PixelType>::One),
00089 m_ExteriorValue(NumericTraits<PixelType>::Zero)
00090 { m_Spacing.Fill(1.0); }
00091
00092 AnnulusOperator(const Self& other)
00093 : NeighborhoodOperator<TPixel, VDimension, TAllocator>(other)
00094 {
00095 m_InnerRadius = other.m_InnerRadius;
00096 m_Thickness = other.m_Thickness;
00097 m_Spacing = other.m_Spacing;
00098 m_InteriorValue = other.m_InteriorValue;
00099 m_AnnulusValue = other.m_AnnulusValue;
00100 m_ExteriorValue = other.m_ExteriorValue;
00101 m_Normalize = other.m_Normalize;
00102 m_BrightCenter = other.m_BrightCenter;
00103 }
00104
00107 void CreateOperator();
00108
00111 void SetInnerRadius(double r)
00112 { m_InnerRadius = r; }
00113 double GetInnerRadius() const
00114 { return m_InnerRadius; }
00115
00119 void SetThickness(double t)
00120 { m_Thickness = t; }
00121 double GetThickness() const
00122 { return m_Thickness; }
00123
00126 void SetSpacing(SpacingType &s)
00127 { m_Spacing = s; }
00128 const SpacingType& GetSpacing() const
00129 { return m_Spacing; }
00130
00133 void SetNormalize(bool b)
00134 { m_Normalize = b; }
00135 bool GetNormalize() const
00136 { return m_Normalize; }
00137 void NormalizeOn()
00138 { this->SetNormalize(true); }
00139 void NormalizeOff()
00140 { this->SetNormalize(false); }
00141
00144 void SetBrightCenter(bool b)
00145 { m_BrightCenter = b; }
00146 bool GetBrightCenter() const
00147 { return m_BrightCenter; }
00148 void BrightCenterOn()
00149 { this->SetBrightCenter(true); }
00150 void BrightCenterOff()
00151 { this->SetBrightCenter(false); }
00152
00157 void SetInteriorValue(TPixel v)
00158 { m_InteriorValue = v; }
00159 TPixel GetInteriorValue() const
00160 { return m_InteriorValue; }
00161 void SetAnnulusValue(TPixel v)
00162 { m_AnnulusValue = v; }
00163 TPixel GetAnnulusValue() const
00164 { return m_AnnulusValue; }
00165 void SetExteriorValue(TPixel v)
00166 { m_ExteriorValue = v; }
00167 TPixel GetExteriorValue() const
00168 { return m_ExteriorValue; }
00169
00173 Self &operator=(const Self& other)
00174 {
00175 Superclass::operator=(other);
00176 m_InnerRadius = other.m_InnerRadius;
00177 m_Thickness = other.m_Thickness;
00178 m_Spacing = other.m_Spacing;
00179 m_InteriorValue = other.m_InteriorValue;
00180 m_AnnulusValue = other.m_AnnulusValue;
00181 m_ExteriorValue = other.m_ExteriorValue;
00182 m_Normalize = other.m_Normalize;
00183 m_BrightCenter = other.m_BrightCenter;
00184 return *this;
00185 }
00189 virtual void PrintSelf(std::ostream &os, Indent i) const
00190 {
00191 os << i << "AnnulusOperator { this=" << this
00192 << ", m_InnerRadius = " << m_InnerRadius
00193 << ", m_Thickness = " << m_Thickness
00194 << ", m_Spacing = " << m_Spacing
00195 << ", m_Normalize = " << m_Normalize
00196 << ", m_BrightCenter = " << m_BrightCenter
00197 << ", m_InteriorValue = " << m_InteriorValue
00198 << ", m_ExteriorValue = " << m_ExteriorValue
00199 << "}" << std::endl;
00200 Superclass::PrintSelf(os, i.GetNextIndent());
00201 }
00202
00203
00204 protected:
00209 typedef typename Superclass::CoefficientVector CoefficientVector;
00210 typedef typename Superclass::PixelType PixelType;
00211
00215 CoefficientVector GenerateCoefficients();
00216
00220 void Fill(const CoefficientVector &c);
00221
00222 private:
00223 double m_InnerRadius;
00224 double m_Thickness;
00225 bool m_Normalize;
00226 bool m_BrightCenter;
00227 PixelType m_InteriorValue;
00228 PixelType m_AnnulusValue;
00229 PixelType m_ExteriorValue;
00230 SpacingType m_Spacing;
00231 };
00232
00233 }
00234
00235 #ifndef ITK_MANUAL_INSTANTIATION
00236 #include "itkAnnulusOperator.txx"
00237 #endif
00238
00239 #endif
00240
00241