Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkFlatStructuringElement_h
00019 #define __itkFlatStructuringElement_h
00020
00021 #include "itkNeighborhood.h"
00022 #include "itkSize.h"
00023 #include "itkOffset.h"
00024 #include <vector>
00025 #include "itkVector.h"
00026
00027 namespace itk {
00028
00041 template<unsigned int VDimension>
00042 class ITK_EXPORT FlatStructuringElement : public Neighborhood <bool, VDimension>
00043 {
00044 public:
00046 typedef FlatStructuringElement< VDimension> Self;
00047 typedef Neighborhood<bool, VDimension> Superclass;
00048
00050 typedef typename Superclass::PixelType PixelType;
00051
00055 typedef typename Superclass::Iterator Iterator;
00056 typedef typename Superclass::ConstIterator ConstIterator;
00057
00059 typedef typename Superclass::SizeType SizeType;
00060 typedef typename Superclass::SizeValueType SizeValueType;
00061 typedef typename Superclass::OffsetType OffsetType;
00062
00064 typedef typename Superclass::RadiusType RadiusType;
00065
00067 typedef typename Superclass::SliceIteratorType SliceIteratorType;
00068
00070 itkStaticConstMacro(NeighborhoodDimension, unsigned int, VDimension);
00071
00072 typedef Vector<float, VDimension> LType;
00073 typedef std::vector<LType> DecompType;
00074
00076 virtual ~FlatStructuringElement() {}
00077
00079 FlatStructuringElement() {m_Decomposable=false;}
00080
00087 static Self Box(RadiusType radius);
00088
00090 static Self Ball(RadiusType radius);
00091
00093 static Self Cross( RadiusType radius );
00094
00096 static Self Annulus( RadiusType radius,
00097 unsigned int thickness = 1,
00098 bool includeCenter = false );
00099
00105 static Self Poly(RadiusType radius, unsigned lines);
00106
00112 bool GetDecomposable() const
00113 {
00114 return m_Decomposable;
00115 }
00116
00118 const DecompType & GetLines() const
00119 {
00120 return(m_Lines);
00121 }
00122
00123 void PrintSelf(std::ostream &os, Indent indent) const;
00124
00125
00126 protected:
00127
00132 void ComputeBufferFromLines();
00133
00134
00135 private:
00136 bool m_Decomposable;
00137
00138 DecompType m_Lines;
00139
00140
00141 struct DispatchBase {};
00142 template<unsigned int VDimension2>
00143 struct Dispatch : DispatchBase {};
00144
00145 virtual FlatStructuringElement PolySub(const Dispatch<2> &,
00146 RadiusType radius,
00147 unsigned lines) const;
00148
00149 virtual FlatStructuringElement PolySub(const Dispatch<3> &,
00150 RadiusType radius,
00151 unsigned lines) const;
00152
00153 virtual FlatStructuringElement PolySub(const DispatchBase &,
00154 RadiusType radius,
00155 unsigned lines) const;
00156
00157
00158 bool checkParallel(LType NewVec, DecompType Lines);
00159
00160 template<unsigned int VDimension3>
00161 struct StructuringElementFacet
00162 {
00163 LType P1, P2, P3;
00164 };
00165 typedef StructuringElementFacet<VDimension> FacetType;
00166 };
00167 }
00168
00169 #ifndef ITK_MANUAL_INSTANTIATION
00170 #include "itkFlatStructuringElement.txx"
00171 #endif
00172
00173
00174 #endif
00175