ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkConnectedRegionsMeshFilter.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 /*=========================================================================
19  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
28 #ifndef itkConnectedRegionsMeshFilter_h
29 #define itkConnectedRegionsMeshFilter_h
30 
31 #include "itkIntTypes.h"
32 #include "itkMeshToMeshFilter.h"
33 
34 namespace itk
35 {
49 template< typename TInputMesh, typename TOutputMesh >
51  public MeshToMeshFilter< TInputMesh, TOutputMesh >
52 {
53 public:
58 
63 
69 
73  itkNewMacro(Self);
74 
78  typedef TInputMesh InputMeshType;
79  typedef TOutputMesh OutputMeshType;
80  typedef typename TInputMesh::ConstPointer InputMeshConstPointer;
81  typedef typename TOutputMesh::Pointer OutputMeshPointer;
82 
83  itkStaticConstMacro(PointDimension, unsigned int,
84  TInputMesh::PointDimension);
85 
86  typedef typename TInputMesh::PointType InputMeshPointType;
87  typedef typename TInputMesh::PointIdentifier InputMeshPointIdentifier;
88  typedef typename TInputMesh::PointsContainerConstPointer InputMeshPointsContainerConstPointer;
89  typedef typename TInputMesh::CellsContainer InputMeshCellsContainer;
90  typedef typename TInputMesh::CellsContainerPointer InputMeshCellsContainerPointer;
91  typedef typename TInputMesh::CellsContainerConstPointer InputMeshCellsContainerConstPointer;
92  typedef typename TInputMesh::CellDataContainer InputMeshCellDataContainer;
93  typedef typename TInputMesh::CellDataContainerPointer InputMeshCellDataContainerPointer;
94  typedef typename TInputMesh::CellDataContainerConstPointer InputMeshCellDataContainerConstPointer;
95  typedef typename InputMeshType::PointsContainer::ConstIterator PointsContainerConstIterator;
96  typedef typename InputMeshType::CellsContainer::ConstIterator CellsContainerConstIterator;
97  typedef typename InputMeshType::CellDataContainer::ConstIterator CellDataContainerConstIterator;
98  typedef typename TInputMesh::CellAutoPointer InputMeshCellPointer;
99  typedef typename TInputMesh::CellTraits::PointIdConstIterator InputMeshPointIdConstIterator;
100  typedef typename TInputMesh::CellLinksContainerConstPointer InputMeshCellLinksContainerConstPointer;
101  typedef typename TInputMesh::PointCellLinksContainer InputMeshCellLinksContainer;
102  typedef typename TInputMesh::CellIdentifier InputMeshCellIdentifier;
103 
108  enum { PointSeededRegions = 0,
114 
121  itkSetMacro(ExtractionMode, int);
122  itkGetConstMacro(ExtractionMode, int);
124 
126  {
128  }
129 
131  {
133  }
134 
136  {
138  }
139 
141  {
143  }
144 
146  {
148  }
149 
151  {
153  }
154 
159  {
160  this->Modified();
161  m_SeedList.clear();
162  }
164 
169  {
170  this->Modified();
171  m_SeedList.push_back(id);
172  }
174 
178  void DeleteSeed(IdentifierType id);
179 
184  {
185  this->Modified();
186  m_RegionList.clear();
187  }
189 
194  {
195  this->Modified();
196  m_RegionList.push_back(id);
197  }
199 
204 
210  {
211  if ( m_ClosestPoint != p )
212  {
213  m_ClosestPoint = p;
214  this->Modified();
215  }
216  }
218 
220  {
221  return m_ClosestPoint;
222  }
223 
228  {
229  return m_RegionList.size();
230  }
231 
232 protected:
233 
236 
237  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
238 
239  virtual void GenerateData() ITK_OVERRIDE;
240 
241  void PropagateConnectedWave();
242 
243 private:
244 
245  ConnectedRegionsMeshFilter(const Self &) ITK_DELETE_FUNCTION;
246  void operator=(const Self &) ITK_DELETE_FUNCTION;
247 
250  std::vector< IdentifierType > m_SeedList;
251  std::vector< IdentifierType > m_RegionList;
252  std::vector< SizeValueType > m_RegionSizes;
253 
254  std::vector< OffsetValueType > m_Visited;
257  std::vector< IdentifierType > *m_Wave;
258  std::vector< IdentifierType > *m_Wave2;
259 }; // class declaration
260 } // end namespace itk
261 
262 #ifndef ITK_MANUAL_INSTANTIATION
263 #include "itkConnectedRegionsMeshFilter.hxx"
264 #endif
265 
266 #endif
std::vector< IdentifierType > m_RegionList
virtual void SetExtractionMode(int _arg)
InputMeshType::CellsContainer::ConstIterator CellsContainerConstIterator
TInputMesh::CellLinksContainerConstPointer InputMeshCellLinksContainerConstPointer
TInputMesh::PointIdentifier InputMeshPointIdentifier
Light weight base class for most itk classes.
MeshToMeshFilter< TInputMesh, TOutputMesh > Superclass
signed long OffsetValueType
Definition: itkIntTypes.h:154
std::vector< IdentifierType > * m_Wave2
TInputMesh::PointsContainerConstPointer InputMeshPointsContainerConstPointer
InputMeshType::PointsContainer::ConstIterator PointsContainerConstIterator
InputMeshPointType & GetClosestPoint(InputMeshPointType &)
TInputMesh::CellIdentifier InputMeshCellIdentifier
std::vector< SizeValueType > m_RegionSizes
MeshToMeshFilter is the base class for all process objects that output mesh data, and require mesh da...
TInputMesh::CellTraits::PointIdConstIterator InputMeshPointIdConstIterator
unsigned long SizeValueType
Definition: itkIntTypes.h:143
TInputMesh::CellsContainerPointer InputMeshCellsContainerPointer
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
void DeleteSeed(IdentifierType id)
TInputMesh::CellDataContainer InputMeshCellDataContainer
TInputMesh::CellsContainer InputMeshCellsContainer
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void Modified() const
void DeleteSpecifiedRegion(IdentifierType id)
TInputMesh::PointCellLinksContainer InputMeshCellLinksContainer
TInputMesh::CellDataContainerPointer InputMeshCellDataContainerPointer
std::vector< OffsetValueType > m_Visited
TInputMesh::CellAutoPointer InputMeshCellPointer
std::vector< IdentifierType > m_SeedList
std::vector< IdentifierType > * m_Wave
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void GenerateData() override
TInputMesh::CellDataContainerConstPointer InputMeshCellDataContainerConstPointer
InputMeshType::CellDataContainer::ConstIterator CellDataContainerConstIterator
TInputMesh::CellsContainerConstPointer InputMeshCellsContainerConstPointer
Extract portions of a mesh that are connected at vertices.