00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkAnnulusOperator_h
00019 #define __itkAnnulusOperator_h
00020
00021 #include "itkExceptionObject.h"
00022 #include "itkNeighborhoodOperator.h"
00023 #include "itkVector.h"
00024
00025 namespace itk {
00026
00068 template<class TPixel, unsigned int TDimension=2,
00069 class TAllocator = NeighborhoodAllocator<TPixel> >
00070 class ITK_EXPORT AnnulusOperator
00071 : public NeighborhoodOperator<TPixel, TDimension, TAllocator>
00072 {
00073 public:
00074
00076 typedef AnnulusOperator Self;
00077 typedef NeighborhoodOperator<TPixel, TDimension, TAllocator> Superclass;
00078
00080 typedef typename Superclass::SizeType SizeType;
00081 typedef typename Superclass::SizeValueType SizeValueType;
00082 typedef typename Superclass::OffsetType OffsetType;
00083 typedef Vector<double, TDimension> SpacingType;
00084
00085 itkTypeMacro(AnnulusOperator, NeighborhoodOperator);
00086
00087 AnnulusOperator()
00088 : NeighborhoodOperator<TPixel, TDimension, TAllocator>(),
00089 m_Normalize(false), m_BrightCenter(false),
00090 m_InteriorValue(NumericTraits<PixelType>::Zero),
00091 m_AnnulusValue(NumericTraits<PixelType>::One),
00092 m_ExteriorValue(NumericTraits<PixelType>::Zero)
00093 { m_Spacing.Fill(1.0); }
00094
00095 AnnulusOperator(const Self& other)
00096 : NeighborhoodOperator<TPixel, TDimension, TAllocator>(other)
00097 {
00098 m_InnerRadius = other.m_InnerRadius;
00099 m_Thickness = other.m_Thickness;
00100 m_Spacing = other.m_Spacing;
00101 m_InteriorValue = other.m_InteriorValue;
00102 m_AnnulusValue = other.m_AnnulusValue;
00103 m_ExteriorValue = other.m_ExteriorValue;
00104 m_Normalize = other.m_Normalize;
00105 m_BrightCenter = other.m_BrightCenter;
00106 }
00107
00110 void CreateOperator();
00111
00114 void SetInnerRadius(double r)
00115 { m_InnerRadius = r; }
00116 double GetInnerRadius() const
00117 { return m_InnerRadius; }
00119
00123 void SetThickness(double t)
00124 { m_Thickness = t; }
00125 double GetThickness() const
00126 { return m_Thickness; }
00128
00131 void SetSpacing(SpacingType &s)
00132 { m_Spacing = s; }
00133 const SpacingType& GetSpacing() const
00134 { return m_Spacing; }
00136
00139 void SetNormalize(bool b)
00140 { m_Normalize = b; }
00141 bool GetNormalize() const
00142 { return m_Normalize; }
00143 void NormalizeOn()
00144 { this->SetNormalize(true); }
00145 void NormalizeOff()
00146 { this->SetNormalize(false); }
00148
00151 void SetBrightCenter(bool b)
00152 { m_BrightCenter = b; }
00153 bool GetBrightCenter() const
00154 { return m_BrightCenter; }
00155 void BrightCenterOn()
00156 { this->SetBrightCenter(true); }
00157 void BrightCenterOff()
00158 { this->SetBrightCenter(false); }
00160
00165 void SetInteriorValue(TPixel v)
00166 { m_InteriorValue = v; }
00167 TPixel GetInteriorValue() const
00168 { return m_InteriorValue; }
00169 void SetAnnulusValue(TPixel v)
00170 { m_AnnulusValue = v; }
00171 TPixel GetAnnulusValue() const
00172 { return m_AnnulusValue; }
00173 void SetExteriorValue(TPixel v)
00174 { m_ExteriorValue = v; }
00175 TPixel GetExteriorValue() const
00176 { return m_ExteriorValue; }
00178
00180 Self &operator=(const Self& other)
00181 {
00182 Superclass::operator=(other);
00183 m_InnerRadius = other.m_InnerRadius;
00184 m_Thickness = other.m_Thickness;
00185 m_Spacing = other.m_Spacing;
00186 m_InteriorValue = other.m_InteriorValue;
00187 m_AnnulusValue = other.m_AnnulusValue;
00188 m_ExteriorValue = other.m_ExteriorValue;
00189 m_Normalize = other.m_Normalize;
00190 m_BrightCenter = other.m_BrightCenter;
00191 return *this;
00192 }
00194
00196 virtual void PrintSelf(std::ostream &os, Indent i) const
00197 {
00198 os << i << "AnnulusOperator { this=" << this
00199 << ", m_InnerRadius = " << m_InnerRadius
00200 << ", m_Thickness = " << m_Thickness
00201 << ", m_Spacing = " << m_Spacing
00202 << ", m_Normalize = " << m_Normalize
00203 << ", m_BrightCenter = " << m_BrightCenter
00204 << ", m_InteriorValue = " << m_InteriorValue
00205 << ", m_ExteriorValue = " << m_ExteriorValue
00206 << "}" << std::endl;
00207 Superclass::PrintSelf(os, i.GetNextIndent());
00208 }
00210
00211 protected:
00212
00215 typedef typename Superclass::CoefficientVector CoefficientVector;
00216 typedef typename Superclass::PixelType PixelType;
00217
00219 CoefficientVector GenerateCoefficients();
00220
00222 void Fill(const CoefficientVector &c);
00223
00224 private:
00225
00226 double m_InnerRadius;
00227 double m_Thickness;
00228 bool m_Normalize;
00229 bool m_BrightCenter;
00230 PixelType m_InteriorValue;
00231 PixelType m_AnnulusValue;
00232 PixelType m_ExteriorValue;
00233 SpacingType m_Spacing;
00234 };
00235
00236 }
00237
00238
00239
00240 #define ITK_TEMPLATE_AnnulusOperator(_, EXPORT, x, y) namespace itk { \
00241 _(2(class EXPORT AnnulusOperator< ITK_TEMPLATE_2 x >)) \
00242 namespace Templates { typedef AnnulusOperator< ITK_TEMPLATE_2 x > \
00243 AnnulusOperator##y; } \
00244 }
00245
00246 #if ITK_TEMPLATE_EXPLICIT
00247 # include "Templates/itkAnnulusOperator+-.h"
00248 #endif
00249
00250 #if ITK_TEMPLATE_TXX
00251 # include "itkAnnulusOperator.txx"
00252 #endif
00253
00254 #endif
00255