ITK  4.4.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< class TCellInterface >
39 class ITK_EXPORT QuadEdgeMeshLineCell:
40  public TCellInterface, public TCellInterface::CellTraits::QuadEdgeType
41 {
42 public:
43 
45  // itkCellCommonTypedefs
49  typedef Self * RawPointer;
50  typedef const Self * ConstRawPointer;
51 
52  // itkCellInheritedTypedefs
53  typedef TCellInterface Superclass;
54  typedef typename Superclass::PixelType PixelType;
55  typedef typename Superclass::CellType CellType;
56  typedef typename Superclass::CellAutoPointer CellAutoPointer;
57  typedef typename Superclass::CellConstAutoPointer CellConstAutoPointer;
58  typedef typename Superclass::CellRawPointer CellRawPointer;
59  typedef typename Superclass::CellConstRawPointer CellConstRawPointer;
60  typedef typename Superclass::CellTraits CellTraits;
61  typedef typename Superclass::CoordRepType CoordRepType;
62  typedef typename Superclass::InterpolationWeightType InterpolationWeightType;
63  typedef typename Superclass::PointIdentifier PointIdentifier;
64  typedef typename Superclass::CellIdentifier CellIdentifier;
65  typedef typename Superclass::CellFeatureIdentifier CellFeatureIdentifier;
66  typedef typename Superclass::CellFeatureIdentifier CellFeatureCount;
67  typedef typename Superclass::PointType PointType;
68  typedef typename Superclass::PointsContainer PointsContainer;
69  typedef typename Superclass::UsingCellsContainer UsingCellsContainer;
70  typedef typename Superclass::CellGeometry CellGeometry;
71  typedef typename Superclass::ParametricCoordArrayType ParametricCoordArrayType;
72  typedef typename Superclass::ShapeFunctionsArrayType ShapeFunctionsArrayType;
73  itkStaticConstMacro(PointDimension, unsigned int, Superclass::PointDimension);
74  itkStaticConstMacro(CellDimension, unsigned int, 2);
75 
77  typedef typename CellType::MultiVisitor MultiVisitor;
78 
80  typedef typename CellTraits::PointIdIterator PointIdIterator;
81  typedef typename CellTraits::PointIdConstIterator PointIdConstIterator;
82  typedef typename CellTraits::PointIdInternalIterator PointIdInternalIterator;
83  typedef typename CellTraits::PointIdInternalConstIterator PointIdInternalConstIterator;
84 
86  typedef typename CellTraits::QuadEdgeType QEType;
87  typedef typename QEType::OriginRefType VertexRefType;
88  typedef typename QEType::DualOriginRefType FaceRefType;
89  typedef typename QEType::PrimalDataType PrimalDataType;
90  typedef typename QEType::DualDataType DualDataType;
91  typedef typename QEType::DualType QEDual;
92 
93 public:
95  itkTypeMacro(QuadEdgeMeshLineCell, TCellInterface);
96 
97  // accessor to the new QEGeom link that replaces now inheritance.
98  QEType * GetQEGeom() const { return ( m_QuadEdgeGeom ); }
99 
100 public:
103  virtual ~QuadEdgeMeshLineCell();
105 
107  void SetIdent(CellIdentifier cid);
108 
109  CellIdentifier GetIdent();
110 
112  virtual void Accept(CellIdentifier cellId, MultiVisitor *mv);
113 
114  virtual CellGeometry GetType() const;
115 
117  static int GetTopologyId();
118 
119  virtual unsigned int GetDimension() const;
120 
121  virtual unsigned int GetNumberOfPoints() const;
122 
123  virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const;
124 
125  virtual bool GetBoundaryFeature(int dimension,
126  CellFeatureIdentifier cellId,
127  CellAutoPointer & cell);
128 
130  virtual void MakeCopy(CellAutoPointer & cell) const
131  {
132  cell.TakeOwnership(new Self);
133  cell->SetPointId( 0, this->GetQEGeom()->GetOrigin() );
134  cell->SetPointId( 1, this->GetQEGeom()->GetDestination() );
135  }
137 
142  virtual void SetPointIds(PointIdConstIterator first);
143 
144  virtual void SetPointIds(PointIdConstIterator first,
145  PointIdConstIterator last);
146 
147  virtual void SetPointId(int localId, PointIdentifier pId);
148 
149  virtual PointIdIterator PointIdsBegin()
150  {
151  SynchronizePointsAPI();
152  return &m_PointIds[0];
153  }
154 
155  virtual PointIdIterator PointIdsEnd()
156  {
157  SynchronizePointsAPI();
158  return ( &m_PointIds[1] + 1 );
159  }
160 
161  virtual PointIdConstIterator GetPointIds() const
162  {
163  SynchronizePointsAPI();
164  return &m_PointIds[0];
165  }
166 
167  virtual PointIdConstIterator PointIdsBegin() const
168  {
169  SynchronizePointsAPI();
170  return &m_PointIds[0];
171  }
172 
173  virtual PointIdConstIterator PointIdsEnd() const
174  {
175  SynchronizePointsAPI();
176  return ( &m_PointIds[1] + 1 );
177  }
178 
180  void SynchronizePointsAPI() const
181  {
182  m_PointIds[0] = GetQEGeom()->GetOrigin();
183  m_PointIds[1] = GetQEGeom()->GetDestination();
184  }
186 
188  virtual void InternalSetPointIds(PointIdInternalConstIterator first);
189 
190  virtual void InternalSetPointIds(
191  PointIdInternalConstIterator first,
192  PointIdInternalConstIterator last);
193 
194  virtual PointIdInternalIterator InternalPointIdsBegin();
195 
196  virtual PointIdInternalIterator InternalPointIdsEnd();
197 
198  virtual PointIdInternalConstIterator InternalGetPointIds() const;
199 
200  virtual PointIdInternalConstIterator InternalPointIdsBegin() const;
201 
202  virtual PointIdInternalConstIterator InternalPointIdsEnd() const;
203 
204 private:
205  QuadEdgeMeshLineCell(const Self &); //purposely not implemented
206  void operator=(const Self &); //purposely not implemented
207 
214  mutable PointIdentifier m_PointIds[2];
215 };
216 } // end namespace itk
217 
218 #ifndef ITK_MANUAL_INSTANTIATION
219 #include "itkQuadEdgeMeshLineCell.hxx"
220 #endif
221 
222 #endif
223