32#if defined(ImageContainerByHashTree_RECURSES)
33#error Recursive header files inclusion detected in ImageContainerByHashTree.h
36#define ImageContainerByHashTree_RECURSES
38#if !defined ImageContainerByHashTree_h
40#define ImageContainerByHashTree_h
45#include "DGtal/base/Common.h"
46#include "DGtal/base/CLabel.h"
47#include "DGtal/base/ConstRangeAdapter.h"
48#include "DGtal/images/DefaultConstImageRange.h"
49#include "DGtal/images/DefaultImageRange.h"
51#include "DGtal/kernel/domains/CDomain.h"
52#include "DGtal/kernel/domains/HyperRectDomain.h"
53#include "DGtal/kernel/SpaceND.h"
54#include "DGtal/base/Bits.h"
55#include "DGtal/images/Morton.h"
56#include "DGtal/images/SetValueIterator.h"
57#include "DGtal/io/Color.h"
58#include "DGtal/base/ExpressionTemplates.h"
63 namespace experimental
127 template <
typename TDomain,
typename TValue,
typename THashKey =
typename DGtal::u
int64_t >
193 const unsigned int depth,
194 const Value defaultValue);
217 const Value defaultValue);
236 const unsigned int hashKeySize = 3,
440 void printState(std::ostream& out,
bool displayKeys =
false)
const;
609 template <
typename C>
705 n->getObject() = object;
709 n =
new Node(
object, key);
729 if (iter->
getKey() == key)
826 template<
typename TDomain,
typename TValue,
typename THashKey >
830 object.selfDisplay( out);
840#include "DGtal/images/ImageContainerByHashTree.ih"
847#undef ImageContainerByHashTree_RECURSES
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: model of CConstBidirectionalRangeFromPoint that adapts the domain of an image in order to iterat...
Aim: model of CConstBidirectionalRangeFromPoint and CBidirectionalRangeWithWritableIteratorFromPoint ...
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Space::Dimension Dimension
Aim: Implements the binary Morton code construction in nD.
Aim: implements an output iterator, which is able to write values in an underlying image,...
Built-in iterator on an HashTree. This iterator visits all node in the tree.
Iterator(Node **data, unsigned int position, unsigned int arraySize)
unsigned int myCurrentCell
bool operator==(const Iterator &it)
bool operator!=(const Iterator &it)
Node(Value aValue, HashKey key)
Model of CImageContainer implementing the association key<->Value using a hash tree....
void setDepth(unsigned int depth)
const Domain & domain() const
bool checkIntegrity(HashKey key=ROOT_KEY, bool leafAbove=false) const
HashKey getKey(const Point &aPoint) const
Value get(const Point &aPoint) const
bool removeNode(HashKey key)
Node * addNode(const Value object, const HashKey key)
const Node **& data() const noexcept
Morton< HashKey, Point > myMorton
The morton code computer.
unsigned int getKeyDepth(HashKey key) const
Value reverseGet(const HashKey key) const
std::string className() const
BOOST_STATIC_CONSTANT(Dimension, dimension=Domain::dimension)
static constants
HashKey myPreComputedIntermediateMask
Domain::Dimension Dimension
ImageContainerByHashTree(const unsigned int hashKeySize, const Point &p1, const Point &p2, const Value defaultValue)
Value operator()(const Point &aPoint) const
void setValue(const Point &aPoint, const Value object)
ImageContainerByHashTree(const Domain &aDomain, const unsigned int hashKeySize=3, const Value defaultValue=NumberTraits< Value >::ZERO)
unsigned int getNbNodes() const
ImageContainerByHashTree(const unsigned int hashKeySize, const unsigned int depth, const Value defaultValue)
HashKey getIntermediateKey(const HashKey key) const
ConstRange constRange() const
BOOST_STATIC_CONSTANT(Dimension, dim=Domain::dimension)
const Self & container() const
BOOST_CONCEPT_ASSERT((concepts::CDomain< TDomain >))
domain
DefaultConstImageRange< Self > ConstRange
BOOST_STATIC_CONSTANT(unsigned int, myN=NbChildrenPerNode)
void recursiveDraw(HashKey key, const double p1[2], const double len, Board2D &board, const C &cmap) const
void printInfo(std::ostream &out) const
BOOST_STATIC_CONSTANT(HashKey, ROOT_KEY=static_cast< THashKey >(1))
void selfDisplay(std::ostream &out) const
BOOST_CONCEPT_ASSERT((concepts::CLabel< TValue >))
values range
Value blendChildren(HashKey key) const
unsigned int getSpanSize() const
Value operator()(const HashKey key) const
Value get(const HashKey key) const
unsigned int getDepth() const
BOOST_STATIC_CONSTANT(unsigned int, NbChildrenPerNode=PowHelper::VALUE)
Value upwardGet(const HashKey key) const
unsigned int getNbEmptyLists() const
void recursiveRemoveNode(HashKey key, unsigned int nbRecursions)
SetValueIterator< Self > OutputIterator
output iterator
POW< 2, dimension > PowHelper
unsigned int getMaxCollisions() const
BOOST_STATIC_ASSERT((boost::is_same< Domain, HyperRectDomain< typename Domain::Space > >::value))
domain should be rectangular
void printInternalState(std::ostream &out, unsigned int nbBits=0) const
double getAverageCollisions() const
void printState(std::ostream &out, bool displayKeys=false) const
ImageContainerByHashTree< TDomain, TValue, THashKey > Self
void printTree(HashKey key, std::ostream &out, bool displayKeys) const
Node * getNode(const HashKey key) const
bool isKeyValid(HashKey key) const
void setValue(const HashKey key, const Value object)
int * getCoordinatesFromKey(HashKey key) const
unsigned int getNbNodes(unsigned int intermediateKey) const
DefaultImageRange< Self > Range
std::ostream & operator<<(std::ostream &out, const ImageContainerByHashTree< TDomain, TValue, THashKey > &object)
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: The traits class for all models of Cinteger.
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Aim: Define the concept of DGtal labels. Models of CLabel can be default-constructible,...