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