DGtal 1.3.0
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Private Attributes
DGtal::Object< TDigitalTopology, TDigitalSet > Class Template Reference

Aim: An object (or digital object) represents a set in some digital space associated with a digital topology. More...

#include <DGtal/topology/Object.h>

Data Structures

struct  Edge
 
struct  VertexMap
 

Public Types

typedef TDigitalSet DigitalSet
 
typedef boost::undirected_tag directed_category
 the graph is undirected. More...
 
typedef boost::Object_graph_traversal_category traversal_category
 the graph satisfies AdjacencyListGraph and VertexListGraph concepts. More...
 
typedef boost::disallow_parallel_edge_tag edge_parallel_category
 the graph does not allow parallel edges. More...
 
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, DigitalSetComplementObject
 
typedef Object< DigitalTopology, SmallSetSmallObject
 
typedef Object< ReverseTopology, SmallSetSmallComplementObject
 
typedef DigitalSet::Point Vertex
 
typedef TDigitalSet VertexSet
 
typedef DigitalSet::ConstIterator ConstIterator
 
typedef std::vector< EdgeEdgeRange
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CDigitalSet< TDigitalSet >))
 
 Object ()
 
 Object (Clone< DigitalTopology > aTopology, Clone< DigitalSet > aPointSet, Connectedness cxn=UNKNOWN)
 
 Object (Clone< DigitalTopology > aTopology, Clone< Domain > domain)
 
 Object (const Object &other)
 
 ~Object ()
 
Objectoperator= (const Object &other)
 
void setTable (Alias< boost::dynamic_bitset<> >inputTable)
 
NeighborhoodConfiguration getNeighborhoodConfigurationOccupancy (const Point &center, const std::unordered_map< Point, NeighborhoodConfiguration > &mapZeroNeighborhoodToMask) const
 
Size size () const
 
const Domaindomain () const
 
CowPtr< DomaindomainPointer () const
 
const DigitalSetpointSet () const
 
DigitalSetpointSet ()
 
const DigitalTopologytopology () const
 
const ForegroundAdjacencyadjacency () 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
 
EdgeRange outEdges (const Vertex &v) const
 
Edge opposite (const Edge &e) const
 
Vertex head (const Edge &e) const
 
Vertex tail (const Edge &e) 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
 
bool isSimpleFromTable (const Point &v, const boost::dynamic_bitset<> &input_table, const std::unordered_map< Point, NeighborhoodConfiguration > &mapZeroNeighborhoodToMask) const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
std::string className () const
 

Private Attributes

CowPtr< DigitalTopologymyTopo
 
CowPtr< DigitalSetmyPointSet
 
Connectedness myConnectedness
 
CountedPtrOrPtr< boost::dynamic_bitset<> > myTable
 
CountedPtrOrPtr< std::unordered_map< Point, unsigned int > > myNeighborConfigurationMap
 
bool myTableIsLoaded
 

Detailed Description

template<typename TDigitalTopology, typename TDigitalSet>
class DGtal::Object< TDigitalTopology, TDigitalSet >

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.

Object has a Boost Graph Interface to directly use an object instance into boost graph library algorithms.

See also
ObjectBoostGraphInterface.h
moduleBoostGraphWrapping for documentation on the interface with boost::graph library.
Template Parameters
TDigitalTopologyany realization of DigitalTopology.
TDigitalSetany model of CDigitalSet.
See also
testObject.cpp
testObject-benchmark.cpp
Examples
topology/3dBorderExtraction.cpp, and topology/3dBorderExtractionImg.cpp.

Definition at line 119 of file Object.h.

Member Typedef Documentation

◆ BackgroundAdjacency

template<typename TDigitalTopology , typename TDigitalSet >
typedef DigitalTopology::BackgroundAdjacency DGtal::Object< TDigitalTopology, TDigitalSet >::BackgroundAdjacency

Definition at line 151 of file Object.h.

◆ ComplementObject

template<typename TDigitalTopology , typename TDigitalSet >
typedef Object<ReverseTopology, DigitalSet> DGtal::Object< TDigitalTopology, TDigitalSet >::ComplementObject

Definition at line 152 of file Object.h.

◆ ConstIterator

template<typename TDigitalTopology , typename TDigitalSet >
typedef DigitalSet::ConstIterator DGtal::Object< TDigitalTopology, TDigitalSet >::ConstIterator

Definition at line 162 of file Object.h.

◆ DigitalSet

template<typename TDigitalTopology , typename TDigitalSet >
typedef TDigitalSet DGtal::Object< TDigitalTopology, TDigitalSet >::DigitalSet

Definition at line 123 of file Object.h.

◆ DigitalTopology

template<typename TDigitalTopology , typename TDigitalSet >
typedef TDigitalTopology DGtal::Object< TDigitalTopology, TDigitalSet >::DigitalTopology

Definition at line 138 of file Object.h.

◆ directed_category

template<typename TDigitalTopology , typename TDigitalSet >
typedef boost::undirected_tag DGtal::Object< TDigitalTopology, TDigitalSet >::directed_category

the graph is undirected.

Definition at line 132 of file Object.h.

◆ Domain

template<typename TDigitalTopology , typename TDigitalSet >
typedef DigitalSet::Domain DGtal::Object< TDigitalTopology, TDigitalSet >::Domain

Definition at line 145 of file Object.h.

◆ DTPoint

template<typename TDigitalTopology , typename TDigitalSet >
typedef DigitalTopology::Point DGtal::Object< TDigitalTopology, TDigitalSet >::DTPoint

Definition at line 143 of file Object.h.

◆ edge_parallel_category

template<typename TDigitalTopology , typename TDigitalSet >
typedef boost::disallow_parallel_edge_tag DGtal::Object< TDigitalTopology, TDigitalSet >::edge_parallel_category

the graph does not allow parallel edges.

Definition at line 136 of file Object.h.

◆ EdgeRange

template<typename TDigitalTopology , typename TDigitalSet >
typedef std::vector<Edge> DGtal::Object< TDigitalTopology, TDigitalSet >::EdgeRange

Definition at line 222 of file Object.h.

◆ ForegroundAdjacency

template<typename TDigitalTopology , typename TDigitalSet >
typedef DigitalTopology::ForegroundAdjacency DGtal::Object< TDigitalTopology, TDigitalSet >::ForegroundAdjacency

Definition at line 150 of file Object.h.

◆ Point

template<typename TDigitalTopology , typename TDigitalSet >
typedef DigitalSet::Point DGtal::Object< TDigitalTopology, TDigitalSet >::Point

Definition at line 141 of file Object.h.

◆ ReverseTopology

template<typename TDigitalTopology , typename TDigitalSet >
typedef DigitalTopology::ReverseTopology DGtal::Object< TDigitalTopology, TDigitalSet >::ReverseTopology

Definition at line 139 of file Object.h.

◆ Size

template<typename TDigitalTopology , typename TDigitalSet >
typedef DigitalSet::Size DGtal::Object< TDigitalTopology, TDigitalSet >::Size

Definition at line 140 of file Object.h.

◆ SmallComplementObject

template<typename TDigitalTopology , typename TDigitalSet >
typedef Object<ReverseTopology, SmallSet> DGtal::Object< TDigitalTopology, TDigitalSet >::SmallComplementObject

Definition at line 154 of file Object.h.

◆ SmallObject

template<typename TDigitalTopology , typename TDigitalSet >
typedef Object<DigitalTopology, SmallSet> DGtal::Object< TDigitalTopology, TDigitalSet >::SmallObject

Definition at line 153 of file Object.h.

◆ SmallSet

template<typename TDigitalTopology , typename TDigitalSet >
typedef DigitalSetSelector<Domain,SMALL_DS+HIGH_ITER_DS>::Type DGtal::Object< TDigitalTopology, TDigitalSet >::SmallSet

Definition at line 149 of file Object.h.

◆ Space

template<typename TDigitalTopology , typename TDigitalSet >
typedef Domain::Space DGtal::Object< TDigitalTopology, TDigitalSet >::Space

Definition at line 146 of file Object.h.

◆ traversal_category

template<typename TDigitalTopology , typename TDigitalSet >
typedef boost::Object_graph_traversal_category DGtal::Object< TDigitalTopology, TDigitalSet >::traversal_category

the graph satisfies AdjacencyListGraph and VertexListGraph concepts.

Definition at line 134 of file Object.h.

◆ Vertex

template<typename TDigitalTopology , typename TDigitalSet >
typedef DigitalSet::Point DGtal::Object< TDigitalTopology, TDigitalSet >::Vertex

Definition at line 157 of file Object.h.

◆ VertexSet

template<typename TDigitalTopology , typename TDigitalSet >
typedef TDigitalSet DGtal::Object< TDigitalTopology, TDigitalSet >::VertexSet

Definition at line 158 of file Object.h.

Constructor & Destructor Documentation

◆ Object() [1/4]

template<typename TDigitalTopology , typename TDigitalSet >
DGtal::Object< TDigitalTopology, TDigitalSet >::Object ( )

Constructor. The object is not valid.

◆ Object() [2/4]

template<typename TDigitalTopology , typename TDigitalSet >
DGtal::Object< TDigitalTopology, TDigitalSet >::Object ( Clone< DigitalTopology aTopology,
Clone< DigitalSet aPointSet,
Connectedness  cxn = UNKNOWN 
)

Constructor.

Parameters
aTopologythe digital topology chosen for this set, a copy of which is stored in the object.
aPointSetthe set of points of the object. It is copied in the object.
cxnthe connectedness (default is UNKNOWN).

◆ Object() [3/4]

template<typename TDigitalTopology , typename TDigitalSet >
DGtal::Object< TDigitalTopology, TDigitalSet >::Object ( Clone< DigitalTopology aTopology,
Clone< Domain domain 
)

Constructor of an empty object by providing a domain.

Parameters
aTopologythe digital topology chosen for this set, a copy of which is stored in the object.
domainany domain related to the given topology.

◆ Object() [4/4]

template<typename TDigitalTopology , typename TDigitalSet >
DGtal::Object< TDigitalTopology, TDigitalSet >::Object ( const Object< TDigitalTopology, TDigitalSet > &  other)

Copy constructor.

Parameters
otherthe 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.

◆ ~Object()

template<typename TDigitalTopology , typename TDigitalSet >
DGtal::Object< TDigitalTopology, TDigitalSet >::~Object ( )

Destructor.

Member Function Documentation

◆ adjacency()

template<typename TDigitalTopology , typename TDigitalSet >
const ForegroundAdjacency & DGtal::Object< TDigitalTopology, TDigitalSet >::adjacency ( ) const
Returns
a const reference to the adjacency of this object.

◆ begin()

template<typename TDigitalTopology , typename TDigitalSet >
ConstIterator DGtal::Object< TDigitalTopology, TDigitalSet >::begin ( ) const
Returns
a ConstIterator to the first element (begin).

◆ bestCapacity()

template<typename TDigitalTopology , typename TDigitalSet >
Size DGtal::Object< TDigitalTopology, TDigitalSet >::bestCapacity ( ) const
Returns
the maximum number of neighbors for a vertex of this object

◆ BOOST_CONCEPT_ASSERT()

template<typename TDigitalTopology , typename TDigitalSet >
DGtal::Object< TDigitalTopology, TDigitalSet >::BOOST_CONCEPT_ASSERT ( (concepts::CDigitalSet< TDigitalSet >)  )

◆ border()

template<typename TDigitalTopology , typename TDigitalSet >
Object DGtal::Object< TDigitalTopology, TDigitalSet >::border ( ) const
Returns
the border of this object (the set of points of this which is lambda()-adjacent with some point of the background).

NB : the background adjacency should be a symmetric relation.

Examples
topology/3dBorderExtractionImg.cpp.

Referenced by main().

◆ className()

template<typename TDigitalTopology , typename TDigitalSet >
std::string DGtal::Object< TDigitalTopology, TDigitalSet >::className ( ) const
Returns
the style name used for drawing this object.

Referenced by main(), and testSimplePoints2D().

◆ computeConnectedness()

template<typename TDigitalTopology , typename TDigitalSet >
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.

Returns
the connectedness of this object. Either CONNECTED or DISCONNECTED.
See also
connectedness

◆ connectedness()

template<typename TDigitalTopology , typename TDigitalSet >
Connectedness DGtal::Object< TDigitalTopology, TDigitalSet >::connectedness ( ) const
Returns
the connectedness of this object. Either CONNECTED, DISCONNECTED, or UNKNOWN.
See also
computeConnectedness

◆ degree()

template<typename TDigitalTopology , typename TDigitalSet >
Size DGtal::Object< TDigitalTopology, TDigitalSet >::degree ( const Vertex v) const
Parameters
vany vertex of the object
Returns
the number of neighbors of this vertex, excluding itself.

◆ domain()

template<typename TDigitalTopology , typename TDigitalSet >
const Domain & DGtal::Object< TDigitalTopology, TDigitalSet >::domain ( ) const

A const reference to the embedding domain.

◆ domainPointer()

template<typename TDigitalTopology , typename TDigitalSet >
CowPtr< Domain > DGtal::Object< TDigitalTopology, TDigitalSet >::domainPointer ( ) const

A counted pointer to the embedding domain.

◆ end()

template<typename TDigitalTopology , typename TDigitalSet >
ConstIterator DGtal::Object< TDigitalTopology, TDigitalSet >::end ( ) const
Returns
a ConstIterator corresponding to the "end" of the object element range.

◆ geodesicNeighborhood()

template<typename TDigitalTopology , typename TDigitalSet >
template<typename TAdjacency >
SmallObject DGtal::Object< TDigitalTopology, TDigitalSet >::geodesicNeighborhood ( const TAdjacency &  adj,
const Point p,
unsigned int  k 
) const

Geodesic neighborhood of point [p] and order [k] in the object for the given metric adjacency.

◆ geodesicNeighborhoodInComplement()

template<typename TDigitalTopology , typename TDigitalSet >
template<typename TAdjacency >
SmallComplementObject DGtal::Object< TDigitalTopology, TDigitalSet >::geodesicNeighborhoodInComplement ( const TAdjacency &  adj,
const Point p,
unsigned int  k 
) const

Geodesic neighborhood of point [p] and order [k] in the complemented object for the given metric adjacency.

◆ getNeighborhoodConfigurationOccupancy()

template<typename TDigitalTopology , typename TDigitalSet >
NeighborhoodConfiguration DGtal::Object< TDigitalTopology, TDigitalSet >::getNeighborhoodConfigurationOccupancy ( const Point center,
const std::unordered_map< Point, NeighborhoodConfiguration > &  mapZeroNeighborhoodToMask 
) const

Get the occupancy configuration of the neighborhood of a point. The neighborhood only depends on the dimension, not the topology of the object (3x3 cube for 3D point, 2x2 square for 2D).

Parameters
centerpoint of the neighborhood. It doesn't matter if center belongs or not to input_object.
mapZeroNeighborhoodToMaskmaping each point of the neighborhood of point Zero to a NeighborhoodConfiguration.
See also
myNeighborConfigurationMap
mapPointToBitMask
Returns
bit configuration of neighborhood

◆ head()

template<typename TDigitalTopology , typename TDigitalSet >
Vertex DGtal::Object< TDigitalTopology, TDigitalSet >::head ( const Edge e) const
Parameters
eedge
Returns
Head vertex of edge. Related to boost::target
Note
It doesn't check if output vertex belongs to Object.

◆ isSimple()

template<typename TDigitalTopology , typename TDigitalSet >
bool DGtal::Object< TDigitalTopology, TDigitalSet >::isSimple ( const Point v) const

[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.

Returns
'true' if this point is simple.

Referenced by main(), testSetTable(), and testSimplePoints2D().

◆ isSimpleFromTable()

template<typename TDigitalTopology , typename TDigitalSet >
bool DGtal::Object< TDigitalTopology, TDigitalSet >::isSimpleFromTable ( const Point v,
const boost::dynamic_bitset<> &  input_table,
const std::unordered_map< Point, NeighborhoodConfiguration > &  mapZeroNeighborhoodToMask 
) const
inline

Use pre-calculated look-up-table to check if point is simple.

Note
this method is used by isSimple if the object have a table set with Object::setTable
Parameters
vpoint to check simplicity.
input_tableexternal look up table containing the configuration of neighbors which are simple.
See also
functions::loadTable
Parameters
mapZeroNeighborhoodToMaskmaping each point of the neighborhood of point Zero to a NeighborhoodConfiguration.
Returns
true if the point is simple according to precalculated table.
Note
precalculated tables are available at build time.
See also
NeighborhoodTables.h

◆ isValid()

template<typename TDigitalTopology , typename TDigitalSet >
bool DGtal::Object< TDigitalTopology, TDigitalSet >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

◆ neighborhood()

template<typename TDigitalTopology , typename TDigitalSet >
SmallObject DGtal::Object< TDigitalTopology, TDigitalSet >::neighborhood ( const Point p) const

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).

Parameters
pany point (in the domain of the digital object, not necessarily in the object).
Returns
the kappa-neighborhood of [p] in this object.
See also
neighborhoodSize

NB: if you need only the size of neighborhood, use neighborhoodSize.

Referenced by testObject().

◆ neighborhoodSize()

template<typename TDigitalTopology , typename TDigitalSet >
Size DGtal::Object< TDigitalTopology, TDigitalSet >::neighborhoodSize ( const Point p) const
Parameters
pany point (in the domain of the digital object, not necessarily in the object).
Returns
the cardinal of the kappa-neighborhood of [p] in this object.
See also
neighborhood

NB: faster than computing the neighborhood then computing its cardinal.

◆ operator=()

template<typename TDigitalTopology , typename TDigitalSet >
Object & DGtal::Object< TDigitalTopology, TDigitalSet >::operator= ( const Object< TDigitalTopology, TDigitalSet > &  other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

◆ opposite()

template<typename TDigitalTopology , typename TDigitalSet >
Edge DGtal::Object< TDigitalTopology, TDigitalSet >::opposite ( const Edge e) const

Return the opposite edge. Swap between source (head) and target (tail).

Parameters
eedge
Returns
opposite edge.

◆ outEdges()

template<typename TDigitalTopology , typename TDigitalSet >
EdgeRange DGtal::Object< TDigitalTopology, TDigitalSet >::outEdges ( const Vertex v) const

Create on-the-fly vector of edges with size the degree of the input vertex. Each edge has source equal to the input vertex target, and target, a neighbor.

Parameters
vvertex to get edges from.
Returns
container of Edges between input and connected vertices.

◆ pointSet() [1/2]

template<typename TDigitalTopology , typename TDigitalSet >
DigitalSet & DGtal::Object< TDigitalTopology, TDigitalSet >::pointSet ( )

A reference on the point set defining the points of the digital object (may duplicate the set).

◆ pointSet() [2/2]

template<typename TDigitalTopology , typename TDigitalSet >
const DigitalSet & DGtal::Object< TDigitalTopology, TDigitalSet >::pointSet ( ) const

A const reference on the point set defining the points of the digital object.

Referenced by main(), testObject(), testSetTable(), and testSimplePoints2D().

◆ properNeighborhood()

template<typename TDigitalTopology , typename TDigitalSet >
SmallObject DGtal::Object< TDigitalTopology, TDigitalSet >::properNeighborhood ( const Point p) const

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).

Parameters
pany point (in the domain of the digital object, not necessarily in the object).
Returns
the kappa-neighborhood of [p] in this object, without p.
See also
properNeighborhoodSize

NB: if you need only the size of the proper neighborhood, use properNeighborhoodSize.

Referenced by testObject().

◆ properNeighborhoodSize()

template<typename TDigitalTopology , typename TDigitalSet >
Size DGtal::Object< TDigitalTopology, TDigitalSet >::properNeighborhoodSize ( const Point p) const
Parameters
pany point (in the domain of the digital object, not necessarily in the object).
Returns
the cardinal of the kappa-neighborhood of [p] in this object.
See also
properNeighborhood

NB: faster than computing the proper neighborhood then computing its cardinal.

◆ selfDisplay()

template<typename TDigitalTopology , typename TDigitalSet >
void DGtal::Object< TDigitalTopology, TDigitalSet >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ setTable()

template<typename TDigitalTopology , typename TDigitalSet >
void DGtal::Object< TDigitalTopology, TDigitalSet >::setTable ( Alias< boost::dynamic_bitset<> >  inputTable)

Clone into the object pre-computed look up table to speed up isSimple calculation.

Parameters
inputTabletable loaded using functions::loadTable from NeighborhoodConfigurations.h

Referenced by testSetTable().

◆ size()

template<typename TDigitalTopology , typename TDigitalSet >
Size DGtal::Object< TDigitalTopology, TDigitalSet >::size ( ) const
Returns
the number of elements in the set.

Referenced by testObject().

◆ tail()

template<typename TDigitalTopology , typename TDigitalSet >
Vertex DGtal::Object< TDigitalTopology, TDigitalSet >::tail ( const Edge e) const
Parameters
eedge
Returns
Tail vertex of edge. Related to boost::source
Note
It doesn't check if output vertex belongs to Object.

◆ topology()

template<typename TDigitalTopology , typename TDigitalSet >
const DigitalTopology & DGtal::Object< TDigitalTopology, TDigitalSet >::topology ( ) const
Returns
a const reference to the topology of this object.

◆ writeComponents()

template<typename TDigitalTopology , typename TDigitalSet >
template<typename OutputObjectIterator >
Size DGtal::Object< TDigitalTopology, TDigitalSet >::writeComponents ( OutputObjectIterator &  it) const
  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.

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:

MyObject( objects[ 0 ] ).writeComponents( it );

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.

◆ writeNeighbors() [1/2]

template<typename TDigitalTopology , typename TDigitalSet >
template<typename OutputIterator >
void DGtal::Object< TDigitalTopology, TDigitalSet >::writeNeighbors ( OutputIterator &  it,
const Vertex v 
) const

Writes the neighbors of a vertex using an output iterator

Template Parameters
OutputIteratorthe type of an output iterator writing in a container of vertices.
Parameters
itthe output iterator
vthe vertex whose neighbors will be writeNeighbors

◆ writeNeighbors() [2/2]

template<typename TDigitalTopology , typename TDigitalSet >
template<typename OutputIterator , typename VertexPredicate >
void DGtal::Object< TDigitalTopology, TDigitalSet >::writeNeighbors ( OutputIterator &  it,
const Vertex v,
const VertexPredicate &  pred 
) const

Writes the neighbors of a vertex which satisfy a predicate using an output iterator

Template Parameters
OutputIteratorthe type of an output iterator writing in a container of vertices.
VertexPredicatethe type of the predicate
Parameters
itthe output iterator
vthe vertex whose neighbors will be written
predthe predicate that must be satisfied

Field Documentation

◆ myConnectedness

template<typename TDigitalTopology , typename TDigitalSet >
Connectedness DGtal::Object< TDigitalTopology, TDigitalSet >::myConnectedness
mutableprivate

Connectedness of this object. Either CONNECTED, DISCONNECTED, or UNKNOWN.

Definition at line 660 of file Object.h.

◆ myNeighborConfigurationMap

template<typename TDigitalTopology , typename TDigitalSet >
CountedPtrOrPtr<std::unordered_map<Point,unsigned int> > DGtal::Object< TDigitalTopology, TDigitalSet >::myNeighborConfigurationMap
private

Neighborhood configuration points to bit mask. Needed to use table.

Definition at line 670 of file Object.h.

◆ myPointSet

template<typename TDigitalTopology , typename TDigitalSet >
CowPtr<DigitalSet> DGtal::Object< TDigitalTopology, TDigitalSet >::myPointSet
private

A copy on write pointer on the associated (owned or not) point set

Definition at line 655 of file Object.h.

◆ myTable

template<typename TDigitalTopology , typename TDigitalSet >
CountedPtrOrPtr<boost::dynamic_bitset<> > DGtal::Object< TDigitalTopology, TDigitalSet >::myTable
private

pointer to look-up-table to speed up isSimple

Definition at line 665 of file Object.h.

◆ myTableIsLoaded

template<typename TDigitalTopology , typename TDigitalSet >
bool DGtal::Object< TDigitalTopology, TDigitalSet >::myTableIsLoaded
private

Flag to allow using myTable in isSimple calculation.

Definition at line 675 of file Object.h.

◆ myTopo

template<typename TDigitalTopology , typename TDigitalSet >
CowPtr<DigitalTopology> DGtal::Object< TDigitalTopology, TDigitalSet >::myTopo
private

the digital topology of the object.

Definition at line 650 of file Object.h.


The documentation for this class was generated from the following file: