DGtal 1.4.0
|
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 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 () | |
Object & | operator= (const Object &other) |
void | setTable (Alias< boost::dynamic_bitset<> >inputTable) |
NeighborhoodConfiguration | getNeighborhoodConfigurationOccupancy (const Point ¢er, const std::unordered_map< Point, NeighborhoodConfiguration > &mapZeroNeighborhoodToMask) const |
Size | size () const |
const Domain & | domain () const |
CowPtr< Domain > | domainPointer () 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 |
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< DigitalTopology > | myTopo |
CowPtr< DigitalSet > | myPointSet |
Connectedness | myConnectedness |
CountedPtrOrPtr< boost::dynamic_bitset<> > | myTable |
CountedPtrOrPtr< std::unordered_map< Point, unsigned int > > | myNeighborConfigurationMap |
bool | myTableIsLoaded |
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.
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 boost::undirected_tag DGtal::Object< TDigitalTopology, TDigitalSet >::directed_category |
typedef DigitalSet::Domain DGtal::Object< TDigitalTopology, TDigitalSet >::Domain |
typedef DigitalTopology::Point DGtal::Object< TDigitalTopology, TDigitalSet >::DTPoint |
typedef boost::disallow_parallel_edge_tag DGtal::Object< TDigitalTopology, TDigitalSet >::edge_parallel_category |
typedef std::vector<Edge> DGtal::Object< TDigitalTopology, TDigitalSet >::EdgeRange |
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 boost::Object_graph_traversal_category DGtal::Object< TDigitalTopology, TDigitalSet >::traversal_category |
typedef DigitalSet::Point DGtal::Object< TDigitalTopology, TDigitalSet >::Vertex |
typedef TDigitalSet DGtal::Object< TDigitalTopology, TDigitalSet >::VertexSet |
DGtal::Object< TDigitalTopology, TDigitalSet >::Object | ( | ) |
Constructor. The object is not valid.
DGtal::Object< TDigitalTopology, TDigitalSet >::Object | ( | Clone< DigitalTopology > | aTopology, |
Clone< DigitalSet > | aPointSet, | ||
Connectedness | cxn = 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. |
cxn | the connectedness (default is UNKNOWN). |
DGtal::Object< TDigitalTopology, TDigitalSet >::Object | ( | Clone< DigitalTopology > | aTopology, |
Clone< Domain > | domain ) |
Constructor of an empty object by providing a domain.
aTopology | the digital topology chosen for this set, a copy of which is stored in the object. |
domain | any domain related to the given topology. |
DGtal::Object< TDigitalTopology, TDigitalSet >::Object | ( | const Object< TDigitalTopology, TDigitalSet > & | other | ) |
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.
DGtal::Object< TDigitalTopology, TDigitalSet >::~Object | ( | ) |
Destructor.
const ForegroundAdjacency & DGtal::Object< TDigitalTopology, TDigitalSet >::adjacency | ( | ) | const |
ConstIterator DGtal::Object< TDigitalTopology, TDigitalSet >::begin | ( | ) | const |
Size DGtal::Object< TDigitalTopology, TDigitalSet >::bestCapacity | ( | ) | const |
DGtal::Object< TDigitalTopology, TDigitalSet >::BOOST_CONCEPT_ASSERT | ( | (concepts::CDigitalSet< TDigitalSet >) | ) |
Object DGtal::Object< TDigitalTopology, TDigitalSet >::border | ( | ) | const |
NB : the background adjacency should be a symmetric relation.
Referenced by main().
std::string DGtal::Object< TDigitalTopology, TDigitalSet >::className | ( | ) | const |
Referenced by main(), and testSimplePoints2D().
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.
Connectedness DGtal::Object< TDigitalTopology, TDigitalSet >::connectedness | ( | ) | const |
Size DGtal::Object< TDigitalTopology, TDigitalSet >::degree | ( | const Vertex & | v | ) | const |
v | any vertex of the object |
const Domain & DGtal::Object< TDigitalTopology, TDigitalSet >::domain | ( | ) | const |
A const reference to the embedding domain.
CowPtr< Domain > DGtal::Object< TDigitalTopology, TDigitalSet >::domainPointer | ( | ) | const |
A counted pointer to the embedding domain.
ConstIterator DGtal::Object< TDigitalTopology, TDigitalSet >::end | ( | ) | const |
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.
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.
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).
center | point of the neighborhood. It doesn't matter if center belongs or not to input_object. |
mapZeroNeighborhoodToMask | maping each point of the neighborhood of point Zero to a NeighborhoodConfiguration. |
Vertex DGtal::Object< TDigitalTopology, TDigitalSet >::head | ( | const Edge & | e | ) | const |
e | edge |
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.
Referenced by main(), testSetTable(), and testSimplePoints2D().
|
inline |
Use pre-calculated look-up-table to check if point is simple.
v | point to check simplicity. |
input_table | external look up table containing the configuration of neighbors which are simple. |
mapZeroNeighborhoodToMask | maping each point of the neighborhood of point Zero to a NeighborhoodConfiguration. |
bool DGtal::Object< TDigitalTopology, TDigitalSet >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
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).
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.
Referenced by testObject().
Size DGtal::Object< TDigitalTopology, TDigitalSet >::neighborhoodSize | ( | const Point & | p | ) | const |
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.
Object & DGtal::Object< TDigitalTopology, TDigitalSet >::operator= | ( | const Object< TDigitalTopology, TDigitalSet > & | other | ) |
Assignment.
other | the object to copy. |
Edge DGtal::Object< TDigitalTopology, TDigitalSet >::opposite | ( | const Edge & | e | ) | const |
Return the opposite edge. Swap between source (head) and target (tail).
e | edge |
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.
v | vertex to get edges from. |
DigitalSet & DGtal::Object< TDigitalTopology, TDigitalSet >::pointSet | ( | ) |
A reference on the point set defining the points of the digital object (may duplicate the set).
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().
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).
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.
Referenced by testObject().
Size DGtal::Object< TDigitalTopology, TDigitalSet >::properNeighborhoodSize | ( | const Point & | p | ) | const |
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.
void DGtal::Object< TDigitalTopology, TDigitalSet >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
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.
inputTable | table loaded using functions::loadTable from NeighborhoodConfigurations.h |
Referenced by testSetTable().
Size DGtal::Object< TDigitalTopology, TDigitalSet >::size | ( | ) | const |
Referenced by testObject().
Vertex DGtal::Object< TDigitalTopology, TDigitalSet >::tail | ( | const Edge & | e | ) | const |
e | edge |
const DigitalTopology & DGtal::Object< TDigitalTopology, TDigitalSet >::topology | ( | ) | const |
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.
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.
void DGtal::Object< TDigitalTopology, TDigitalSet >::writeNeighbors | ( | OutputIterator & | it, |
const Vertex & | v ) const |
Writes the neighbors of a vertex using an output iterator
OutputIterator | the type of an output iterator writing in a container of vertices. |
it | the output iterator |
v | the vertex whose neighbors will be writeNeighbors |
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
OutputIterator | 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 |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |