Skip to content

shapeworks::PowerOfTwoPointTree

More...

#include <PowerOfTwoPointTree.h>

Inherits from itk::DataObject

Public Types

Name
typedef PowerOfTwoPointTree Self
typedef DataObject Superclass
typedef itk::SmartPointer< Self > Pointer
typedef itk::SmartPointer< const Self > ConstPointer
typedef itk::WeakPointer< const Self > ConstWeakPointer
typedef PowerOfTwoPointTreeNode NodeType
typedef NodeType::Pointer NodePointerType
typedef PowerOfTwoPointTreeNode::PointType PointType
typedef NodeType::PointListType PointListType
typedef std::vector< typename PointListType::const_iterator > PointIteratorListType

Public Functions

Name
itkNewMacro(Self )
itkTypeMacro(PowerOfTwoPointTree , DataObject )
itkStaticConstMacro(Dimension , unsigned int , VDimension )
itkStaticConstMacro(BranchesPerNode , int , (powstruct< 2, VDimension >::c) )
itkGetMacro(Depth , unsigned int )
void ConstructTree(const PointType & , const PointType & , unsigned int )
PointIteratorListType FindPointsInRegion(const PointType & , const PointType & ) const
unsigned int FindPointsInRegion(const PointType & , const PointType & , PointIteratorListType & ) const
NodePointerType GetNode(const PointType & )
const NodePointerType GetNode(const PointType & ) const
itkGetObjectMacro(Root , NodeType )
itkSetObjectMacro(Root , NodeType )
PointListType::iterator AddPoint(const PointType & , unsigned int , NodePointerType & )
PointListType::iterator AddPoint(const PointType & p, unsigned int i)
bool Overlap(const NodePointerType & , const PointType & , const PointType & ) const
bool RegionContains(const PointType & p, const PointType & lowerbound, const PointType & upperbound) const
void PrintSelf(std::ostream & os, itk::Indent indent) const

Protected Functions

Name
PowerOfTwoPointTree()
virtual ~PowerOfTwoPointTree()
void BranchNode(NodePointerType & , unsigned int )
void FindOneNodeInRegion(const NodePointerType & , const PointType & , const PointType & , PointIteratorListType & ) const

Public Attributes

Name
constexpr static unsigned int VDimension

Detailed Description

class shapeworks::PowerOfTwoPointTree;

A tree data container, templated over node type, whose nodes are associated with bounding boxes in a rectangular domain, and that has 2^D branches at each node, where D is the dimensionality of the domain. In 2D this is a quad-tree, and in 3D this is an octree, etc. The tree is constructed by specifying a region and a tree depth, then calling ConstructTree(). This class was designed for use as a quad/octree binning structure for ParticleNeighborhoodr.h classes.

Public Types Documentation

typedef Self

typedef PowerOfTwoPointTree shapeworks::PowerOfTwoPointTree::Self;

Standard class typedefs

typedef Superclass

typedef DataObject shapeworks::PowerOfTwoPointTree::Superclass;

typedef Pointer

typedef itk::SmartPointer<Self> shapeworks::PowerOfTwoPointTree::Pointer;

typedef ConstPointer

typedef itk::SmartPointer<const Self> shapeworks::PowerOfTwoPointTree::ConstPointer;

typedef ConstWeakPointer

typedef itk::WeakPointer<const Self> shapeworks::PowerOfTwoPointTree::ConstWeakPointer;

typedef NodeType

typedef PowerOfTwoPointTreeNode shapeworks::PowerOfTwoPointTree::NodeType;

Shorthand for the object pointed to by each node.

typedef NodePointerType

typedef NodeType::Pointer shapeworks::PowerOfTwoPointTree::NodePointerType;

The real node type, which is a actually pointer to what we are calling NodeTypes.

typedef PointType

typedef PowerOfTwoPointTreeNode::PointType shapeworks::PowerOfTwoPointTree::PointType;

Point type used by nodes for upper and lower bounds.

typedef PointListType

typedef NodeType::PointListType shapeworks::PowerOfTwoPointTree::PointListType;

Types defined by the NodeType.

typedef PointIteratorListType

typedef std::vector<typename PointListType::const_iterator> shapeworks::PowerOfTwoPointTree::PointIteratorListType;

Public Functions Documentation

function itkNewMacro

itkNewMacro(
    Self 
)

Method for creation through the object factory.

function itkTypeMacro

itkTypeMacro(
    PowerOfTwoPointTree ,
    DataObject 
)

Run-time type information (and related methods).

function itkStaticConstMacro

itkStaticConstMacro(
    Dimension ,
    unsigned int ,
    VDimension 
)

Dimensionality of the domain.

function itkStaticConstMacro

itkStaticConstMacro(
    BranchesPerNode ,
    int ,
    (powstruct< 2, VDimension >::c) 
)

Number of children per node.

function itkGetMacro

itkGetMacro(
    Depth ,
    unsigned int 
)

Set/Get the depth of the tree. This is the number of levels in the tree.

function ConstructTree

void ConstructTree(
    const PointType & ,
    const PointType & ,
    unsigned int 
)

Construct the tree to the specified depth. The bounding box of the root node is specified with the lower bound and upper bound points respectively.

function FindPointsInRegion

PointIteratorListType FindPointsInRegion(
    const PointType & ,
    const PointType & 
) const

Return a list of PointListType iterators (effectively pointers to points, see PowerOfTwoPointTreeNode) to points and their associated indicies that are stored in this tree and are contained within the specified bounding box region. The bounding box is specified with two points, in this order: a lower bound followed by an upper bound.

function FindPointsInRegion

unsigned int FindPointsInRegion(
    const PointType & ,
    const PointType & ,
    PointIteratorListType & 
) const

function GetNode

NodePointerType GetNode(
    const PointType & 
)

Return the node associated with the domain region that contains the given point.

function GetNode

const NodePointerType GetNode(
    const PointType & 
) const

function itkGetObjectMacro

itkGetObjectMacro(
    Root ,
    NodeType 
)

Set/Get the root node of the tree.

function itkSetObjectMacro

itkSetObjectMacro(
    Root ,
    NodeType 
)

function AddPoint

PointListType::iterator AddPoint(
    const PointType & ,
    unsigned int ,
    NodePointerType & 
)

Associates a point and, optionally, an index with the appropriate leaf node. This method starts at the root of the tree and uses the Contains method to query branches at each node, following the first branch it finds whose bounding box contains this point. When it reaches a leaf node, the point is added to that node's list, along with the specified index (if any). This method returns an iterator pointing to the new list element (e.g., for quick deletion or reference of the point) and, optionally, will set a given smart pointer to point to the leaf node. If the specified point is not contained within the domain, then this method will throw an exception.

function AddPoint

inline PointListType::iterator AddPoint(
    const PointType & p,
    unsigned int i
)

function Overlap

bool Overlap(
    const NodePointerType & ,
    const PointType & ,
    const PointType & 
) const

Returns true if the specified node region overlaps the given region and false otherwise.

function RegionContains

inline bool RegionContains(
    const PointType & p,
    const PointType & lowerbound,
    const PointType & upperbound
) const

function PrintSelf

void PrintSelf(
    std::ostream & os,
    itk::Indent indent
) const

Protected Functions Documentation

function PowerOfTwoPointTree

inline PowerOfTwoPointTree()

function ~PowerOfTwoPointTree

inline virtual ~PowerOfTwoPointTree()

function BranchNode

void BranchNode(
    NodePointerType & ,
    unsigned int 
)

Add the appropriate number of empty child nodes to a given node. The second parameter is the level in the tree.

function FindOneNodeInRegion

void FindOneNodeInRegion(
    const NodePointerType & ,
    const PointType & ,
    const PointType & ,
    PointIteratorListType & 
) const

Find one of the nodes that overlaps the specified region and appends all of its points to the specified list. The method is used by FindPointsInRegion and is called recursively.

Public Attributes Documentation

variable VDimension

static constexpr static unsigned int VDimension = 3;

Updated on 2024-03-17 at 12:58:44 -0600