ITK  6.0.0
Insight Toolkit
itkQuadEdgeMeshLineCell.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 itkQuadEdgeMeshLineCell_h
19 #define itkQuadEdgeMeshLineCell_h
20 
21 #include "itkAutoPointer.h"
22 #include "itkMesh.h"
23 #include "itkGeometricalQuadEdge.h"
24 #include "itkCommonEnums.h"
25 
26 namespace itk
27 {
40 template <typename TCellInterface>
41 class ITK_TEMPLATE_EXPORT QuadEdgeMeshLineCell
42  : public TCellInterface
43  , public TCellInterface::CellTraits::QuadEdgeType
44 {
45 public:
46  ITK_DISALLOW_COPY_AND_MOVE(QuadEdgeMeshLineCell);
47 
49  // itkCellCommonTypedefs
53  using RawPointer = Self *;
54  using ConstRawPointer = const Self *;
55 
56  // itkCellInheritedTypedefs
57  using Superclass = TCellInterface;
58  using typename Superclass::PixelType;
59  using CellType = typename Superclass::CellType;
60  using typename Superclass::CellAutoPointer;
61  using typename Superclass::CellConstAutoPointer;
62  using typename Superclass::CellRawPointer;
63  using typename Superclass::CellConstRawPointer;
64  using CellTraits = typename Superclass::CellTraits;
65  using typename Superclass::CoordRepType;
66  using typename Superclass::InterpolationWeightType;
67  using typename Superclass::PointIdentifier;
68  using typename Superclass::CellIdentifier;
69  using typename Superclass::CellFeatureIdentifier;
70  using CellFeatureCount = typename Superclass::CellFeatureIdentifier;
71  using typename Superclass::PointType;
72  using typename Superclass::PointsContainer;
73  using typename Superclass::UsingCellsContainer;
74  using typename Superclass::ParametricCoordArrayType;
75  using typename Superclass::ShapeFunctionsArrayType;
76  static constexpr unsigned int PointDimension = Superclass::PointDimension;
77  static constexpr unsigned int CellDimension = 2;
78 
80  using MultiVisitor = typename CellType::MultiVisitor;
81 
83  using PointIdIterator = typename CellTraits::PointIdIterator;
84  using PointIdConstIterator = typename CellTraits::PointIdConstIterator;
85  using PointIdInternalIterator = typename CellTraits::PointIdInternalIterator;
86  using PointIdInternalConstIterator = typename CellTraits::PointIdInternalConstIterator;
87 
89  using QEType = typename CellTraits::QuadEdgeType;
90  using VertexRefType = typename QEType::OriginRefType;
91  using FaceRefType = typename QEType::DualOriginRefType;
92  using PrimalDataType = typename QEType::PrimalDataType;
93  using DualDataType = typename QEType::DualDataType;
94  using QEDual = typename QEType::DualType;
95 
96 public:
98  itkOverrideGetNameOfClassMacro(QuadEdgeMeshLineCell);
99 
100  // accessor to the new QEGeom link that replaces now inheritance.
101  QEType *
102  GetQEGeom() const
103  {
104  return (m_QuadEdgeGeom);
105  }
106 
107 public:
110  ~QuadEdgeMeshLineCell() override;
114  void
115  SetIdent(CellIdentifier cid);
116 
117  CellIdentifier
118  GetIdent();
119 
121  void
122  Accept(CellIdentifier cellId, MultiVisitor * mv) override;
123 
125  GetType() const override;
126 
128  static constexpr CellGeometryEnum
130  {
132  }
133 
134  unsigned int
135  GetDimension() const override;
136 
137  unsigned int
138  GetNumberOfPoints() const override;
139 
140  CellFeatureCount
141  GetNumberOfBoundaryFeatures(int dimension) const override;
142 
143  bool
144  GetBoundaryFeature(int dimension, CellFeatureIdentifier cellId, CellAutoPointer & cell) override;
145 
147  void
148  MakeCopy(CellAutoPointer & cell) const override
149  {
150  cell.TakeOwnership(new Self);
151  cell->SetPointId(0, this->GetQEGeom()->GetOrigin());
152  cell->SetPointId(1, this->GetQEGeom()->GetDestination());
153  }
160  void
161  SetPointIds(PointIdConstIterator first) override;
162 
163  void
164  SetPointIds(PointIdConstIterator first, PointIdConstIterator last) override;
165 
166  void
167  SetPointId(int localId, PointIdentifier pId) override;
168 
169  PointIdIterator
170  PointIdsBegin() override
171  {
172  SynchronizePointsAPI();
173  return &m_PointIds[0];
174  }
175 
176  PointIdIterator
177  PointIdsEnd() override
178  {
179  SynchronizePointsAPI();
180  return (&m_PointIds[1] + 1);
181  }
182 
183  PointIdConstIterator
184  GetPointIds() const override
185  {
186  SynchronizePointsAPI();
187  return &m_PointIds[0];
188  }
189 
190  PointIdConstIterator
191  PointIdsBegin() const override
192  {
193  SynchronizePointsAPI();
194  return &m_PointIds[0];
195  }
196 
197  PointIdConstIterator
198  PointIdsEnd() const override
199  {
200  SynchronizePointsAPI();
201  return (&m_PointIds[1] + 1);
202  }
203 
205  void
207  {
208  m_PointIds[0] = GetQEGeom()->GetOrigin();
209  m_PointIds[1] = GetQEGeom()->GetDestination();
210  }
214  virtual void
215  InternalSetPointIds(PointIdInternalConstIterator first);
216 
217  virtual void
218  InternalSetPointIds(PointIdInternalConstIterator first, PointIdInternalConstIterator last);
219 
220  virtual PointIdInternalIterator
221  InternalPointIdsBegin();
222 
223  virtual PointIdInternalIterator
224  InternalPointIdsEnd();
225 
226  virtual PointIdInternalConstIterator
227  InternalGetPointIds() const;
228 
229  virtual PointIdInternalConstIterator
230  InternalPointIdsBegin() const;
231 
232  virtual PointIdInternalConstIterator
233  InternalPointIdsEnd() const;
234 
235 private:
240  CellIdentifier m_Identifier{};
241  QEType * m_QuadEdgeGeom{};
242  mutable PointIdentifier m_PointIds[2]{};
243 };
244 } // end namespace itk
245 
246 #ifndef ITK_MANUAL_INSTANTIATION
247 # include "itkQuadEdgeMeshLineCell.hxx"
248 #endif
249 
250 #endif
itk::CommonEnums::CellGeometry::LINE_CELL
itk::AutoPointer
Implements an Automatic Pointer to an object.
Definition: itkAutoPointer.h:46
itk::QuadEdgeMeshLineCell::PointIdIterator
typename CellTraits::PointIdIterator PointIdIterator
Definition: itkQuadEdgeMeshLineCell.h:83
itkAutoPointer.h
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itkGeometricalQuadEdge.h
itk::QuadEdgeMeshLineCell::GetQEGeom
QEType * GetQEGeom() const
Definition: itkQuadEdgeMeshLineCell.h:102
itk::QuadEdgeMeshLineCell::PointIdsBegin
PointIdConstIterator PointIdsBegin() const override
Definition: itkQuadEdgeMeshLineCell.h:191
itk::QuadEdgeMeshLineCell::SynchronizePointsAPI
void SynchronizePointsAPI() const
Definition: itkQuadEdgeMeshLineCell.h:206
itk::CommonEnums::CellGeometry
CellGeometry
Definition: itkCommonEnums.h:132
itk::QuadEdgeMeshLineCell::PrimalDataType
typename QEType::PrimalDataType PrimalDataType
Definition: itkQuadEdgeMeshLineCell.h:92
itk::QuadEdgeMeshLineCell::PointIdConstIterator
typename CellTraits::PointIdConstIterator PointIdConstIterator
Definition: itkQuadEdgeMeshLineCell.h:84
itk::QuadEdgeMeshLineCell::MakeCopy
void MakeCopy(CellAutoPointer &cell) const override
Definition: itkQuadEdgeMeshLineCell.h:148
itkMesh.h
itk::QuadEdgeMeshLineCell
Class that connects the QuadEdgeMesh with the Mesh.
Definition: itkQuadEdgeMeshLineCell.h:41
itk::QuadEdgeMeshLineCell::PointIdsEnd
PointIdConstIterator PointIdsEnd() const override
Definition: itkQuadEdgeMeshLineCell.h:198
itk::QuadEdgeMeshLineCell::QEDual
typename QEType::DualType QEDual
Definition: itkQuadEdgeMeshLineCell.h:94
itk::QuadEdgeMeshLineCell::GetPointIds
PointIdConstIterator GetPointIds() const override
Definition: itkQuadEdgeMeshLineCell.h:184
itk::QuadEdgeMeshLineCell::PointIdInternalConstIterator
typename CellTraits::PointIdInternalConstIterator PointIdInternalConstIterator
Definition: itkQuadEdgeMeshLineCell.h:86
itk::QuadEdgeMeshLineCell::GetTopologyId
static constexpr CellGeometryEnum GetTopologyId()
Definition: itkQuadEdgeMeshLineCell.h:129
itk::QuadEdgeMeshLineCell::CellFeatureCount
typename Superclass::CellFeatureIdentifier CellFeatureCount
Definition: itkQuadEdgeMeshLineCell.h:70
itk::QuadEdgeMeshLineCell::CellType
typename Superclass::CellType CellType
Definition: itkQuadEdgeMeshLineCell.h:59
itk::QuadEdgeMeshLineCell::Superclass
TCellInterface Superclass
Definition: itkQuadEdgeMeshLineCell.h:57
itk::QuadEdgeMeshLineCell::MultiVisitor
typename CellType::MultiVisitor MultiVisitor
Definition: itkQuadEdgeMeshLineCell.h:80
itk::QuadEdgeMeshLineCell::VertexRefType
typename QEType::OriginRefType VertexRefType
Definition: itkQuadEdgeMeshLineCell.h:90
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itkCommonEnums.h
itk::QuadEdgeMeshLineCell::FaceRefType
typename QEType::DualOriginRefType FaceRefType
Definition: itkQuadEdgeMeshLineCell.h:91
itk::QuadEdgeMeshLineCell::PointIdsEnd
PointIdIterator PointIdsEnd() override
Definition: itkQuadEdgeMeshLineCell.h:177
itk::QuadEdgeMeshLineCell::DualDataType
typename QEType::DualDataType DualDataType
Definition: itkQuadEdgeMeshLineCell.h:93
itk::QuadEdgeMeshLineCell::PointIdsBegin
PointIdIterator PointIdsBegin() override
Definition: itkQuadEdgeMeshLineCell.h:170
itk::QuadEdgeMeshLineCell::CellTraits
typename Superclass::CellTraits CellTraits
Definition: itkQuadEdgeMeshLineCell.h:64
itk::QuadEdgeMeshLineCell::PointIdInternalIterator
typename CellTraits::PointIdInternalIterator PointIdInternalIterator
Definition: itkQuadEdgeMeshLineCell.h:85
itk::QuadEdgeMeshLineCell::QEType
typename CellTraits::QuadEdgeType QEType
Definition: itkQuadEdgeMeshLineCell.h:89