ITK  5.4.0
Insight Toolkit
itkPolyLineCell.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  * https://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 itkPolyLineCell_h
19 #define itkPolyLineCell_h
20 
21 #include "itkVertexCell.h"
22 namespace itk
23 {
40 template <typename TCellInterface>
41 class ITK_TEMPLATE_EXPORT PolyLineCell : public TCellInterface
42 {
43 public:
44  ITK_DISALLOW_COPY_AND_MOVE(PolyLineCell);
45 
48  itkCellInheritedTypedefs(TCellInterface);
52  itkOverrideGetNameOfClassMacro(PolyLineCell);
53 
56  using VertexAutoPointer = typename VertexType::SelfAutoPointer;
57 
59  static constexpr unsigned int CellDimension = 1;
60 
63  GetType() const override
64  {
66  }
67  void
68  MakeCopy(CellAutoPointer &) const override;
71  unsigned int
72  GetDimension() const override;
73 
74  unsigned int
75  GetNumberOfPoints() const override;
76 
77  CellFeatureCount
78  GetNumberOfBoundaryFeatures(int dimension) const override;
79 
80  bool
81  GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &) override;
82 
83  void
84  InitializePoints();
85 
86  void
87  ClearPoints();
88 
89  void
90  SetPointIds(PointIdConstIterator first) override;
91 
92  void
93  SetPointIds(PointIdConstIterator first, PointIdConstIterator last) override;
94 
95  void
96  SetPointIds(int dummy, int num, PointIdConstIterator first);
97 
98  void
99  SetPointId(int localId, PointIdentifier) override;
100  PointIdIterator
101  PointIdsBegin() override;
102 
103  PointIdConstIterator
104  PointIdsBegin() const override;
105 
106  PointIdIterator
107  PointIdsEnd() override;
108 
109  PointIdConstIterator
110  PointIdsEnd() const override;
111 
113  virtual CellFeatureCount
114  GetNumberOfVertices() const;
115 
116  virtual bool
117  GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
118 
121 
122  void
123  InitializePoints(PointIdentifier numberOfPoints)
124  {
125  m_PointIds.clear();
126  for (PointIdentifier i = 0; i < numberOfPoints; ++i)
127  {
128  m_PointIds.push_back(NumericTraits<PointIdentifier>::max());
129  }
130  }
131 
133  PolyLineCell() { InitializePoints(2); }
134 
135  PolyLineCell(PointIdentifier numberOfPoints) { InitializePoints(numberOfPoints); }
136 
137  ~PolyLineCell() override = default;
138 
139 protected:
141  std::vector<PointIdentifier> m_PointIds{};
142 };
143 } // end namespace itk
144 
145 #ifndef ITK_MANUAL_INSTANTIATION
146 # include "itkPolyLineCell.hxx"
147 #endif
148 
149 #endif
itk::VertexCell
Represents a single vertex for a Mesh.
Definition: itkVertexCell.h:42
itk::PolyLineCell
Represents a series of connected line segments for a Mesh.
Definition: itkPolyLineCell.h:41
itk::PolyLineCell::GetType
CellGeometryEnum GetType() const override
Definition: itkPolyLineCell.h:63
itk::PolyLineCell::PolyLineCell
PolyLineCell(PointIdentifier numberOfPoints)
Definition: itkPolyLineCell.h:135
itk::PolyLineCell::VertexAutoPointer
typename VertexType::SelfAutoPointer VertexAutoPointer
Definition: itkPolyLineCell.h:56
itkCellVisitMacro
#define itkCellVisitMacro(TopologyId)
Definition: itkCellInterface.h:32
itk::CommonEnums::CellGeometry::POLYLINE_CELL
itk::PolyLineCell::InitializePoints
void InitializePoints(PointIdentifier numberOfPoints)
Definition: itkPolyLineCell.h:123
itkCellInheritedTypedefs
#define itkCellInheritedTypedefs(superclassArg)
Definition: itkCellInterface.h:55
itk::CommonEnums::CellGeometry
CellGeometry
Definition: itkCommonEnums.h:138
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:59
itkVertexCell.h
itk::PolyLineCell::PolyLineCell
PolyLineCell()
Definition: itkPolyLineCell.h:133
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkCellCommonTypedefs
#define itkCellCommonTypedefs(celltype)
Definition: itkCellInterface.h:46