Orfeo Toolbox
3.16
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
OTB
Utilities
ITK
Code
Review
itkQuadEdgeMeshFrontIterator.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Insight Segmentation & Registration Toolkit
4
Module: $RCSfile: itkQuadEdgeMeshFrontIterator.h,v $
5
Language: C++
6
Date: $Date: 2010-06-14 15:02:34 $
7
Version: $Revision: 1.10 $
8
9
Copyright (c) Insight Software Consortium. All rights reserved.
10
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12
This software is distributed WITHOUT ANY WARRANTY; without even
13
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14
PURPOSE. See the above copyright notices for more information.
15
16
=========================================================================*/
17
#ifndef __itkQuadEdgeMeshFrontIterator_h
18
#define __itkQuadEdgeMeshFrontIterator_h
19
20
// -------------------------------------------------------------------------
21
#define itkQEDefineFrontIteratorMethodsMacro( MeshTypeArg ) \
22
/* Dual definition placed before others because of .NET that cannot */
\
23
/* cope with definition of FrontIterator (that further hides the */
\
24
/* defintion of the template). */
\
25
typedef typename MeshTypeArg::QEDual QEDualType; \
26
typedef typename MeshTypeArg::QEPrimal QEPrimalType; \
27
typedef QuadEdgeMeshFrontIterator< MeshTypeArg, \
28
QEDualType > FrontDualIterator; \
29
typedef QuadEdgeMeshConstFrontIterator< MeshTypeArg, \
30
QEDualType > \
31
ConstFrontDualIterator; \
32
typedef QuadEdgeMeshFrontIterator< MeshTypeArg, \
33
QEPrimalType > FrontIterator; \
34
typedef QuadEdgeMeshConstFrontIterator< MeshTypeArg, \
35
QEPrimalType > \
36
ConstFrontIterator; \
37
\
38
virtual FrontIterator BeginFront( QEPrimalType* seed =(QEPrimalType*)0 ) \
39
{ return( FrontIterator( this, true, seed ) ); } \
40
\
41
virtual ConstFrontIterator BeginFront( QEPrimalType* seed ) const \
42
{ return( ConstFrontIterator( this, true, seed ) ); } \
43
\
44
virtual FrontIterator EndFront( ) \
45
{ return( FrontIterator( this, false ) ); } \
46
\
47
virtual ConstFrontIterator EndFront( ) const \
48
{ return( ConstFrontIterator( this, false ) ); } \
49
\
50
virtual FrontDualIterator BeginDualFront( QEDualType* seed =(QEDualType*) 0 ) \
51
{ return( FrontDualIterator( this, true, seed ) ); } \
52
\
53
virtual ConstFrontDualIterator BeginDualFront( QEDualType* seed ) const \
54
{ return( ConstFrontDualIterator( this, true, seed ) ); } \
55
\
56
virtual FrontDualIterator EndDualFront( ) \
57
{ return( FrontDualIterator( this, false ) ); } \
58
\
59
virtual ConstFrontDualIterator EndDualFront( ) const \
60
{ return( ConstFrontDualIterator( this, false ) ); }
61
62
namespace
itk
63
{
64
77
template
<
typename
TMesh,
typename
TQE >
78
class
QuadEdgeMeshFrontBaseIterator
79
{
80
public
:
81
// Hierarchy typedefs & values.
82
typedef
QuadEdgeMeshFrontBaseIterator
Self
;
83
84
// Template types
85
typedef
TMesh
MeshType
;
86
typedef
TQE
QEType
;
87
88
protected
:
89
// Mesh types
90
typedef
typename
MeshType::CoordRepType
CoordRepType
;
91
// QE types
92
typedef
typename
QEType::OriginRefType
QEOriginType
;
93
102
class
FrontAtom
103
{
104
public
:
105
FrontAtom
(
QEType
* e = (
QEType
*)0,
const
CoordRepType
c = 0 )
106
:
m_Edge
( e ),
m_Cost
( c )
107
{ }
108
virtual
~FrontAtom
( ) { }
109
FrontAtom
&
operator=
(
const
FrontAtom
& r )
110
{
m_Edge
= r.
m_Edge
;
m_Cost
= r.
m_Cost
;
return
*
this
; }
111
bool
operator==
(
const
FrontAtom
& r )
const
112
{
return
(
m_Edge
== r.
m_Edge
); }
113
bool
operator!=
(
const
FrontAtom
& r )
const
114
{
return
(
m_Edge
!= r.
m_Edge
); }
115
bool
operator<
(
const
FrontAtom
& r )
const
116
{
return
(
m_Cost
< r.
m_Cost
); }
117
118
public
:
119
QEType
*
m_Edge
;
120
CoordRepType
m_Cost
;
121
};
122
126
typedef
std::list< FrontAtom >
FrontType
;
127
typedef
typename
FrontType::iterator
FrontTypeIterator
;
128
typedef
FrontType
*
FrontTypePointer
;
129
133
typedef
MapContainer< QEOriginType, bool >
IsVisitedContainerType
;
134
typedef
typename
IsVisitedContainerType::Pointer
IsVisitedPointerType
;
135
136
public
:
138
QuadEdgeMeshFrontBaseIterator
(
MeshType
* mesh = (
MeshType
*)0,
139
bool
start =
true
,
140
QEType
* seed = (
QEType
*)0 );
141
virtual
~QuadEdgeMeshFrontBaseIterator
( );
142
143
Self
&
operator=
(
const
Self
& r )
144
{
145
m_Mesh
= r.
m_Mesh
;
146
m_Start
= r.
m_Start
;
147
m_Seed
= r.
m_Seed
;
148
m_Front
= r.
m_Front
;
149
m_IsPointVisited
= r.
m_IsPointVisited
;
150
m_CurrentEdge
= r.
m_CurrentEdge
;
151
return
( *
this
);
152
}
153
154
// Iteration methods.
155
bool
operator==
(
Self
& r )
156
{
157
return
(
m_Start
== r.
m_Start
);
158
}
159
160
bool
operator==
(
const
Self
& r )
const
161
{
162
return
(
m_Start
== r.
m_Start
);
163
}
164
165
bool
operator!=
(
Self
& r )
166
{
167
return
( !( this->
operator
==( r ) ) );
168
}
169
170
bool
operator!=
(
const
Self
& r )
const
171
{
172
return
( !( this->
operator
==( r ) ) );
173
}
174
175
Self
&
operator++
( );
176
177
Self
&
operator++
(
int
) {
return
( this->
operator
++( ) ); }
178
179
MeshType
*
GetMesh
()
const
{
return
this->
m_Mesh
; }
180
181
protected
:
185
QEType
*
FindDefaultSeed
( );
186
190
virtual
CoordRepType
GetCost
(
QEType
* edge ){ (void)edge;
return
( 1 ); }
191
192
protected
:
194
MeshType
*
m_Mesh
;
196
QEType
*
m_Seed
;
198
bool
m_Start
;
200
FrontTypePointer
m_Front
;
202
IsVisitedPointerType
m_IsPointVisited
;
204
QEType
*
m_CurrentEdge
;
205
};
206
212
template
<
typename
TMesh,
typename
TQE >
213
class
QuadEdgeMeshFrontIterator
214
:
public
QuadEdgeMeshFrontBaseIterator
< TMesh, TQE >
215
{
216
public
:
218
typedef
QuadEdgeMeshFrontIterator
Self
;
219
typedef
QuadEdgeMeshFrontBaseIterator< TMesh, TQE >
Superclass
;
220
typedef
typename
Superclass::MeshType
MeshType
;
221
typedef
typename
Superclass::QEType
QEType
;
222
223
public
:
225
QuadEdgeMeshFrontIterator
(
MeshType
* mesh = (
MeshType
*)0,
226
bool
start =
true
,
227
QEType
* seed = (
QEType
*)0 )
228
:
Superclass
( mesh, start, seed ) { }
229
virtual
~QuadEdgeMeshFrontIterator
( ) { }
230
QEType
*
Value
( ) {
return
( this->
m_CurrentEdge
); }
231
};
232
238
template
<
class
TMesh,
class
TQE =
typename
TMesh::QEType >
239
class
QuadEdgeMeshConstFrontIterator
240
:
public
QuadEdgeMeshFrontBaseIterator
< TMesh, TQE >
241
{
242
public
:
244
typedef
QuadEdgeMeshConstFrontIterator
Self
;
245
typedef
QuadEdgeMeshFrontBaseIterator< TMesh, TQE >
Superclass
;
246
typedef
typename
Superclass::QEType
QEType
;
247
typedef
typename
Superclass::MeshType
MeshType
;
248
typedef
QuadEdgeMeshFrontIterator< MeshType, QEType >
NoConstType
;
249
250
public
:
252
QuadEdgeMeshConstFrontIterator
(
const
MeshType
* mesh = (
MeshType
*)0,
253
bool
start =
true
,
254
QEType
* seed = (
QEType
*)0 )
255
{
256
(void)mesh;
257
(void)start;
258
(void)seed;
259
}
261
virtual
~QuadEdgeMeshConstFrontIterator
( ) { }
262
Self
&
operator=
(
const
NoConstType
& r )
263
{
264
this->
m_Mesh
= r.
GetMesh
( );
265
return
( *
this
);
266
}
267
const
QEType
*
Value
( )
const
{
return
( this->
m_CurrentEdge
); }
268
};
269
270
}
271
272
#include "
itkQuadEdgeMeshFrontIterator.txx
"
273
274
#endif
Generated at Sun May 19 2013 00:01:27 for
Orfeo Toolbox
with
doxygen 1.8.3.1