DGtal
0.6.devel
|
#include <ImageContainerByHashTree.h>
Data Structures | |
class | Iterator |
class | Node |
Public Types | |
typedef ImageContainerByHashTree < TDomain, TValue, THashKey > | Self |
typedef THashKey | HashKey |
typedef TDomain | Domain |
typedef Domain::Point | Point |
typedef Domain::Vector | Vector |
typedef Domain::Integer | Integer |
typedef Domain::Size | Size |
typedef Domain::Dimension | Dimension |
typedef Point | Vertex |
typedef TValue | Value |
typedef ConstRangeAdapter < typename Domain::ConstIterator, Self, Value > | ConstRange |
typedef SetValueIterator< Self > | OutputIterator |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((CDomain< TDomain >)) | |
BOOST_STATIC_ASSERT ((boost::is_same< Domain, HyperRectDomain< SpaceND< dimension, Integer > > >::value)) | |
BOOST_CONCEPT_ASSERT ((CLabel< TValue >)) | |
ImageContainerByHashTree (const unsigned int hashKeySize, const unsigned int depth, const Value defaultValue) | |
ImageContainerByHashTree (const unsigned int hashKeySize, const Point &p1, const Point &p2, const Value defaultValue) | |
ImageContainerByHashTree (const Domain &aDomain, const unsigned int hashKeySize=3, const Value defaultValue=NumberTraits< Value >::ZERO) | |
const Domain & | domain () const |
ConstRange | range () const |
OutputIterator | outputIterator () |
Value | get (const HashKey key) const |
Value | operator() (const HashKey key) const |
Value | operator() (const Point &aPoint) const |
Value | get (const Point &aPoint) const |
Value | upwardGet (const HashKey key) const |
Value | reverseGet (const HashKey key) const |
void | setValue (const HashKey key, const Value object) |
void | setValue (const Point &aPoint, const Value object) |
unsigned int | getSpanSize () const |
unsigned int | getDepth () const |
bool | isKeyValid (HashKey key) const |
bool | checkIntegrity (HashKey key=ROOT_KEY, bool leafAbove=false) const |
HashKey | getKey (const Point &aPoint) const |
unsigned int | getKeyDepth (HashKey key) const |
int * | getCoordinatesFromKey (HashKey key) const |
void | printState (std::ostream &out, bool displayKeys=false) const |
void | printTree (HashKey key, std::ostream &out, bool displayKeys) const |
void | printInternalState (std::ostream &out, unsigned int nbBits=0) const |
void | printInfo (std::ostream &out) const |
unsigned int | getNbEmptyLists () const |
double | getAverageCollisions () const |
unsigned int | getMaxCollisions () const |
unsigned int | getNbNodes (unsigned int intermediateKey) const |
unsigned int | getNbNodes () const |
Iterator | begin () |
Iterator | end () |
void | selfDisplay (std::ostream &out) |
bool | isValid () const |
std::string | className () const |
Node * | getNode (const HashKey key) const |
Data Fields | |
int | myDebugCounter |
Point | myOrigin |
Morton< HashKey, Point > | myMorton |
Static Public Attributes | |
static const Domain::Dimension | dimension = Domain::dimension |
static const Domain::Dimension | dim = Domain::dimension |
static const unsigned int | NbChildrenPerNode = POW<2, dimension>::VALUE |
static const HashKey | ROOT_KEY = static_cast<HashKey>(1) |
Protected Member Functions | |
template<typename C > | |
void | recursiveDraw (HashKey key, const double p1[2], const double len, Board2D &board, const C &cmap) const |
HashKey | getIntermediateKey (const HashKey key) const |
Node * | addNode (const Value object, const HashKey key) |
bool | removeNode (HashKey key) |
void | recursiveRemoveNode (HashKey key, unsigned int nbRecursions) |
void | setDepth (unsigned int depth) |
Value | blendChildren (HashKey key) const |
Protected Attributes | |
Domain | myDomain |
Node ** | myData |
unsigned int | myKeySize |
unsigned int | myArraySize |
unsigned int | myTreeDepth |
unsigned int | mySpanSize |
HashKey | myDepthMask |
HashKey | myPreComputedIntermediateMask |
Static Protected Attributes | |
static const unsigned int | myN = POW<2,dim>::VALUE |
Model of CImageContainer implementing the association key<->Value using a hash tree. This class provides a built-in iterator.
Description of template class 'ImageContainerByHashTree'
The ImageContainerByHashTree relies on a tree model implemented using a hash table based on Morton Codes. A Morton hash key is obtained from coordinates by interleaving the binary representations of the coordinate values. This means the coordinates have to be of integer type for the morton code to be valid.
The data can be accessed using keys, coordinates or Iterators provided by the container.
The parent of a given key can be found by simply shifting to the left the key's bits by it's dimension. exemples: for an octree (N = 3) the parent key of the key 1110100001 is 1110100. for a quadtree (N = 2) the parent key of the key 10010111 is 100101.
It is then easy to determine, for a N-Dimmensionnal container, all the children keys of a given key, by concatenating any combination of N bits at the right side of the key (least important bits). exemple: for a quadtree (N = 2) 1010100, 1010101, 1010110 and 1010111 are the children of 10101.
In order to disgard any ambiguous case, we need to make the assertion that the root of the hash is at key 1. Else we would have to deal with the problem of the key 00000..0 which would have one of it's children equal to 0 and so on... This means that we need to set the key's N*maxDepth bit to 1 after interleaving the corrdinates bit for key generation.
Note that not any combination of bits is valid. We saw the exemple of the key 0, and there are other cases of invalidity. For a key to be valid, the last set bit (most important set bit) must be at a position of the form k*N with N the Dimmension of the Domain and k a positive integer. exemples: for an octree(N = 3) 1, 1000, 1010111 are valid keys, whereas 0, 10, 11101 are not !
Warning ! For performances this container's access method never check for a key's validity. Trying to access an invalid key may destroy the validity of the tree's structure and/or get the program stuck into an infinite loop.
The method isKeyValid(..) is provided to verify the validity of a key. Note that using this security strongly affects performances.
TDomain | type of domains |
TValue | type for image values THashKey type to store Morton keys (default: DGtal::uint64_t) |
Definition at line 124 of file ImageContainerByHashTree.h.
typedef ConstRangeAdapter<typename Domain::ConstIterator, Self, Value > DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::ConstRange |
Definition at line 161 of file ImageContainerByHashTree.h.
typedef Domain::Dimension DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Dimension |
Definition at line 144 of file ImageContainerByHashTree.h.
typedef TDomain DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Domain |
Definition at line 139 of file ImageContainerByHashTree.h.
typedef THashKey DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::HashKey |
Definition at line 135 of file ImageContainerByHashTree.h.
typedef Domain::Integer DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Integer |
Definition at line 142 of file ImageContainerByHashTree.h.
typedef SetValueIterator<Self> DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::OutputIterator |
output iterator
Definition at line 164 of file ImageContainerByHashTree.h.
typedef Domain::Point DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Point |
Definition at line 140 of file ImageContainerByHashTree.h.
typedef ImageContainerByHashTree<TDomain, TValue, THashKey> DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Self |
Definition at line 128 of file ImageContainerByHashTree.h.
typedef Domain::Size DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Size |
Definition at line 143 of file ImageContainerByHashTree.h.
typedef TValue DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Value |
Definition at line 160 of file ImageContainerByHashTree.h.
typedef Domain::Vector DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Vector |
Definition at line 141 of file ImageContainerByHashTree.h.
typedef Point DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Vertex |
Definition at line 145 of file ImageContainerByHashTree.h.
|
inline |
The constructor from a hashKeySize, a depth and a defaultValue.
hashKeySize | Number of bit of the hash key. This parameter is important as it influences the amount of collisions in the hash table. A value K creates an array of length 2^K with potential unused cells so a compromise between speed and memory usage is to be done here. |
depth | Determines the maximum depth of the tree and thus qthe "size" of the image. Each span then extends from 0 to 2^depth. |
defaultValue | In order for the tree to be valid it needs a default value at the root (key = 1) |
Definition at line 63 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::addNode(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::dim, DGtal::Trace::error(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myArraySize, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myData, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myKeySize, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myOrigin, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myPreComputedIntermediateMask, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::ROOT_KEY, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::setDepth(), and DGtal::trace.
|
inline |
The constructor from a hashKeySize, a defaultValue and a pair of points. In this case, the depth of the tree is given by the logarithm of the domain size defined by the two points.
hashKeySize | Number of bit of the hash key. This parameter is important as it influences the amount of collisions in the hash table. A value K creates an array of length 2^K with potential unused cells so a compromise between speed and memory usage is to be done here. |
p1 | First point of the image bounding box. |
p1 | Second point of the image bounding box. |
defaultValue | In order for the tree to be valid it needs a default value at the root (key = 1) |
Definition at line 147 of file ImageContainerByHashTree.ih.
References DGtal::Trace::error(), and DGtal::trace.
|
inline |
The constructor from a domain, a defaultValue (default value: 0) and a hashKeySize (default value: 3). In this case, the depth of the tree is given by the logarithm of the domain size defined by the two points.
aDomain | the image domain |
hashKeySize | Number of bit of the hash key. This parameter is important as it influences the amount of collisions in the hash table. A value K creates an array of length 2^K with potential unused cells so a compromise between speed and memory usage is to be done here (default: 3). |
defaultValue | In order for the tree to be valid it needs a default value at the root (key = 1) |
Definition at line 101 of file ImageContainerByHashTree.ih.
References DGtal::Trace::error(), and DGtal::trace.
|
inlineprotected |
Add a Node to the tree. This method is very used when writing in the tree (set method). As detailed in the inner class Node, nodes are pairs (value,key)
object | a object (value) |
key | a hashtree key |
Definition at line 671 of file ImageContainerByHashTree.h.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getIntermediateKey(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNode(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getObject(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myData, and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::setNext().
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::ImageContainerByHashTree().
|
inline |
Returns an iterator to the first value as stored in the container.
Definition at line 542 of file ImageContainerByHashTree.h.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myArraySize, and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myData.
|
protected |
Recursively get the value of all the leafs below and blend it to get the value of a parent node. This is called in the get() method when it has been determined that the leafs are deeper than the requested key.
Definition at line 813 of file ImageContainerByHashTree.ih.
References DGtal::Morton< THashKey, TPoint >::childrenKeys(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNode(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getObject(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myMorton, and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myN.
DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::BOOST_CONCEPT_ASSERT | ( | (CDomain< TDomain >) | ) |
domain
DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::BOOST_CONCEPT_ASSERT | ( | (CLabel< TValue >) | ) |
values range
DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::BOOST_STATIC_ASSERT | ( | (boost::is_same< Domain, HyperRectDomain< SpaceND< dimension, Integer > > >::value) | ) |
domain should be rectangular
bool DGtal::ImageContainerByHashTree< Domain, Value, HashKey >::checkIntegrity | ( | HashKey | key = ROOT_KEY , |
bool | leafAbove = false |
||
) | const |
Checks recursively that the sub-tree starting with key is valid. A tree is valid if there's one (and only one) leaf for each position at maximal depth.
key | the key |
leafAbove |
Definition at line 836 of file ImageContainerByHashTree.ih.
References DGtal::Bits::bitString(), DGtal::Morton< THashKey, TPoint >::childrenKeys(), DGtal::Trace::error(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getKeyDepth(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNode(), DGtal::Trace::info(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::isKeyValid(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myMorton, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myN, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myTreeDepth, and DGtal::trace.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::isValid().
|
inline |
Default drawing style object.
Definition at line 806 of file ImageContainerByHashTree.ih.
|
inline |
Copy contructor.
other | object to copy. Assignment. |
other | object to copy. Destructor Free the memory allocated by myData |
Definition at line 194 of file ImageContainerByHashTree.ih.
|
inline |
Returns an iterator to the last value as stored in the container.
Definition at line 550 of file ImageContainerByHashTree.h.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myArraySize, and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myData.
|
inline |
Returns the value corresponding to a key.
This is the generic method working with any valid key. For efficiency no check is performed on the key so be careful when calling this method. If the leafs are deeper than the requested key, this method will recursively browse through the children nodes and compute a average of each child's value using blendChildren(..) which is very slow. Thus performances are much better when accessing a leaf from a deeper key (needs no blending).
key | the haskkey |
Definition at line 322 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getObject().
|
inline |
Returns the value at a given coordinate using upwardGet().
aPoint | The point |
Definition at line 369 of file ImageContainerByHashTree.ih.
|
inline |
Returns The average number of collisions in the hash table, without counting the empty places.
Definition at line 757 of file ImageContainerByHashTree.ih.
References DGtal::Trace::error(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNbNodes(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myData, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myKeySize, and DGtal::trace.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInfo(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInternalState().
|
inline |
Definition at line 539 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::dim, and DGtal::Bits::mask().
|
inline |
Returns the tree's depth.
Definition at line 371 of file ImageContainerByHashTree.h.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myTreeDepth.
|
inlineprotected |
This is part of the hash function. It is called whenever a key is accessed. The mask used to compute the result is precomputed in the constructor for efficiency.
key | a node in the hashtree. |
Definition at line 418 of file ImageContainerByHashTree.ih.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::addNode(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNode(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::removeNode().
|
inline |
Definition at line 401 of file ImageContainerByHashTree.ih.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInternalState().
|
inline |
Definition at line 525 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::dim.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::checkIntegrity(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::isKeyValid(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printTree().
|
inline |
Returns the highest number of collisions in the hash table.
Definition at line 784 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNbNodes(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myData, and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myKeySize.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInfo(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInternalState().
|
inline |
Returns the number of empty places in the hash table.
Definition at line 741 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myData, and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myKeySize.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInfo(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInternalState().
|
inline |
Returns the number of elements for a given key of the hash table.
intermediateKey | a hashtree key. |
Definition at line 702 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getNext(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myData.
|
inline |
Returns the total amount of elements in the container.
Definition at line 726 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myKeySize.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getAverageCollisions(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getMaxCollisions(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInfo(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInternalState().
|
inline |
Returns a pointer to the node corresponding to the key. If it does'nt exist, returns 0. This method is called VERY often, and thus should operate as fast as possible.
key | The key. |
Definition at line 695 of file ImageContainerByHashTree.h.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getIntermediateKey(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getKey(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getNext(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myData.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::addNode(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::blendChildren(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::checkIntegrity(), DGtal::Display2DFactory::drawImageRecursive(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printTree().
|
inline |
Returns the size of a dimension (the container represents a line, a square, a cube, etc. depending on the dimmension so no need for distinctions between width, height, ect.)
Definition at line 362 of file ImageContainerByHashTree.h.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::mySpanSize.
Referenced by DGtal::Display2DFactory::drawImageHashTree(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInfo(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInternalState().
|
inline |
Returns true if the key is valid. A key is valid if the the most important bit that is equal to 1 is at a position of the type dim*k with dim the dimmension of the container (template parameter) and k a strictly positive integer.
key | the key |
Definition at line 570 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::dim, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getKeyDepth(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myTreeDepth.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::checkIntegrity().
|
inline |
Definition at line 557 of file ImageContainerByHashTree.h.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::checkIntegrity().
|
inline |
Returns the value at a given key.
key | the hash key used as an index. |
Definition at line 309 of file ImageContainerByHashTree.ih.
|
inline |
Returns the value at a given point.
aPoint | The point |
Definition at line 315 of file ImageContainerByHashTree.ih.
|
inline |
Definition at line 212 of file ImageContainerByHashTree.ih.
|
inline |
Prints informations about the state of the container without displaying the data:
- Nunber of elements in the tree. - Amount of unused disk space due to blanks in the hash table. - The dimmension. - The number of bits of the HashKey. - The size of the image. - The average and the maximum amount of collisions. - The total memory usage.
out | output stream. |
Definition at line 683 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::dim, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getAverageCollisions(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getMaxCollisions(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNbEmptyLists(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNbNodes(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getSpanSize(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myKeySize, and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myTreeDepth.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::selfDisplay().
|
inline |
Prints the state of the container in a way that displays the hash table and every node as it is stored in memory instead of the usual tree representation.
out | output stream. |
nbBits |
Definition at line 641 of file ImageContainerByHashTree.ih.
References DGtal::Bits::bitString(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::dim, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getAverageCollisions(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getKey(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getMaxCollisions(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNbEmptyLists(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNbNodes(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getNext(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getObject(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getSpanSize(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myData, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myDepthMask, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myKeySize, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myN, and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myTreeDepth.
|
inline |
Definition at line 597 of file ImageContainerByHashTree.ih.
References DGtal::Bits::bitString(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::dim, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myDepthMask, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myN, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myTreeDepth, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printTree(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::ROOT_KEY.
|
inline |
Prints the sub-tree starting with the node corresponding to key.
key | root of the subtree to display |
out | output stream. |
displayKeys | boolean to decide if keys are displayed . |
Definition at line 608 of file ImageContainerByHashTree.ih.
References DGtal::Bits::bitString(), DGtal::Morton< THashKey, TPoint >::childrenKeys(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getKeyDepth(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNode(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getObject(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myMorton, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myN, and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myTreeDepth.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printState().
|
inline |
Definition at line 203 of file ImageContainerByHashTree.ih.
|
protected |
|
inlineprotected |
Recusrively calls RemoveNode on the key and its children.
key | The key. |
nbRecursions | the number of recursions performed. |
Definition at line 489 of file ImageContainerByHashTree.ih.
References DGtal::Morton< THashKey, TPoint >::childrenKeys(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myMorton, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myN, and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::removeNode().
|
inlineprotected |
Remove the node corresponding to a key. Returns false if the node doesn't exist.
key | The key |
Definition at line 458 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getIntermediateKey(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getKey(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getNext(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myData, and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::setNext().
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::recursiveRemoveNode().
|
inline |
A attempt to do the same thing as get(HashKey) but looking for deeper leafs in the first place instead of doing this in the second place. It hasn't show better results so far.
key | The key. |
Definition at line 341 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getObject().
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 892 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInfo().
|
inlineprotected |
Set the (maximum) depth of the tree and precompute a mask used for some calculations. The depth of the tree must be known because accessing the data from coordinates depends on it.
depth | the maxumum depth. |
Definition at line 513 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::dim, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myDepthMask, DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::mySpanSize, and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myTreeDepth.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::ImageContainerByHashTree().
|
inline |
Sets the value of an element in the container, creating it if necessary. In order to keep the tree's coherence this method may add and remove several other nodes in the tree so performances strongly depend on wether or not and how much the tree's structure needs to be modified. For efficiency no check is performed on the key
key | The key |
object | The associated object |
Definition at line 230 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getObject().
|
inline |
Sets the value of an element in the container, creating it if necessary. In order to keep the tree's coherence this method may add and remove several other nodes in the tree so performances strongly depend on wether or not and how much the tree's structure needs to be modified. For efficiency no check is performed on the coordinates
key | The point |
object | the associated object |
Definition at line 221 of file ImageContainerByHashTree.ih.
|
inline |
Returns the value corresponding to a key making the assumption that the key is at same depth or deeper than the leaf we are looking for.
key | The key. |
Definition at line 378 of file ImageContainerByHashTree.ih.
References DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getKey(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getNext(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::Node::getObject().
|
static |
Definition at line 149 of file ImageContainerByHashTree.h.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getCoordinatesFromKey(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getKeyDepth(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::ImageContainerByHashTree(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::isKeyValid(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInfo(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInternalState(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printState(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::setDepth().
|
static |
static constants
Definition at line 148 of file ImageContainerByHashTree.h.
|
protected |
Definition at line 760 of file ImageContainerByHashTree.h.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::begin(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::end(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::ImageContainerByHashTree().
|
protected |
The array of linked lists containing all the data
Definition at line 751 of file ImageContainerByHashTree.h.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::addNode(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::begin(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::end(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getAverageCollisions(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getMaxCollisions(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNbEmptyLists(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNbNodes(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNode(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::ImageContainerByHashTree(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInternalState(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::removeNode().
int DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myDebugCounter |
Definition at line 395 of file ImageContainerByHashTree.h.
|
protected |
Precoputed masks to avoid recalculating it all the time
Definition at line 781 of file ImageContainerByHashTree.h.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInternalState(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printState(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::setDepth().
|
protected |
The image domain
Definition at line 746 of file ImageContainerByHashTree.h.
|
protected |
The size of the intermediate hashkey. The bigger the less collisions, but at the same time the more chances to have unused memory allocated.
Definition at line 758 of file ImageContainerByHashTree.h.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getAverageCollisions(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getMaxCollisions(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNbEmptyLists(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getNbNodes(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::ImageContainerByHashTree(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInfo(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInternalState().
Morton<HashKey, Point> DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myMorton |
The morton code computer.
Definition at line 786 of file ImageContainerByHashTree.h.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::blendChildren(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::checkIntegrity(), DGtal::Display2DFactory::drawImageRecursive(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printTree(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::recursiveRemoveNode().
|
staticprotected |
Definition at line 771 of file ImageContainerByHashTree.h.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::blendChildren(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::checkIntegrity(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInternalState(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printState(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printTree(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::recursiveRemoveNode().
Point DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::myOrigin |
Definition at line 775 of file ImageContainerByHashTree.h.
Referenced by DGtal::Display2DFactory::drawImageHashTree(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::ImageContainerByHashTree().
|
protected |
Definition at line 782 of file ImageContainerByHashTree.h.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::ImageContainerByHashTree().
|
protected |
Definition at line 767 of file ImageContainerByHashTree.h.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getSpanSize(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::setDepth().
|
protected |
The depth of the tree
Definition at line 765 of file ImageContainerByHashTree.h.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::checkIntegrity(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::getDepth(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::isKeyValid(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInfo(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printInternalState(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printState(), DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printTree(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::setDepth().
|
static |
Definition at line 150 of file ImageContainerByHashTree.h.
|
static |
Definition at line 151 of file ImageContainerByHashTree.h.
Referenced by DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::ImageContainerByHashTree(), and DGtal::ImageContainerByHashTree< TDomain, TValue, THashKey >::printState().