ITK  4.8.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  typedef typename MeshType::PointType PointType; \
53  typedef typename MeshType::PointIdentifier PointIdentifier; \
54  typedef typename MeshType::PointsContainer PointsContainer; \
55  typedef typename MeshType::PointsContainerIterator \
56  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  typedef typename MeshType::CellsContainer CellsContainer; \
110  typedef typename MeshType::CellsContainerIterator \
111  CellsContainerIterator; \
112  /* If no cells are present, do nothing */ \
113  if ( !MeshInstance->GetCells() ) \
114  { \
115  itkWarningMacro("No Cells container in itkQEMeshForAllCellsMacro"); \
116  } \
117  else \
118  { \
119  CellsContainerIterator cellIterator = MeshInstance->GetCells()->Begin(); \
120  while ( cellIterator != MeshInstance->GetCells()->End() ) \
121  { \
122  /* Users code comes here: */
123 
130 #define itkQEMeshForAllCellsEndMacro(cellIterator) \
131  cellIterator++; \
132  } /* while */ \
133  } /* if */ \
134  }
135 
137 
153 #define itkQEMeshForAllPrimalEdgesMacro(MeshType, \
154  MeshInstance, \
155  EdgeVariable) \
156  { \
157  typedef typename MeshType::QEPrimal QEPrimal; \
158  \
159  itkQEMeshForAllCellsMacro(MeshType, MeshInstance, cellIterator) \
160  { \
161  if ( QEPrimal * EdgeVariable = \
162  dynamic_cast< QEPrimal * >( cellIterator.Value() ) ) \
163  { \
164  /* Users code comes here: */
165 
172 #define itkQEMeshForAllPrimalEdgesEndMacro \
173  } /* fi */ \
174  } \
175  itkQEMeshForAllCellsEndMacro \
176  }
177 } // end namespace
178 
179 #endif