ITK  5.1.0
Insight Toolkit
itkAnnulusOperator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 {
71 template <typename TPixel, unsigned int TDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
72 class ITK_TEMPLATE_EXPORT AnnulusOperator : public NeighborhoodOperator<TPixel, TDimension, TAllocator>
73 {
74 public:
75 
77  using Self = AnnulusOperator;
78  using Superclass = NeighborhoodOperator<TPixel, TDimension, TAllocator>;
79 
81  using SizeType = typename Superclass::SizeType;
82  using OffsetType = typename Superclass::OffsetType;
83  using SpacingType = Vector<double, TDimension>;
84 
85  itkTypeMacro(AnnulusOperator, NeighborhoodOperator);
86 
89  void
90  CreateOperator();
91 
94  void
95  SetInnerRadius(double r)
96  {
97  m_InnerRadius = r;
98  }
99  double
100  GetInnerRadius() const
101  {
102  return m_InnerRadius;
103  }
105 
109  void
110  SetThickness(double t)
111  {
112  m_Thickness = t;
113  }
114  double
115  GetThickness() const
116  {
117  return m_Thickness;
118  }
120 
123  void
124  SetSpacing(SpacingType & s)
125  {
126  m_Spacing = s;
127  }
128  const SpacingType &
129  GetSpacing() const
130  {
131  return m_Spacing;
132  }
134 
137  void
138  SetNormalize(bool b)
139  {
140  m_Normalize = b;
141  }
142  bool
143  GetNormalize() const
144  {
145  return m_Normalize;
146  }
147  void
148  NormalizeOn()
149  {
150  this->SetNormalize(true);
151  }
152  void
153  NormalizeOff()
154  {
155  this->SetNormalize(false);
156  }
158 
161  void
162  SetBrightCenter(bool b)
163  {
164  m_BrightCenter = b;
165  }
166  bool
167  GetBrightCenter() const
168  {
169  return m_BrightCenter;
170  }
171  void
172  BrightCenterOn()
173  {
174  this->SetBrightCenter(true);
175  }
176  void
177  BrightCenterOff()
178  {
179  this->SetBrightCenter(false);
180  }
182 
187  void
188  SetInteriorValue(TPixel v)
189  {
190  m_InteriorValue = v;
191  }
192  TPixel
193  GetInteriorValue() const
194  {
195  return m_InteriorValue;
196  }
197  void
198  SetAnnulusValue(TPixel v)
199  {
200  m_AnnulusValue = v;
201  }
202  TPixel
203  GetAnnulusValue() const
204  {
205  return m_AnnulusValue;
206  }
207  void
208  SetExteriorValue(TPixel v)
209  {
210  m_ExteriorValue = v;
211  }
212  TPixel
213  GetExteriorValue() const
214  {
215  return m_ExteriorValue;
216  }
218 
220  void
221  PrintSelf(std::ostream & os, Indent i) const override
222  {
223  os << i << "AnnulusOperator { this=" << this << ", m_InnerRadius = " << m_InnerRadius
224  << ", m_Thickness = " << m_Thickness << ", m_Spacing = " << m_Spacing << ", m_Normalize = " << m_Normalize
225  << ", m_BrightCenter = " << m_BrightCenter << ", m_InteriorValue = " << m_InteriorValue
226  << ", m_ExteriorValue = " << m_ExteriorValue << "}" << std::endl;
227  Superclass::PrintSelf(os, i.GetNextIndent());
228  }
230 
231 protected:
234  using CoefficientVector = typename Superclass::CoefficientVector;
235  using PixelType = typename Superclass::PixelType;
236 
238  CoefficientVector
239  GenerateCoefficients() override;
240 
242  void
243  Fill(const CoefficientVector & c) override;
244 
245 private:
246  double m_InnerRadius{ 1.0 };
247  double m_Thickness{ 1.0 };
248  bool m_Normalize{ false };
249  bool m_BrightCenter{ false };
250  PixelType m_InteriorValue{ NumericTraits<PixelType>::ZeroValue() };
251  PixelType m_AnnulusValue{ NumericTraits<PixelType>::OneValue() };
252  PixelType m_ExteriorValue{ NumericTraits<PixelType>::ZeroValue() };
253  SpacingType m_Spacing{ 1.0 };
254 };
255 } // namespace itk
256 
257 #ifndef ITK_MANUAL_INSTANTIATION
258 # include "itkAnnulusOperator.hxx"
259 #endif
260 #endif
AnnulusOperator
A NeighborhoodOperator for performing a matched filtering with an annulus (two concentric circles,...
itkNeighborhoodOperator.h
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::NumericTraits::OneValue
static T OneValue()
Definition: itkNumericTraits.h:156
itk::NumericTraits::ZeroValue
static T ZeroValue()
Definition: itkNumericTraits.h:148
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itkVector.h