ITK  4.3.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  Superclass::operator=(other);
182  m_InnerRadius = other.m_InnerRadius;
183  m_Thickness = other.m_Thickness;
184  m_Spacing = other.m_Spacing;
185  m_InteriorValue = other.m_InteriorValue;
186  m_AnnulusValue = other.m_AnnulusValue;
187  m_ExteriorValue = other.m_ExteriorValue;
188  m_Normalize = other.m_Normalize;
189  m_BrightCenter = other.m_BrightCenter;
190  return *this;
191  }
193 
195  virtual void PrintSelf(std::ostream & os, Indent i) const
196  {
197  os << i << "AnnulusOperator { this=" << this
198  << ", m_InnerRadius = " << m_InnerRadius
199  << ", m_Thickness = " << m_Thickness
200  << ", m_Spacing = " << m_Spacing
201  << ", m_Normalize = " << m_Normalize
202  << ", m_BrightCenter = " << m_BrightCenter
203  << ", m_InteriorValue = " << m_InteriorValue
204  << ", m_ExteriorValue = " << m_ExteriorValue
205  << "}" << std::endl;
206  Superclass::PrintSelf( os, i.GetNextIndent() );
207  }
209 
210 protected:
211 
215  typedef typename Superclass::PixelType PixelType;
216 
218  CoefficientVector GenerateCoefficients();
219 
221  void Fill(const CoefficientVector & c);
222 
223 private:
224 
226  double m_Thickness;
233 };
234 } // namespace itk
235 
236 #ifndef ITK_MANUAL_INSTANTIATION
237 #include "itkAnnulusOperator.hxx"
238 #endif
239 #endif
240