DGtal
0.6.devel
|
#include <Object.h>
Data Structures | |
struct | Edge |
struct | VertexMap |
Public Types | |
typedef TDigitalSet | DigitalSet |
typedef TDigitalTopology | DigitalTopology |
typedef DigitalTopology::ReverseTopology | ReverseTopology |
typedef DigitalSet::Size | Size |
typedef DigitalSet::Point | Point |
typedef DigitalTopology::Point | DTPoint |
typedef DigitalSet::Domain | Domain |
typedef Domain::Space | Space |
typedef DigitalSetSelector < Domain, SMALL_DS+HIGH_ITER_DS > ::Type | SmallSet |
typedef DigitalTopology::ForegroundAdjacency | ForegroundAdjacency |
typedef DigitalTopology::BackgroundAdjacency | BackgroundAdjacency |
typedef Object < ReverseTopology, DigitalSet > | ComplementObject |
typedef Object < DigitalTopology, SmallSet > | SmallObject |
typedef Object < ReverseTopology, SmallSet > | SmallComplementObject |
typedef TDigitalSet | VertexSet |
typedef DigitalSet::Point | Vertex |
typedef DigitalSet::ConstIterator | ConstIterator |
Public Member Functions | |
Object () | |
Object (const DigitalTopology &aTopology, const DigitalSet &aPointSet, Connectedness cxn=UNKNOWN) | |
Object (const CowPtr< DigitalTopology > &aTopology, const DigitalSet &aPointSet, Connectedness cxn=UNKNOWN) | |
Object (const DigitalTopology &aTopology, const CowPtr< DigitalSet > &aPointSet, Connectedness cxn=UNKNOWN) | |
Object (const DigitalTopology &aTopology, DigitalSet *aPointSetPtr, Connectedness cxn=UNKNOWN) | |
Object (const DigitalTopology &aTopology, const Domain &domain) | |
Object (const CowPtr< DigitalTopology > &aTopology, const Domain &aDomain) | |
Object (const Object &other) | |
~Object () | |
Object & | operator= (const Object &other) |
Size | size () const |
const Domain & | domain () const |
const DigitalSet & | pointSet () const |
DigitalSet & | pointSet () |
const DigitalTopology & | topology () const |
const ForegroundAdjacency & | adjacency () const |
SmallObject | neighborhood (const Point &p) const |
Size | neighborhoodSize (const Point &p) const |
SmallObject | properNeighborhood (const Point &p) const |
Size | properNeighborhoodSize (const Point &p) const |
Object | border () const |
template<typename OutputObjectIterator > | |
Size | writeComponents (OutputObjectIterator &it) const |
Connectedness | connectedness () const |
Connectedness | computeConnectedness () const |
ConstIterator | begin () const |
ConstIterator | end () const |
Size | degree (const Vertex &v) const |
Size | bestCapacity () const |
template<typename OutputIterator > | |
void | writeNeighbors (OutputIterator &it, const Vertex &v) const |
template<typename OutputIterator , typename VertexPredicate > | |
void | writeNeighbors (OutputIterator &it, const Vertex &v, const VertexPredicate &pred) const |
template<typename TAdjacency > | |
SmallObject | geodesicNeighborhood (const TAdjacency &adj, const Point &p, unsigned int k) const |
template<typename TAdjacency > | |
SmallComplementObject | geodesicNeighborhoodInComplement (const TAdjacency &adj, const Point &p, unsigned int k) const |
bool | isSimple (const Point &v) const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
std::string | className () const |
Private Attributes | |
CowPtr< DigitalTopology > | myTopo |
CowPtr< DigitalSet > | myPointSet |
Connectedness | myConnectedness |
Aim: An object (or digital object) represents a set in some digital space associated with a digital topology.
Description of template class 'Object'
The digital topology induces a connectedness relation on the object (transitive closure of the foreground adjacency) and a connectedness relation on the complement of the set (transitive closure of the background adjacency).
Objects may be connected or not. The connectedness is stored with the object, if it is known. Objects have a border, which are the points which touch the complement in the sense of background adjacency.
export: An Object realizes the concept CDrawableWithBoard2D. It may be displayed with a Board2D, and is by default displayed as a set of digital points. An Object reacts to the mode "DrawAdjacencies". In this case the set of points and the adjacency relations are displayed.
Model of CUndirectedSimpleLocalGraph and CUndirectedSimpleGraph.
TDigitalTopology | any realization of DigitalTopology. |
TDigitalSet | any model of CDigitalSet.* |
typedef DigitalTopology::BackgroundAdjacency DGtal::Object< TDigitalTopology, TDigitalSet >::BackgroundAdjacency |
typedef Object<ReverseTopology, DigitalSet> DGtal::Object< TDigitalTopology, TDigitalSet >::ComplementObject |
typedef DigitalSet::ConstIterator DGtal::Object< TDigitalTopology, TDigitalSet >::ConstIterator |
typedef TDigitalSet DGtal::Object< TDigitalTopology, TDigitalSet >::DigitalSet |
typedef TDigitalTopology DGtal::Object< TDigitalTopology, TDigitalSet >::DigitalTopology |
typedef DigitalSet::Domain DGtal::Object< TDigitalTopology, TDigitalSet >::Domain |
typedef DigitalTopology::Point DGtal::Object< TDigitalTopology, TDigitalSet >::DTPoint |
typedef DigitalTopology::ForegroundAdjacency DGtal::Object< TDigitalTopology, TDigitalSet >::ForegroundAdjacency |
typedef DigitalSet::Point DGtal::Object< TDigitalTopology, TDigitalSet >::Point |
typedef DigitalTopology::ReverseTopology DGtal::Object< TDigitalTopology, TDigitalSet >::ReverseTopology |
typedef DigitalSet::Size DGtal::Object< TDigitalTopology, TDigitalSet >::Size |
typedef Object<ReverseTopology, SmallSet> DGtal::Object< TDigitalTopology, TDigitalSet >::SmallComplementObject |
typedef Object<DigitalTopology, SmallSet> DGtal::Object< TDigitalTopology, TDigitalSet >::SmallObject |
typedef DigitalSetSelector< Domain, SMALL_DS + HIGH_ITER_DS >::Type DGtal::Object< TDigitalTopology, TDigitalSet >::SmallSet |
typedef Domain::Space DGtal::Object< TDigitalTopology, TDigitalSet >::Space |
typedef DigitalSet::Point DGtal::Object< TDigitalTopology, TDigitalSet >::Vertex |
typedef TDigitalSet DGtal::Object< TDigitalTopology, TDigitalSet >::VertexSet |
|
inline |
Constructor. The object is not valid.
Constructor.
aTopology | the digital topology chosen for this set, a copy of which is stored in the object. |
aPointSet | the set of points of the object. It is copied in the object. |
Definition at line 57 of file Object.ih.
References DGtal::UNKNOWN.
|
inline |
Constructor.
aTopology | the digital topology chosen for this set, a copy of which is stored in the object. |
aPointSet | the set of points of the object. It is copied in the object. |
cxn | the connectedness (default is UNKNOWN). |
Constructor.
aTopology | the digital topology chosen for this set, a copy of which is stored in the object. |
aPointSet | the set of points of the object. It is copied in the object. |
|
inline |
Constructor.
aTopology | the digital topology chosen for this set, smartly copied. |
aPointSet | the set of points of the object. It is copied in the object. |
cxn | the connectedness (default is UNKNOWN). |
Constructor.
aTopology | the digital topology chosen for this set, smartly copied. |
aPointSet | the set of points of the object. It is copied in the object. |
|
inline |
Constructor.
aTopology | the digital topology chosen for this set, a copy of which is stored in the object. |
aPointSet | the set of points of the object. It is smartly reference in the object. |
cxn | the connectedness (default is UNKNOWN). |
Constructor.
aTopology | the digital topology chosen for this set, a copy of which is stored in the object. |
aPointSet | the set of points of the object. It is smartly reference in the object. |
|
inline |
Constructor by attachment of a dynamically allocated point set.
aTopology | the digital topology chosen for this set, a copy of which is stored in the object. |
aPointSetPtr | a dynamically allocated pointer on a set of points which is afterwards handled by this (which will take care of its deletion). |
cxn | the connectedness (default is UNKNOWN). |
Constructor by attachment of a dynamically allocated point set.
aTopology | the digital topology chosen for this set, a copy of which is stored in the object. |
aPointSetPtr | a dynamically allocated pointer on a set of points which is afterwards handled by this (which will take care of its deletion). |
|
inline |
|
inline |
Constructor of an empty object by providing a domain.
aTopology | the digital topology chosen for this set, smartly copied. |
aDomain | any domain related to the given topology. |
|
inline |
Copy constructor.
other | the object to clone. |
The copy is smart in the sense that the digital set is referenced, and will be copied only if the set is changed.
|
inline |
|
inline |
|
inline |
Definition at line 650 of file Object.ih.
References DGtal::Object< TDigitalTopology, TDigitalSet >::begin().
Referenced by DGtal::Object< TDigitalTopology, TDigitalSet >::begin().
|
inline |
Definition at line 683 of file Object.ih.
References DGtal::Object< TDigitalTopology, TDigitalSet >::bestCapacity().
Referenced by DGtal::Object< TDigitalTopology, TDigitalSet >::bestCapacity().
|
inline |
NB : the background adjacency should be a symmetric relation.
Definition at line 467 of file Object.ih.
References DGtal::Object< TDigitalTopology, TDigitalSet >::pointSet().
|
inline |
Default drawing style object.
Definition at line 992 of file Object.ih.
Referenced by DGtal::Display3DFactory::draw(), and DGtal::Display2DFactory::draw().
DGtal::Connectedness DGtal::Object< TDigitalTopology, TDigitalSet >::computeConnectedness | ( | ) | const |
If 'connectedness() == UNKNOWN', computes the connectedness of this object. After that, the connectedness of 'this' is either CONNECTED or DISCONNECTED.
Definition at line 612 of file Object.ih.
References DGtal::CONNECTED, DGtal::DISCONNECTED, DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::expand(), DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::finished(), DGtal::UNKNOWN, and DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::visitedVertices().
Referenced by DGtal::Object< TDigitalTopology, TDigitalSet >::isSimple().
DGtal::Connectedness DGtal::Object< TDigitalTopology, TDigitalSet >::connectedness | ( | ) | const |
|
inline |
v | any vertex of the object |
|
inline |
A const reference to the embedding domain.
Definition at line 247 of file Object.ih.
References DGtal::Object< TDigitalTopology, TDigitalSet >::domain().
Referenced by DGtal::Object< TDigitalTopology, TDigitalSet >::domain().
|
inline |
Definition at line 658 of file Object.ih.
References DGtal::Object< TDigitalTopology, TDigitalSet >::end().
Referenced by DGtal::Object< TDigitalTopology, TDigitalSet >::end().
|
inline |
Geodesic neighborhood of point [p] and order [k] in the object for the given metric adjacency.
Definition at line 782 of file Object.ih.
References DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::expand(), DGtal::Object< TDigitalTopology, TDigitalSet >::pointSet(), and DGtal::DigitalSetDomain< TDigitalSet >::predicate().
|
inline |
Geodesic neighborhood of point [p] and order [k] in the complemented object for the given metric adjacency.
Definition at line 851 of file Object.ih.
References DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::expand(), DGtal::Object< TDigitalTopology, TDigitalSet >::pointSet(), and DGtal::DigitalSetDomain< TDigitalSet >::predicate().
|
inline |
[Bertrand, 1994] A voxel v is simple for a set X if #C6 [G6 (v, X)] = #C18[G18(v, X^c)] = 1, where #Ck [Y] denotes the number of k-connected components of a set Y.
We adapt this definition to (kappa,lambda) connectednesses. Be careful, such a definition is valid only for Jordan couples in dimension 2 and 3.
Definition at line 927 of file Object.ih.
References DGtal::Object< TDigitalTopology, TDigitalSet >::computeConnectedness(), DGtal::CONNECTED, and DGtal::Object< TDigitalTopology, TDigitalSet >::pointSet().
|
inline |
Checks the validity/consistency of the object.
|
inline |
Let A be this object with foreground adjacency k and N_k(p) the k-neighborhood of p. Returns the set A intersected with N_k(p).
p | any point (in the domain of the digital object, not necessarily in the object). |
NB: if you need only the size of neighborhood, use neighborhoodSize.
Let A be this object with foreground adjacency k and N_k(p) the k-neighborhood of p. Returns the set A intersected with N_k(p).
p | any point (in the domain of the digital object, not necessarily in the object). |
Definition at line 317 of file Object.ih.
References DGtal::DigitalSetBySTLSet< TDomain >::insertNew(), and DGtal::Object< TDigitalTopology, TDigitalSet >::pointSet().
|
inline |
p | any point (in the domain of the digital object, not necessarily in the object). |
NB: faster than computing the neighborhood then computing its cardinal.
Definition at line 356 of file Object.ih.
|
inline |
Assignment.
other | the object to copy. |
Definition at line 219 of file Object.ih.
References DGtal::Object< TDigitalTopology, TDigitalSet >::myConnectedness, DGtal::Object< TDigitalTopology, TDigitalSet >::myPointSet, and DGtal::Object< TDigitalTopology, TDigitalSet >::myTopo.
|
inline |
A const reference on the point set defining the points of the digital object.
Definition at line 260 of file Object.ih.
Referenced by DGtal::Object< TDigitalTopology, TDigitalSet >::border(), DGtal::Display3DFactory::draw(), DGtal::Display2DFactory::draw(), DGtal::Display3DFactory::drawWithAdjacencies(), DGtal::Display2DFactory::drawWithAdjacencies(), DGtal::Object< TDigitalTopology, TDigitalSet >::geodesicNeighborhood(), DGtal::Object< TDigitalTopology, TDigitalSet >::geodesicNeighborhoodInComplement(), DGtal::Object< TDigitalTopology, TDigitalSet >::isSimple(), DGtal::Object< TDigitalTopology, TDigitalSet >::neighborhood(), and DGtal::Object< TDigitalTopology, TDigitalSet >::properNeighborhood().
|
inline |
A reference on the point set defining the points of the digital object (may duplicate the set).
Definition at line 272 of file Object.ih.
References DGtal::UNKNOWN.
|
inline |
Let A be this object with foreground adjacency k and N*_k(p) the proper k-neighborhood of p. Returns the set A intersected with N*_k(p).
p | any point (in the domain of the digital object, not necessarily in the object). |
NB: if you need only the size of the proper neighborhood, use properNeighborhoodSize.
Let A be this object with foreground adjacency k and N*_k(p) the proper k-neighborhood of p. Returns the set A intersected with N*_k(p).
p | any point (in the domain of the digital object, not necessarily in the object). |
Definition at line 395 of file Object.ih.
References DGtal::DigitalSetBySTLSet< TDomain >::insertNew(), and DGtal::Object< TDigitalTopology, TDigitalSet >::pointSet().
Referenced by DGtal::Display3DFactory::drawWithAdjacencies(), and DGtal::Display2DFactory::drawWithAdjacencies().
|
inline |
p | any point (in the domain of the digital object, not necessarily in the object). |
NB: faster than computing the proper neighborhood then computing its cardinal.
Definition at line 434 of file Object.ih.
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 958 of file Object.ih.
|
inline |
Definition at line 236 of file Object.ih.
References DGtal::Object< TDigitalTopology, TDigitalSet >::size().
Referenced by DGtal::Object< TDigitalTopology, TDigitalSet >::size().
|
inline |
|
inline |
Computes the connected components of the object and writes them on the output iterator [it]. @tparam OutputObjectIterator the type of an output iterator in a container of Object s. @param it the output iterator. *it is an Object. @return the number of components. NB: Be careful that the [it] should not be an output iterator pointing in the same container containing 'this'. The following example might make a 'bus error' because the vector might be resized during insertion. @code
typedef ... MyObject; vector<MyObject> objects; objects[ 0 ] = ... some object; ... back_insert_iterator< vector<MyObject> > it( objects ); objects[ 0 ].writeComponents( it ); // it points in same container as this. // might 'bus error'.
If you wish to use an output iterator (like a std::back_insert_iterator) in the same container containing your object, you can write:
It is nearly as efficient (the clone uses smart copy on write pointers) and works in any case. You might even overwrite your object while doing this.
Computes the connected components of the object and writes them on the output iterator [it].
OutputObjectIterator | the type of an output iterator in a container of Object s. |
it | the output iterator. *it is an Object. |
Definition at line 521 of file Object.ih.
References DGtal::CONNECTED, DGtal::DISCONNECTED, DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::expand(), DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::finished(), and DGtal::BreadthFirstVisitor< TGraph, TMarkSet >::markedVertices().
|
inline |
Writes the neighbors of a vertex using an output iterator
OutputObjectIterator | the type of an output iterator writing in a container of vertices. |
it | the output iterator |
v | the vertex whose neighbors will be writeNeighbors |
Definition at line 704 of file Object.ih.
|
inline |
Writes the neighbors of a vertex which satisfy a predicate using an output iterator
OutputObjectIterator | the type of an output iterator writing in a container of vertices. |
VertexPredicate | the type of the predicate |
it | the output iterator |
v | the vertex whose neighbors will be written |
pred | the predicate that must be satisfied |
Definition at line 747 of file Object.ih.
|
mutableprivate |
Connectedness of this object. Either CONNECTED, DISCONNECTED, or UNKNOWN.
Definition at line 562 of file Object.h.
Referenced by DGtal::Object< TDigitalTopology, TDigitalSet >::operator=().
|
private |
A copy on write pointer on the associated (owned or not) point set
Definition at line 557 of file Object.h.
Referenced by DGtal::Object< TDigitalTopology, TDigitalSet >::operator=().
|
private |
the digital topology of the object.
Definition at line 552 of file Object.h.
Referenced by DGtal::Object< TDigitalTopology, TDigitalSet >::operator=().