Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkAnnulusOperator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkAnnulusOperator.h,v $
00005   Language:  C++
00006   Date:      $Date: 2006/03/18 18:06:14 $
00007   Version:   $Revision: 1.5 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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::OffsetType OffsetType;
00082   typedef Vector<double, TDimension>      SpacingType;
00083 
00084   itkTypeMacro(AnnulusOperator, NeighborhoodOperator);
00085   
00086   AnnulusOperator()
00087     : NeighborhoodOperator<TPixel, TDimension, TAllocator>(),
00088       m_Normalize(false), m_BrightCenter(false),
00089       m_InteriorValue(NumericTraits<PixelType>::Zero),
00090       m_AnnulusValue(NumericTraits<PixelType>::One),
00091       m_ExteriorValue(NumericTraits<PixelType>::Zero)
00092     { m_Spacing.Fill(1.0); }
00093 
00094   AnnulusOperator(const Self& other)
00095     : NeighborhoodOperator<TPixel, TDimension, TAllocator>(other)
00096     {
00097     m_InnerRadius = other.m_InnerRadius;
00098     m_Thickness = other.m_Thickness;
00099     m_Spacing = other.m_Spacing;
00100     m_InteriorValue = other.m_InteriorValue;
00101     m_AnnulusValue = other.m_AnnulusValue;
00102     m_ExteriorValue = other.m_ExteriorValue;
00103     m_Normalize = other.m_Normalize;
00104     m_BrightCenter = other.m_BrightCenter;
00105     }
00106 
00109   void CreateOperator();  
00110 
00113   void SetInnerRadius(double r)
00114     { m_InnerRadius = r; }
00115   double GetInnerRadius() const
00116     { return m_InnerRadius; }
00118 
00122   void SetThickness(double t)
00123     { m_Thickness = t; }
00124   double GetThickness() const
00125     { return m_Thickness; }
00127 
00130   void SetSpacing(SpacingType &s)
00131     { m_Spacing = s; }
00132   const SpacingType& GetSpacing() const
00133     { return m_Spacing; }
00135 
00138   void SetNormalize(bool b)
00139     { m_Normalize = b; }
00140   bool GetNormalize() const
00141     { return m_Normalize; }
00142   void NormalizeOn()
00143     { this->SetNormalize(true); }
00144   void NormalizeOff()
00145     { this->SetNormalize(false); }
00147 
00150   void SetBrightCenter(bool b)
00151     { m_BrightCenter = b; }
00152   bool GetBrightCenter() const
00153     { return m_BrightCenter; }
00154   void BrightCenterOn()
00155     { this->SetBrightCenter(true); }
00156   void BrightCenterOff()
00157     { this->SetBrightCenter(false); }
00159 
00164   void SetInteriorValue(TPixel v)
00165     { m_InteriorValue = v; }
00166   TPixel GetInteriorValue() const
00167     { return m_InteriorValue; }
00168   void SetAnnulusValue(TPixel v)
00169     { m_AnnulusValue = v; }
00170   TPixel GetAnnulusValue() const
00171     { return m_AnnulusValue; }
00172   void SetExteriorValue(TPixel v)
00173     { m_ExteriorValue = v; }
00174   TPixel GetExteriorValue() const
00175     { return m_ExteriorValue; }
00177 
00179   Self &operator=(const Self& other)
00180     {
00181     Superclass::operator=(other);
00182     m_InnerRadius = other.m_InnerRadius;
00183     m_Thickness = other.m_Thickness;
00184     m_Spacing = other.m_Spacing;
00185     m_InteriorValue = other.m_InteriorValue;
00186     m_AnnulusValue = other.m_AnnulusValue;
00187     m_ExteriorValue = other.m_ExteriorValue;
00188     m_Normalize = other.m_Normalize;
00189     m_BrightCenter = other.m_BrightCenter;
00190     return *this;
00191     }
00193 
00195   virtual void PrintSelf(std::ostream &os, Indent i) const  
00196     { 
00197     os << i << "AnnulusOperator { this=" << this
00198        << ", m_InnerRadius = " << m_InnerRadius
00199        << ", m_Thickness = " << m_Thickness
00200        << ", m_Spacing = " << m_Spacing
00201        << ", m_Normalize = " << m_Normalize
00202        << ", m_BrightCenter = " << m_BrightCenter
00203        << ", m_InteriorValue = " << m_InteriorValue
00204        << ", m_ExteriorValue = " << m_ExteriorValue
00205        << "}" << std::endl;
00206     Superclass::PrintSelf(os, i.GetNextIndent());
00207     }
00209 
00210 protected:
00211   
00214   typedef typename Superclass::CoefficientVector CoefficientVector;
00215   typedef typename Superclass::PixelType         PixelType;
00216 
00218   CoefficientVector GenerateCoefficients();
00219 
00221   void Fill(const CoefficientVector &c);
00222 
00223 private:
00224 
00225   double m_InnerRadius;
00226   double m_Thickness;
00227   bool m_Normalize;
00228   bool m_BrightCenter;
00229   PixelType m_InteriorValue;
00230   PixelType m_AnnulusValue;
00231   PixelType m_ExteriorValue;
00232   SpacingType m_Spacing;
00233 };
00234 
00235 } // namespace itk
00236 
00237 #ifndef ITK_MANUAL_INSTANTIATION
00238 #include "itkAnnulusOperator.txx"
00239 #endif
00240 
00241 #endif
00242 

Generated at Fri Sep 8 02:38:57 2006 for ITK by doxygen 1.4.7 written by Dimitri van Heesch, © 1997-2000