ITK  5.2.0
Insight Toolkit
itkQuadEdgeMeshMacro.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  * 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 itkQuadEdgeMeshMacro_h
19 #define itkQuadEdgeMeshMacro_h
20 
21 namespace itk
22 {
24 
47 #define itkQEMeshForAllPointsMacro(MeshType, MeshInstance, PointVariable, PointIndex) \
48  { \
49  using PointType = typename MeshType::PointType; \
50  using PointIdentifier = typename MeshType::PointIdentifier; \
51  using PointsContainer = typename MeshType::PointsContainer; \
52  using PointsContainerIterator = typename MeshType::PointsContainerIterator; \
53  \
54  PointsContainer * points = (MeshInstance)->GetPoints(); \
55  /* If no points container are present, do nothing */ \
56  if (!points) \
57  { \
58  itkWarningMacro("No point container in itkQEMeshForAllPointsMacro"); \
59  } \
60  else \
61  { \
62  PointsContainerIterator pointIterator = points->Begin(); \
63  while (pointIterator != points->End()) \
64  { \
65  PointType PointVariable = pointIterator.Value(); \
66  PointIdentifier PointIndex = pointIterator.Index();
67 
68 
75 #define itkQEMeshForAllPointsEndMacro \
76  pointIterator++; \
77  } /* while */ \
78  } /* if */ \
79  }
80 
82 
101 #define itkQEMeshForAllCellsMacro(MeshType, MeshInstance, cellIterator) \
102  { \
103  using CellsContainer = typename MeshType::CellsContainer; \
104  using CellsContainerIterator = typename MeshType::CellsContainerIterator; \
105  /* If no cells are present, do nothing */ \
106  if (!MeshInstance->GetCells()) \
107  { \
108  itkWarningMacro("No Cells container in itkQEMeshForAllCellsMacro"); \
109  } \
110  else \
111  { \
112  CellsContainerIterator cellIterator = MeshInstance->GetCells()->Begin(); \
113  while (cellIterator != MeshInstance->GetCells()->End()) \
114  { \
115  /* Users code comes here: */
116 
123 #define itkQEMeshForAllCellsEndMacro(cellIterator) \
124  cellIterator++; \
125  } /* while */ \
126  } /* if */ \
127  }
128 
130 
146 #define itkQEMeshForAllPrimalEdgesMacro(MeshType, MeshInstance, EdgeVariable) \
147  { \
148  using QEPrimal = typename MeshType::QEPrimal; \
149  \
150  itkQEMeshForAllCellsMacro(MeshType, MeshInstance, cellIterator) \
151  { \
152  if (QEPrimal * EdgeVariable = dynamic_cast<QEPrimal *>(cellIterator.Value())) \
153  { \
154  /* Users code comes here: */
155 
162 #define itkQEMeshForAllPrimalEdgesEndMacro \
163  } /* fi */ \
164  } \
165  itkQEMeshForAllCellsEndMacro \
166  }
167 } // namespace itk
168 
169 #endif
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24