ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkBorderQuadEdgeMeshFilter.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 __itkBorderQuadEdgeMeshFilter_h
19 #define __itkBorderQuadEdgeMeshFilter_h
20 
21 #include "itkQuadEdgeMesh.h"
24 
25 namespace itk
26 {
49 template< class TInputMesh, class TOutputMesh=TInputMesh >
50 class ITK_EXPORT BorderQuadEdgeMeshFilter:
51  public QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
52 {
53 public:
54 
57  typedef QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh,
58  TOutputMesh >
62 
63  typedef TInputMesh InputMeshType;
64  typedef typename InputMeshType::ConstPointer InputMeshConstPointer;
65  typedef typename InputMeshType::CoordRepType InputCoordRepType;
66  typedef typename InputMeshType::PointType InputPointType;
67  typedef typename InputMeshType::Traits InputTraits;
68  typedef typename InputMeshType::PointIdentifier InputPointIdentifier;
69  typedef typename InputMeshType::QEType InputQEType;
70  typedef typename InputQEType::IteratorGeom InputIteratorGeom;
71  typedef typename InputMeshType::VectorType InputVectorType;
72  typedef typename InputMeshType::EdgeListType InputEdgeListType;
73  typedef typename InputMeshType::EdgeListPointerType InputEdgeListPointerType;
74  typedef typename InputEdgeListType::iterator InputEdgeListIterator;
75  typedef typename InputMeshType::EdgeCellType InputEdgeCellType;
76  typedef typename InputMeshType::PolygonCellType InputPolygonCellType;
77  typedef typename InputMeshType::PointIdList InputPointIdList;
78  typedef typename InputMeshType::PointsContainer InputPointsContainer;
79  typedef typename InputMeshType::PointsContainerConstIterator
81  typedef typename InputMeshType::CellsContainerConstIterator
83 
84  typedef TOutputMesh OutputMeshType;
85  typedef typename OutputMeshType::Pointer OutputMeshPointer;
86  typedef typename OutputMeshType::CoordRepType OutputCoordRepType;
87  typedef typename OutputMeshType::PointType OutputPointType;
88  typedef typename OutputMeshType::Traits OutputTraits;
89  typedef typename OutputMeshType::PointIdentifier OutputPointIdentifier;
90  typedef typename OutputMeshType::QEType OutputQEType;
91  typedef typename OutputMeshType::VectorType OutputVectorType;
92  typedef typename OutputMeshType::EdgeListType OutputEdgeListType;
93  typedef typename OutputMeshType::EdgeCellType OutputEdgeCellType;
94  typedef typename OutputMeshType::PolygonCellType OutputPolygonCellType;
95  typedef typename OutputMeshType::PointIdList OutputPointIdList;
96  typedef typename OutputMeshType::PointsContainer OutputPointsContainer;
97  typedef typename OutputMeshType::PointsContainerConstIterator
99  typedef typename OutputMeshType::CellsContainerConstIterator
101 
102  itkNewMacro(Self);
104  itkStaticConstMacro(PointDimension, unsigned int,
105  InputTraits::PointDimension);
106 
107  typedef std::vector< InputPointType > InputVectorPointType;
108  typedef std::map< InputPointIdentifier, OutputPointIdentifier > MapPointIdentifier;
109  typedef typename MapPointIdentifier::iterator MapPointIdentifierIterator;
110 
113 
115  SQUARE_BORDER_TRANSFORM = 0,
116  DISK_BORDER_TRANSFORM
117  };
118 
120  LONGEST = 0,
121  LARGEST
122  };
123 
124  itkSetMacro(TransformType, BorderTransformType);
125  itkGetConstMacro(TransformType, BorderTransformType);
126 
127  itkSetMacro( BorderPick, BorderPickType );
128  itkGetConstMacro( BorderPick, BorderPickType );
129 
130  itkSetMacro(Radius, InputCoordRepType);
131  itkGetConstMacro(Radius, InputCoordRepType);
132 
133  void ComputeTransform();
134 
135  MapPointIdentifier GetBoundaryPtMap();
136 
137  InputVectorPointType GetBorder();
138 
139 protected:
141 
143 
144  void PrintSelf(std::ostream & os, Indent indent) const;
145 
148 
150 
152 
154 
155  void GenerateData();
156 
157  void ComputeBoundary();
158 
159  InputQEType* ComputeLongestBorder();
160 
161  InputQEType* ComputeLargestBorder();
162 
163  void DiskTransform();
164 
165  InputPointType GetMeshBarycentre();
166 
167  InputCoordRepType RadiusMaxSquare();
168 
169  void ArcLengthSquareTransform();
170 
171 private:
172  BorderQuadEdgeMeshFilter(const Self &); //purposely not implemented
173  void operator=(const Self &); //purposely ont implemented
174 };
175 } // end namespace itk
176 
177 #ifndef ITK_MANUAL_INSTANTIATION
178 #include "itkBorderQuadEdgeMeshFilter.hxx"
179 #endif
180 
181 #endif
182