DGtal
0.6.devel
Main Page
Related Pages
Modules
Namespaces
Data Structures
Examples
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
src
DGtal
topology
Object.h
1
17
#pragma once
18
31
#if defined(Object_RECURSES)
32
#error Recursive header files inclusion detected in Object.h
33
#else // defined(Object_RECURSES)
34
35
#define Object_RECURSES
36
37
#if !defined Object_h
38
39
#define Object_h
40
42
// Inclusions
43
#include <iostream>
44
#include <string>
45
#include <map>
46
#include "DGtal/base/Common.h"
47
#include "DGtal/base/CowPtr.h"
48
#include "DGtal/kernel/sets/CDigitalSet.h"
49
#include "DGtal/kernel/sets/DigitalSetSelector.h"
50
#include "DGtal/topology/Topology.h"
52
53
namespace
DGtal
54
{
55
57
// template class Object
87
template
<
typename
TDigitalTopology,
typename
TDigitalSet>
88
class
Object
89
{
90
// ----------------------- Standard services ------------------------------
91
public
:
92
typedef
TDigitalSet
DigitalSet
;
93
typedef
TDigitalTopology
DigitalTopology
;
94
typedef
typename
DigitalTopology::ReverseTopology
ReverseTopology
;
95
typedef
typename
DigitalSet::Size
Size
;
96
typedef
typename
DigitalSet::Point
Point
;
97
// should be the same as Point.
98
typedef
typename
DigitalTopology::Point
DTPoint
;
99
100
typedef
typename
DigitalSet::Domain
Domain
;
101
typedef
typename
Domain::Space
Space
;
102
typedef
103
typename
DigitalSetSelector
<
Domain
,
104
SMALL_DS
+
HIGH_ITER_DS
>::Type
SmallSet
;
105
typedef
typename
DigitalTopology::ForegroundAdjacency
ForegroundAdjacency
;
106
typedef
typename
DigitalTopology::BackgroundAdjacency
BackgroundAdjacency
;
107
typedef
Object<ReverseTopology, DigitalSet>
ComplementObject
;
108
typedef
Object<DigitalTopology, SmallSet>
SmallObject
;
109
typedef
Object<ReverseTopology, SmallSet>
SmallComplementObject
;
110
111
// Required by CUndirectedSimpleLocalGraph
112
typedef
TDigitalSet
VertexSet
;
113
typedef
typename
DigitalSet::Point
Vertex
;
114
template
<
typename
Value>
struct
VertexMap
{
115
typedef
typename
std::map<Vertex, Value>
Type
;
116
};
117
typedef
typename
DigitalSet::ConstIterator
ConstIterator
;
118
119
// Required by CUndirectedSimpleGraph
120
struct
Edge
121
{
122
Vertex
vertices
[2];
123
129
Edge
(
const
Vertex
& v1,
const
Vertex
& v2 )
130
{
131
if
( v1 <= v2 )
132
{
133
vertices
[ 0 ] = v1;
134
vertices
[ 1 ] = v2;
135
}
136
else
137
{
138
vertices
[ 0 ] = v2;
139
vertices
[ 1 ] = v1;
140
}
141
}
142
bool
operator==
(
const
Edge
& other )
const
143
{
144
return
(
vertices
[ 0 ] == other.
vertices
[ 0 ] )
145
&& (
vertices
[ 1 ] == other.
vertices
[ 1 ] );
146
}
147
bool
operator<
(
const
Edge
& other )
const
148
{
149
return
(
vertices
[ 0 ] < other.
vertices
[ 0 ] )
150
|| ( (
vertices
[ 0 ] == other.
vertices
[ 0 ] )
151
&& (
vertices
[ 1 ] < other.
vertices
[ 1 ] ) );
152
}
153
};
154
// ... End added
155
156
160
Object
();
161
173
Object
(
const
DigitalTopology
& aTopology,
174
const
DigitalSet
& aPointSet,
175
Connectedness
cxn =
UNKNOWN
);
176
188
Object
(
const
CowPtr<DigitalTopology>
& aTopology,
189
const
DigitalSet
& aPointSet,
190
Connectedness
cxn =
UNKNOWN
);
191
204
Object
(
const
DigitalTopology
& aTopology,
205
const
CowPtr<DigitalSet>
& aPointSet,
206
Connectedness
cxn =
UNKNOWN
);
207
220
Object
(
const
DigitalTopology
& aTopology,
221
DigitalSet
* aPointSetPtr,
222
Connectedness
cxn =
UNKNOWN
);
223
232
Object
(
const
DigitalTopology
& aTopology,
233
const
Domain
&
domain
);
234
243
Object
(
const
CowPtr<DigitalTopology>
& aTopology,
244
const
Domain
& aDomain );
245
253
Object
(
const
Object
& other );
254
258
~Object
();
259
265
Object
&
operator=
(
const
Object
& other );
266
270
Size
size
()
const
;
271
275
const
Domain
&
domain
()
const
;
276
281
const
DigitalSet
&
pointSet
()
const
;
282
287
DigitalSet
&
pointSet
();
288
292
const
DigitalTopology
&
topology
()
const
;
293
297
const
ForegroundAdjacency
&
adjacency
()
const
;
298
299
// ----------------------- Object services --------------------------------
300
public
:
301
315
SmallObject
neighborhood
(
const
Point
& p )
const
;
316
327
Size
neighborhoodSize
(
const
Point
& p )
const
;
328
344
SmallObject
properNeighborhood
(
const
Point
& p )
const
;
345
357
Size
properNeighborhoodSize
(
const
Point
& p )
const
;
358
359
360
// ----------------------- border services -------------------------------
361
public
:
362
363
370
Object
border
()
const
;
371
372
373
// ----------------------- Connectedness services -------------------------
374
public
:
375
413
template
<
typename
OutputObjectIterator>
414
Size
writeComponents
( OutputObjectIterator & it )
const
;
415
422
Connectedness
connectedness
()
const
;
423
434
Connectedness
computeConnectedness
()
const
;
435
436
// ----------------------- Graph services ------------------------------
437
public
:
438
439
ConstIterator
begin
()
const
;
440
441
ConstIterator
end
()
const
;
442
448
Size
degree
(
const
Vertex & v )
const
;
449
453
Size
bestCapacity
()
const
;
454
466
template
<
typename
OutputIterator>
467
void
468
writeNeighbors
( OutputIterator &it ,
469
const
Vertex & v )
const
;
470
487
template
<
typename
OutputIterator,
typename
VertexPredicate>
488
void
489
writeNeighbors
( OutputIterator &it ,
490
const
Vertex & v,
491
const
VertexPredicate & pred)
const
;
492
493
494
// ----------------------- Simple points -------------------------------
495
public
:
496
501
template
<
typename
TAdjacency>
502
SmallObject
503
geodesicNeighborhood
(
const
TAdjacency & adj,
504
const
Point
& p,
unsigned
int
k )
const
;
505
510
template
<
typename
TAdjacency>
511
SmallComplementObject
512
geodesicNeighborhoodInComplement
(
const
TAdjacency & adj,
513
const
Point
& p,
unsigned
int
k )
const
;
514
515
527
bool
isSimple
(
const
Point
& v )
const
;
528
529
// ----------------------- Interface --------------------------------------
530
public
:
531
536
void
selfDisplay
( std::ostream & out )
const
;
537
542
bool
isValid
()
const
;
543
544
// ------------------------- Protected Datas ------------------------------
545
private
:
546
// ------------------------- Private Datas --------------------------------
547
private
:
548
552
CowPtr<DigitalTopology>
myTopo
;
553
557
CowPtr<DigitalSet>
myPointSet
;
558
562
mutable
Connectedness
myConnectedness
;
563
564
565
// ------------------------- Hidden services ------------------------------
566
protected
:
567
568
private
:
569
570
571
572
573
// --------------- CDrawableWithBoard2D realization ------------------
574
public
:
575
580
//DrawableWithBoard2D* defaultStyle( std::string mode = "" ) const;
581
585
std::string
className
()
const
;
586
587
588
589
private
:
590
591
// ------------------------- internals ------------------------------------
592
593
};
// end of class Object
594
595
602
template
<
typename
TDigitalTopology,
typename
TDigitalSet>
603
std::ostream&
604
operator<<
( std::ostream & out,
605
const
Object<TDigitalTopology, TDigitalSet>
&
object
);
606
607
608
609
}
// namespace DGtal
610
611
613
// Includes inline functions.
614
#include "DGtal/topology/Object.ih"
615
616
// //
618
619
#endif // !defined Object_h
620
621
#undef Object_RECURSES
622
#endif // else defined(Object_RECURSES)
Generated on Wed Dec 19 2012 19:10:32 for DGtal by
1.8.1.1