ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkFlatStructuringElement.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 __itkFlatStructuringElement_h
19 #define __itkFlatStructuringElement_h
20 
21 #include "itkNeighborhood.h"
22 #include <vector>
23 #include "itkVector.h"
24 
25 namespace itk
26 {
87 template< unsigned int VDimension >
88 class FlatStructuringElement:public Neighborhood< bool, VDimension >
89 {
90 public:
94 
96  typedef typename Superclass::PixelType PixelType;
97 
101  typedef typename Superclass::Iterator Iterator;
103 
105  typedef typename Superclass::SizeType SizeType;
107 
110 
113 
115  itkStaticConstMacro(NeighborhoodDimension, unsigned int, VDimension);
116 
118  typedef std::vector< LType > DecompType;
119 
122 
125  {
126  m_Decomposable = false;
127  m_RadiusIsParametric = false;
128  }
129 
136  static Self Box(RadiusType radius);
137 
139  static Self Ball(RadiusType radius, bool radiusIsParametric = false);
140 
142  static Self Cross(RadiusType radius);
143 
145  static Self Annulus(RadiusType radius,
146  unsigned int thickness = 1,
147  bool includeCenter = false,
148  bool radiusIsParametric = false);
149 
155  static Self Polygon(RadiusType radius, unsigned lines);
156 
162  bool GetDecomposable() const
163  {
164  return m_Decomposable;
165  }
166  void SetDecomposable( bool v )
167  {
168  m_Decomposable = v;
169  }
171 
173  const DecompType & GetLines() const
174  {
175  return ( m_Lines );
176  }
177  void AddLine( LType l )
178  {
179  m_Lines.push_back(l);
180  }
182 
183  bool CheckParallel(LType NewVec) const;
184 
189  void ComputeBufferFromLines();
190 
197  {
198  return m_RadiusIsParametric;
199  }
200  void SetRadiusIsParametric( bool flag )
201  {
202  m_RadiusIsParametric = flag;
203  }
204  itkBooleanMacro(RadiusIsParametric);
206 
207 
208 protected:
209 
210  void PrintSelf(std::ostream & os, Indent indent) const;
211 
212 private:
214 
216 
217  template< unsigned int VDimension3 >
220  };
222 
223  template<typename TStructuringElement, typename TRadius>
224  static void GeneratePolygon(TStructuringElement & res, TRadius radius, unsigned lines);
225  static void GeneratePolygon(itk::FlatStructuringElement<2> & res, itk::Size<2> radius, unsigned lines);
226  static void GeneratePolygon(itk::FlatStructuringElement<3> & res, itk::Size<3> radius, unsigned lines);
227 
229 
232 
234 
235 };
236 } // namespace itk
237 
238 #ifndef ITK_MANUAL_INSTANTIATION
239 #include "itkFlatStructuringElement.hxx"
240 #endif
241 
242 #endif
FlatStructuringElement< VDimension > Self
typedef::itk::Size< VDimension > RadiusType
Neighborhood< bool, VDimension > Superclass
A light-weight container object for storing an N-dimensional neighborhood of values.
static Self Polygon(RadiusType radius, unsigned lines)
StructuringElementFacet< VDimension > FacetType
Superclass::SliceIteratorType SliceIteratorType
bool CheckParallel(LType NewVec) const
static const unsigned int NeighborhoodDimension
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
typedef::itk::Size< VDimension > SizeType
void PrintSelf(std::ostream &os, Indent indent) const
static Self Ball(RadiusType radius, bool radiusIsParametric=false)
A flexible iterator for itk containers(i.e. itk::Neighborhood) that support pixel access through oper...
static Self Annulus(RadiusType radius, unsigned int thickness=1, bool includeCenter=false, bool radiusIsParametric=false)
A class to support a variety of flat structuring elements, including versions created by decompositio...
static Self Box(RadiusType radius)
Vector< float, VDimension > LType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
AllocatorType::const_iterator ConstIterator
StructuringElementFacet< 3 > FacetType3
static void GeneratePolygon(TStructuringElement &res, TRadius radius, unsigned lines)
static Self Cross(RadiusType radius)
const DecompType & GetLines() const
Superclass::ConstIterator ConstIterator