ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkWasmMesh.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 itkWasmMesh_h
19#define itkWasmMesh_h
20
21#include "itkWasmDataObject.h"
22#include "itkVectorContainer.h"
23#include "itkQuadEdgeMesh.h"
24
25namespace itk
26{
43template <typename TMesh>
44class ITK_TEMPLATE_EXPORT WasmMesh : public WasmDataObject
45{
46public:
47 ITK_DISALLOW_COPY_AND_MOVE(WasmMesh);
48
50 using Self = WasmMesh;
54
55 itkNewMacro(Self);
57 itkOverrideGetNameOfClassMacro(WasmMesh);
58
59 using MeshType = TMesh;
60
61 using PointIdentifier = typename MeshType::PointIdentifier;
62 using CellIdentifier = typename MeshType::CellIdentifier;
63 using CellBufferType = typename MeshType::CellsVectorContainer;
64
65 void
66 SetMesh(const MeshType * mesh);
67
68 const MeshType *
69 GetMesh() const
70 {
71 return static_cast<const MeshType *>(this->GetDataObject());
72 }
73
74 const CellBufferType *
76 {
77 return this->m_CellBuffer.GetPointer();
78 }
79
80protected:
81 WasmMesh() { this->m_CellBuffer = CellBufferType::New(); }
82 ~WasmMesh() override = default;
83
84 typename CellBufferType::Pointer m_CellBuffer;
85};
86
87template <typename TPixel, unsigned int VDimension>
88class WasmMesh<QuadEdgeMesh<TPixel, VDimension>> : public WasmDataObject
89{
90public:
91 ITK_DISALLOW_COPY_AND_MOVE(WasmMesh);
92
94 using Self = WasmMesh;
98
99 itkNewMacro(Self);
102
104
107
108 using PointsBufferType = std::vector<PointIdentifier>;
110
111 using PointDataBufferType = std::vector<typename MeshType::PointDataContainer::Element>;
112 using CellDataBufferType = std::vector<typename MeshType::CellDataContainer::Element>;
113
114 void
115 SetMesh(const MeshType * mesh);
116
117 const MeshType *
118 GetMesh() const
119 {
120 return static_cast<const MeshType *>(this->GetDataObject());
121 }
122
123 const PointsBufferType &
125 {
126 return this->m_PointsBuffer;
127 }
128
129 const CellBufferType *
131 {
132 return this->m_CellBuffer.GetPointer();
133 }
134
135 const PointDataBufferType &
137 {
138 return this->m_PointDataBuffer;
139 }
140
141 const CellDataBufferType &
143 {
144 return this->m_CellDataBuffer;
145 }
146
147 WasmMesh() { this->m_CellBuffer = CellBufferType::New(); }
148 ~WasmMesh() override = default;
149
151 typename CellBufferType::Pointer m_CellBuffer;
154};
155
156
157} // namespace itk
158
159#ifndef ITK_MANUAL_INSTANTIATION
160# include "itkWasmMesh.hxx"
161#endif
162
163#endif
typename MeshTraits::CellIdentifier CellIdentifier
Definition itkMesh.h:178
itk::VectorContainer< IdentifierType > CellsVectorContainer
Definition itkMesh.h:191
typename MeshTraits::PointIdentifier PointIdentifier
Mesh class for 2D manifolds embedded in ND space.
Implements transparent reference counting.
virtual const DataObject * GetDataObject() const
WasmDataObject()=default
const PointsBufferType & GetPointsBuffer() const
const PointDataBufferType & GetPointDataBuffer() const
std::vector< typename MeshType::PointDataContainer::Element > PointDataBufferType
typename MeshType::CellsVectorContainer CellBufferType
typename MeshType::CellIdentifier CellIdentifier
const CellDataBufferType & GetCellDataBuffer() const
std::vector< typename MeshType::CellDataContainer::Element > CellDataBufferType
std::vector< PointIdentifier > PointsBufferType
QuadEdgeMesh< TPixel, VDimension > MeshType
typename MeshType::PointIdentifier PointIdentifier
WasmDataObject Superclass
Definition itkWasmMesh.h:51
const MeshType * GetMesh() const
Definition itkWasmMesh.h:69
const CellBufferType * GetCellBuffer() const
Definition itkWasmMesh.h:75
CellBufferType::Pointer m_CellBuffer
Definition itkWasmMesh.h:84
SmartPointer< Self > Pointer
Definition itkWasmMesh.h:52
SmartPointer< const Self > ConstPointer
Definition itkWasmMesh.h:53
~WasmMesh() override=default
typename MeshType::PointIdentifier PointIdentifier
Definition itkWasmMesh.h:61
void SetMesh(const MeshType *mesh)
typename MeshType::CellsVectorContainer CellBufferType
Definition itkWasmMesh.h:63
typename MeshType::CellIdentifier CellIdentifier
Definition itkWasmMesh.h:62
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....