ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkAnnulusOperator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkAnnulusOperator_h
19 #define __itkAnnulusOperator_h
20 
22 #include "itkVector.h"
23 
24 namespace itk
25 {
68 template< class TPixel, unsigned int TDimension = 2,
69  class TAllocator = NeighborhoodAllocator< TPixel > >
70 class ITK_EXPORT AnnulusOperator:
71  public NeighborhoodOperator< TPixel, TDimension, TAllocator >
72 {
73 public:
74 
78 
80  typedef typename Superclass::SizeType SizeType;
83 
85 
87  NeighborhoodOperator< TPixel, TDimension, TAllocator >(),
88  m_Normalize(false), m_BrightCenter(false),
89  m_InteriorValue(NumericTraits< PixelType >::Zero),
90  m_AnnulusValue(NumericTraits< PixelType >::One),
91  m_ExteriorValue(NumericTraits< PixelType >::Zero)
92  { m_Spacing.Fill(1.0); }
93 
94  AnnulusOperator(const Self & other):
95  NeighborhoodOperator< TPixel, TDimension, TAllocator >(other)
96  {
97  m_InnerRadius = other.m_InnerRadius;
98  m_Thickness = other.m_Thickness;
99  m_Spacing = other.m_Spacing;
100  m_InteriorValue = other.m_InteriorValue;
101  m_AnnulusValue = other.m_AnnulusValue;
102  m_ExteriorValue = other.m_ExteriorValue;
103  m_Normalize = other.m_Normalize;
104  m_BrightCenter = other.m_BrightCenter;
105  }
106 
109  void CreateOperator();
110 
113  void SetInnerRadius(double r)
114  { m_InnerRadius = r; }
115  double GetInnerRadius() const
116  { return m_InnerRadius; }
118 
122  void SetThickness(double t)
123  { m_Thickness = t; }
124  double GetThickness() const
125  { return m_Thickness; }
127 
130  void SetSpacing(SpacingType & s)
131  { m_Spacing = s; }
132  const SpacingType & GetSpacing() const
133  { return m_Spacing; }
135 
138  void SetNormalize(bool b)
139  { m_Normalize = b; }
140  bool GetNormalize() const
141  { return m_Normalize; }
142  void NormalizeOn()
143  { this->SetNormalize(true); }
144  void NormalizeOff()
145  { this->SetNormalize(false); }
147 
150  void SetBrightCenter(bool b)
151  { m_BrightCenter = b; }
152  bool GetBrightCenter() const
153  { return m_BrightCenter; }
154  void BrightCenterOn()
155  { this->SetBrightCenter(true); }
156  void BrightCenterOff()
157  { this->SetBrightCenter(false); }
159 
164  void SetInteriorValue(TPixel v)
165  { m_InteriorValue = v; }
166  TPixel GetInteriorValue() const
167  { return m_InteriorValue; }
168  void SetAnnulusValue(TPixel v)
169  { m_AnnulusValue = v; }
170  TPixel GetAnnulusValue() const
171  { return m_AnnulusValue; }
172  void SetExteriorValue(TPixel v)
173  { m_ExteriorValue = v; }
174  TPixel GetExteriorValue() const
175  { return m_ExteriorValue; }
177 
179  Self & operator=(const Self & other)
180  {
181  if(this != &other)
182  {
183  Superclass::operator=(other);
184  m_InnerRadius = other.m_InnerRadius;
185  m_Thickness = other.m_Thickness;
186  m_Spacing = other.m_Spacing;
187  m_InteriorValue = other.m_InteriorValue;
188  m_AnnulusValue = other.m_AnnulusValue;
189  m_ExteriorValue = other.m_ExteriorValue;
190  m_Normalize = other.m_Normalize;
191  m_BrightCenter = other.m_BrightCenter;
192  }
193  return *this;
194  }
196 
198  virtual void PrintSelf(std::ostream & os, Indent i) const
199  {
200  os << i << "AnnulusOperator { this=" << this
201  << ", m_InnerRadius = " << m_InnerRadius
202  << ", m_Thickness = " << m_Thickness
203  << ", m_Spacing = " << m_Spacing
204  << ", m_Normalize = " << m_Normalize
205  << ", m_BrightCenter = " << m_BrightCenter
206  << ", m_InteriorValue = " << m_InteriorValue
207  << ", m_ExteriorValue = " << m_ExteriorValue
208  << "}" << std::endl;
209  Superclass::PrintSelf( os, i.GetNextIndent() );
210  }
212 
213 protected:
214 
218  typedef typename Superclass::PixelType PixelType;
219 
221  CoefficientVector GenerateCoefficients();
222 
224  void Fill(const CoefficientVector & c);
225 
226 private:
227 
229  double m_Thickness;
236 };
237 } // namespace itk
238 
239 #ifndef ITK_MANUAL_INSTANTIATION
240 #include "itkAnnulusOperator.hxx"
241 #endif
242 #endif
243