ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkQuadEdgeMeshMacro.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 itkQuadEdgeMeshMacro_h
19 #define itkQuadEdgeMeshMacro_h
20 
21 namespace itk
22 {
24 
47 #define itkQEMeshForAllPointsMacro(MeshType, \
48  MeshInstance, \
49  PointVariable, \
50  PointIndex) \
51  { \
52  using PointType = typename MeshType::PointType; \
53  using PointIdentifier = typename MeshType::PointIdentifier; \
54  using PointsContainer = typename MeshType::PointsContainer; \
55  using PointsContainerIterator = \
56  typename MeshType::PointsContainerIterator; \
57  \
58  PointsContainer *points = ( MeshInstance )->GetPoints(); \
59  /* If no points container are present, do nothing */ \
60  if ( !points ) \
61  { \
62  itkWarningMacro("No point container in itkQEMeshForAllPointsMacro"); \
63  } \
64  else \
65  { \
66  PointsContainerIterator pointIterator = points->Begin(); \
67  while ( pointIterator != points->End() ) \
68  { \
69  PointType PointVariable = pointIterator.Value(); \
70  PointIdentifier PointIndex = pointIterator.Index();
71 
72 
79 #define itkQEMeshForAllPointsEndMacro \
80  pointIterator++; \
81  } /* while */ \
82  } /* if */ \
83  }
84 
86 
105 #define itkQEMeshForAllCellsMacro(MeshType, \
106  MeshInstance, \
107  cellIterator) \
108  { \
109  using CellsContainer = typename MeshType::CellsContainer; \
110  using CellsContainerIterator = typename MeshType::CellsContainerIterator; \
111  /* If no cells are present, do nothing */ \
112  if ( !MeshInstance->GetCells() ) \
113  { \
114  itkWarningMacro("No Cells container in itkQEMeshForAllCellsMacro"); \
115  } \
116  else \
117  { \
118  CellsContainerIterator cellIterator = MeshInstance->GetCells()->Begin(); \
119  while ( cellIterator != MeshInstance->GetCells()->End() ) \
120  { \
121  /* Users code comes here: */
122 
129 #define itkQEMeshForAllCellsEndMacro(cellIterator) \
130  cellIterator++; \
131  } /* while */ \
132  } /* if */ \
133  }
134 
136 
152 #define itkQEMeshForAllPrimalEdgesMacro(MeshType, \
153  MeshInstance, \
154  EdgeVariable) \
155  { \
156  using QEPrimal = typename MeshType::QEPrimal; \
157  \
158  itkQEMeshForAllCellsMacro(MeshType, MeshInstance, cellIterator) \
159  { \
160  if ( QEPrimal * EdgeVariable = \
161  dynamic_cast< QEPrimal * >( cellIterator.Value() ) ) \
162  { \
163  /* Users code comes here: */
164 
171 #define itkQEMeshForAllPrimalEdgesEndMacro \
172  } /* fi */ \
173  } \
174  itkQEMeshForAllCellsEndMacro \
175  }
176 } // end namespace
177 
178 #endif