ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkQuadEdgeMeshLineCell.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 itkQuadEdgeMeshLineCell_h
19 #define itkQuadEdgeMeshLineCell_h
20 
21 #include "itkAutoPointer.h"
22 #include "itkGeometricalQuadEdge.h"
23 
24 namespace itk
25 {
38 template< typename TCellInterface >
39 class ITK_TEMPLATE_EXPORT QuadEdgeMeshLineCell:
40  public TCellInterface, public TCellInterface::CellTraits::QuadEdgeType
41 {
42 public:
43  ITK_DISALLOW_COPY_AND_ASSIGN(QuadEdgeMeshLineCell);
44 
46  // itkCellCommonTypedefs
50  using RawPointer = Self *;
51  using ConstRawPointer = const Self *;
52 
53  // itkCellInheritedTypedefs
54  using Superclass = TCellInterface;
55  using PixelType = typename Superclass::PixelType;
56  using CellType = typename Superclass::CellType;
57  using CellAutoPointer = typename Superclass::CellAutoPointer;
58  using CellConstAutoPointer = typename Superclass::CellConstAutoPointer;
59  using CellRawPointer = typename Superclass::CellRawPointer;
60  using CellConstRawPointer = typename Superclass::CellConstRawPointer;
61  using CellTraits = typename Superclass::CellTraits;
62  using CoordRepType = typename Superclass::CoordRepType;
63  using InterpolationWeightType = typename Superclass::InterpolationWeightType;
64  using PointIdentifier = typename Superclass::PointIdentifier;
65  using CellIdentifier = typename Superclass::CellIdentifier;
66  using CellFeatureIdentifier = typename Superclass::CellFeatureIdentifier;
67  using CellFeatureCount = typename Superclass::CellFeatureIdentifier;
68  using PointType = typename Superclass::PointType;
69  using PointsContainer = typename Superclass::PointsContainer;
70  using UsingCellsContainer = typename Superclass::UsingCellsContainer;
71  using CellGeometry = typename Superclass::CellGeometry;
72  using ParametricCoordArrayType = typename Superclass::ParametricCoordArrayType;
73  using ShapeFunctionsArrayType = typename Superclass::ShapeFunctionsArrayType;
74  static constexpr unsigned int PointDimension = Superclass::PointDimension;
75  static constexpr unsigned int CellDimension = 2;
76 
78  using MultiVisitor = typename CellType::MultiVisitor;
79 
81  using PointIdIterator = typename CellTraits::PointIdIterator;
82  using PointIdConstIterator = typename CellTraits::PointIdConstIterator;
83  using PointIdInternalIterator = typename CellTraits::PointIdInternalIterator;
84  using PointIdInternalConstIterator = typename CellTraits::PointIdInternalConstIterator;
85 
87  using QEType = typename CellTraits::QuadEdgeType;
88  using VertexRefType = typename QEType::OriginRefType;
89  using FaceRefType = typename QEType::DualOriginRefType;
90  using PrimalDataType = typename QEType::PrimalDataType;
91  using DualDataType = typename QEType::DualDataType;
92  using QEDual = typename QEType::DualType;
93 
94 public:
96  itkTypeMacro(QuadEdgeMeshLineCell, TCellInterface);
97 
98  // accessor to the new QEGeom link that replaces now inheritance.
99  QEType * GetQEGeom() const { return ( m_QuadEdgeGeom ); }
100 
101 public:
104  ~QuadEdgeMeshLineCell() override;
106 
108  void SetIdent(CellIdentifier cid);
109 
110  CellIdentifier GetIdent();
111 
113  void Accept(CellIdentifier cellId, MultiVisitor *mv) override;
114 
115  CellGeometry GetType() const override;
116 
118  static int GetTopologyId();
119 
120  unsigned int GetDimension() const override;
121 
122  unsigned int GetNumberOfPoints() const override;
123 
124  CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const override;
125 
126  bool GetBoundaryFeature(int dimension,
127  CellFeatureIdentifier cellId,
128  CellAutoPointer & cell) override;
129 
131  void MakeCopy(CellAutoPointer & cell) const override
132  {
133  cell.TakeOwnership(new Self);
134  cell->SetPointId( 0, this->GetQEGeom()->GetOrigin() );
135  cell->SetPointId( 1, this->GetQEGeom()->GetDestination() );
136  }
138 
143  void SetPointIds(PointIdConstIterator first) override;
144 
145  void SetPointIds(PointIdConstIterator first,
146  PointIdConstIterator last) override;
147 
148  void SetPointId(int localId, PointIdentifier pId) override;
149 
151  {
152  SynchronizePointsAPI();
153  return &m_PointIds[0];
154  }
155 
157  {
158  SynchronizePointsAPI();
159  return ( &m_PointIds[1] + 1 );
160  }
161 
163  {
164  SynchronizePointsAPI();
165  return &m_PointIds[0];
166  }
167 
169  {
170  SynchronizePointsAPI();
171  return &m_PointIds[0];
172  }
173 
175  {
176  SynchronizePointsAPI();
177  return ( &m_PointIds[1] + 1 );
178  }
179 
181  void SynchronizePointsAPI() const
182  {
183  m_PointIds[0] = GetQEGeom()->GetOrigin();
184  m_PointIds[1] = GetQEGeom()->GetDestination();
185  }
187 
189  virtual void InternalSetPointIds(PointIdInternalConstIterator first);
190 
191  virtual void InternalSetPointIds(
192  PointIdInternalConstIterator first,
193  PointIdInternalConstIterator last);
194 
195  virtual PointIdInternalIterator InternalPointIdsBegin();
196 
197  virtual PointIdInternalIterator InternalPointIdsEnd();
198 
199  virtual PointIdInternalConstIterator InternalGetPointIds() const;
200 
201  virtual PointIdInternalConstIterator InternalPointIdsBegin() const;
202 
203  virtual PointIdInternalConstIterator InternalPointIdsEnd() const;
204 
205 private:
212  mutable PointIdentifier m_PointIds[2];
213 };
214 } // end namespace itk
215 
216 #ifndef ITK_MANUAL_INSTANTIATION
217 #include "itkQuadEdgeMeshLineCell.hxx"
218 #endif
219 
220 #endif
typename QEType::PrimalDataType PrimalDataType
typename Superclass::PointIdentifier PointIdentifier
typename CellTraits::QuadEdgeType QEType
typename Superclass::UsingCellsContainer UsingCellsContainer
typename QEType::OriginRefType VertexRefType
typename Superclass::CellConstAutoPointer CellConstAutoPointer
typename Superclass::CellType CellType
typename Superclass::ParametricCoordArrayType ParametricCoordArrayType
typename CellTraits::PointIdIterator PointIdIterator
typename Superclass::PointType PointType
typename CellTraits::PointIdConstIterator PointIdConstIterator
typename CellTraits::PointIdInternalConstIterator PointIdInternalConstIterator
PointIdConstIterator PointIdsEnd() const override
typename QEType::DualType QEDual
typename Superclass::CellFeatureIdentifier CellFeatureIdentifier
PointIdIterator PointIdsBegin() override
typename Superclass::CoordRepType CoordRepType
typename Superclass::CellRawPointer CellRawPointer
typename Superclass::InterpolationWeightType InterpolationWeightType
typename CellType::MultiVisitor MultiVisitor
void MakeCopy(CellAutoPointer &cell) const override
typename CellTraits::PointIdInternalIterator PointIdInternalIterator
typename Superclass::CellTraits CellTraits
PointIdConstIterator PointIdsBegin() const override
typename QEType::DualOriginRefType FaceRefType
Implements an Automatic Pointer to an object.
typename Superclass::CellConstRawPointer CellConstRawPointer
typename Superclass::CellIdentifier CellIdentifier
typename Superclass::PointsContainer PointsContainer
PointIdConstIterator GetPointIds() const override
typename Superclass::CellFeatureIdentifier CellFeatureCount
typename Superclass::CellGeometry CellGeometry
typename Superclass::CellAutoPointer CellAutoPointer
typename Superclass::ShapeFunctionsArrayType ShapeFunctionsArrayType
Class that connects the QuadEdgeMesh with the Mesh.
typename QEType::DualDataType DualDataType
PointIdIterator PointIdsEnd() override
typename Superclass::PixelType PixelType