vtkLabelHierarchy Class Reference

#include <vtkLabelHierarchy.h>

Inheritance diagram for vtkLabelHierarchy:

Inheritance graph
[legend]
Collaboration diagram for vtkLabelHierarchy:

Collaboration graph
[legend]

List of all members.


Detailed Description

contains an octree of labels

This class represents labels in a hierarchy used to denote rendering priority. A binary tree of labels is maintained that subdivides the bounds of the of the label anchors spatially. Which level of the tree a label occupies determines its priority; those at higher levels of the tree will be more likely to render than those at lower levels of the tree.

Pass vtkLabelHierarchy objects to a vtkLabelPlacer filter for dynamic, non-overlapping, per-frame placement of labels.

Note that if we have a d-dimensional binary tree and we want a fixed number $n$ of labels in each node (all nodes, not just leaves), we can compute the depth of tree required assuming a uniform distribution of points. Given a total of $N$ points we know that $\frac{N}{|T|} = n$, where $|T|$ is the cardinality of the tree (i.e., the number of nodes it contains). Because we have a uniform distribution, the tree will be uniformly subdivided and thus $|T| = 1 + 2^d + \left(2^d\right)^2 + \cdots + \left(2^d\right)^k$, where $d$ is the dimensionality of the input points (fixed at 3 for now). As $k$ becomes large, $|T|\approx 2 \left(2^d\right)^k$. Using this approximation, we can solve for $k$:

\[ k = \frac{\log{\frac{N}{2n}}}{\log{2^d}} \]

Given a set of $N$ input label anchors, we'll compute $k$ and then bin the anchors into tree nodes at level $k$ of the tree. After this, all the nodes will be in the leaves of the tree and those leaves will be at the $k$-th level; no anchors will be in levels $1, 2, \ldots, k-1$. To fix that, we'll choose to move some anchors upwards. The exact number to move upwards depends on TargetLabelCount. We'll move as many up as required to have TargetLabelCount at each node.

You should avoid situations where MaximumDepth does not allow for TargetLabelCount or fewer entries at each node. The MaximumDepth is a hard limit while TargetLabelCount is a suggested optimum. You will end up with many more than TargetLabelCount entries per node and things will be sloooow.

Tests:
vtkLabelHierarchy (Tests)

Definition at line 76 of file vtkLabelHierarchy.h.


Public Types

typedef vtkPointSet Superclass
enum  IteratorType { FULL_SORT, QUEUE, DEPTH_FIRST, FRUSTUM }

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
virtual void PrintSelf (ostream &os, vtkIndent indent)
virtual void SetPoints (vtkPoints *)
virtual void ComputeHierarchy ()
void GetDiscreteNodeCoordinatesFromWorldPoint (int ijk[3], double pt[3], int level)
ImplementationGetImplementation ()
virtual void SetTargetLabelCount (int)
virtual int GetTargetLabelCount ()
virtual void SetMaximumDepth (int)
virtual int GetMaximumDepth ()
virtual void SetPriorities (vtkDataArray *arr)
virtual vtkDataArrayGetPriorities ()
vtkLabelHierarchyIteratorNewIterator (int type, vtkRenderer *ren, vtkCamera *cam, double frustumPlanes[24], bool positionsAsNormals, float bucketSize[2])
virtual vtkIdType GetNumberOfCells ()
virtual vtkCellGetCell (vtkIdType)
virtual void GetCell (vtkIdType, vtkGenericCell *)
virtual int GetCellType (vtkIdType)
virtual void GetCellPoints (vtkIdType, vtkIdList *)
virtual void GetPointCells (vtkIdType, vtkIdList *)
virtual vtkIdType FindCell (double *, vtkCell *, vtkIdType, double, int &, double *, double *)
virtual vtkIdType FindCell (double *, vtkCell *, vtkGenericCell *, vtkIdType, double, int &, double *, double *)
virtual int GetMaxCellSize ()
virtual vtkPointsGetCenterPts ()
virtual vtkCoincidentPointsGetCoincidentPoints ()

Static Public Member Functions

static vtkLabelHierarchyNew ()
static int IsTypeOf (const char *type)
static vtkLabelHierarchySafeDownCast (vtkObject *o)
static bool GetPathForNodalCoordinates (int *path, int ijk[3], int level)

Protected Member Functions

 vtkLabelHierarchy ()
virtual ~vtkLabelHierarchy ()

Protected Attributes

int TargetLabelCount
int MaximumDepth
vtkDataArrayPriorities
vtkCoincidentPointsCoincidentPoints
vtkPointsCenterPts
ImplementationImpl

Friends

class vtkLabelHierarchyFrustumIterator
class vtkLabelHierarchyFullSortIterator
class implementation

Classes

class  Implementation

Member Typedef Documentation

Reimplemented from vtkPointSet.

Definition at line 80 of file vtkLabelHierarchy.h.


Member Enumeration Documentation

Enumeration of iterator types.

Enumerator:
FULL_SORT 
QUEUE 
DEPTH_FIRST 
FRUSTUM 

Definition at line 106 of file vtkLabelHierarchy.h.


Constructor & Destructor Documentation

vtkLabelHierarchy::vtkLabelHierarchy (  )  [protected]

virtual vtkLabelHierarchy::~vtkLabelHierarchy (  )  [protected, virtual]


Member Function Documentation

static vtkLabelHierarchy* vtkLabelHierarchy::New (  )  [static]

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkDataObject.

virtual const char* vtkLabelHierarchy::GetClassName (  )  [virtual]

Reimplemented from vtkPointSet.

static int vtkLabelHierarchy::IsTypeOf ( const char *  name  )  [static]

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkPointSet.

virtual int vtkLabelHierarchy::IsA ( const char *  name  )  [virtual]

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkPointSet.

static vtkLabelHierarchy* vtkLabelHierarchy::SafeDownCast ( vtkObject o  )  [static]

Reimplemented from vtkPointSet.

virtual void vtkLabelHierarchy::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkPointSet.

virtual void vtkLabelHierarchy::SetPoints ( vtkPoints  )  [virtual]

Override SetPoints so we can reset the hierarchy when the points change.

Reimplemented from vtkPointSet.

virtual void vtkLabelHierarchy::ComputeHierarchy (  )  [virtual]

Fill the hierarchy with the input labels.

virtual void vtkLabelHierarchy::SetTargetLabelCount ( int   )  [virtual]

The number of labels that is ideally present at any octree node. It is best if this is a multiple of $2^d$.

virtual int vtkLabelHierarchy::GetTargetLabelCount (  )  [virtual]

The number of labels that is ideally present at any octree node. It is best if this is a multiple of $2^d$.

virtual void vtkLabelHierarchy::SetMaximumDepth ( int   )  [virtual]

The maximum depth of the octree.

virtual int vtkLabelHierarchy::GetMaximumDepth (  )  [virtual]

The maximum depth of the octree.

virtual void vtkLabelHierarchy::SetPriorities ( vtkDataArray arr  )  [virtual]

Set/get the array specifying the importance (priority) of each label.

virtual vtkDataArray* vtkLabelHierarchy::GetPriorities (  )  [virtual]

Set/get the array specifying the importance (priority) of each label.

vtkLabelHierarchyIterator* vtkLabelHierarchy::NewIterator ( int  type,
vtkRenderer ren,
vtkCamera cam,
double  frustumPlanes[24],
bool  positionsAsNormals,
float  bucketSize[2] 
)

Returns an iterator for this data object. positionsAsNormals should only be true when labels are on a sphere centered at the origin (3D world).

Parameters:
type - the type should be one of FULL_SORT, QUEUE, DEPTH_FIRST, or FRUSTUM.
ren - the current renderer (used for viewport information)
cam - the current camera.
frustumPlanes - should be the output of the camera's frustum planes.
positionsAsNormals - throws out octree nodes on the opposite side of the origin.
bucketSize - an array of 2 integers describing the width and height of label placer buckets.

void vtkLabelHierarchy::GetDiscreteNodeCoordinatesFromWorldPoint ( int  ijk[3],
double  pt[3],
int  level 
)

Given a depth in the hierarchy (level) and a point pt in world space, compute ijk. This is used to find other octree nodes at the same level that are within the search radius for candidate labels to be placed. It is called with pt set to the camera eye point and pythagorean quadruples increasingly distant from the origin are added to ijk to identify octree nodes whose labels should be placed.

Parameters:
[out] ijk - discrete coordinates of the octree node at level containing pt.
[in] pt - input world point coordinates
[in] level - input octree level to be considered

static bool vtkLabelHierarchy::GetPathForNodalCoordinates ( int *  path,
int  ijk[3],
int  level 
) [static]

Given a level of the tree and ijk coordinates in a lattice, compute a path down the tree to reach the corresponding lattice node. If the lattice coordinates are outside the tree, this returns false. Otherwise it returns true. This does not guarantee that the path exists in the hierarchy.

Parameters:
[out] path - a vector of level integers specifying which child to descend at each level to reach ijk
[in] ijk - discrete coordinates of the octree node at level
[in] level - input octree level to be considered

virtual vtkIdType vtkLabelHierarchy::GetNumberOfCells (  )  [virtual]

Inherited members (from vtkDataSet)

Implements vtkDataSet.

virtual vtkCell* vtkLabelHierarchy::GetCell ( vtkIdType   )  [virtual]

Inherited members (from vtkDataSet)

Implements vtkDataSet.

virtual void vtkLabelHierarchy::GetCell ( vtkIdType  ,
vtkGenericCell  
) [virtual]

Inherited members (from vtkDataSet)

Implements vtkDataSet.

virtual int vtkLabelHierarchy::GetCellType ( vtkIdType   )  [virtual]

Inherited members (from vtkDataSet)

Implements vtkDataSet.

virtual void vtkLabelHierarchy::GetCellPoints ( vtkIdType  ,
vtkIdList  
) [virtual]

Inherited members (from vtkDataSet)

Implements vtkDataSet.

virtual void vtkLabelHierarchy::GetPointCells ( vtkIdType  ,
vtkIdList  
) [virtual]

Inherited members (from vtkDataSet)

Implements vtkDataSet.

virtual vtkIdType vtkLabelHierarchy::FindCell ( double *  ,
vtkCell ,
vtkIdType  ,
double  ,
int &  ,
double *  ,
double *   
) [virtual]

Inherited members (from vtkDataSet)

virtual vtkIdType vtkLabelHierarchy::FindCell ( double *  ,
vtkCell ,
vtkGenericCell ,
vtkIdType  ,
double  ,
int &  ,
double *  ,
double *   
) [virtual]

Inherited members (from vtkDataSet)

virtual int vtkLabelHierarchy::GetMaxCellSize (  )  [virtual]

Inherited members (from vtkDataSet)

Implements vtkDataSet.

Implementation* vtkLabelHierarchy::GetImplementation (  )  [inline]

Definition at line 173 of file vtkLabelHierarchy.h.

virtual vtkPoints* vtkLabelHierarchy::GetCenterPts (  )  [virtual]

Provide access to original coordinates of sets of coincident points

virtual vtkCoincidentPoints* vtkLabelHierarchy::GetCoincidentPoints (  )  [virtual]

Provide access to the set of coincident points that have been perturbed by the hierarchy in order to render labels for each without overlap.


Friends And Related Function Documentation

friend class vtkLabelHierarchyFrustumIterator [friend]

Definition at line 201 of file vtkLabelHierarchy.h.

friend class vtkLabelHierarchyFullSortIterator [friend]

Definition at line 202 of file vtkLabelHierarchy.h.

friend class implementation [friend]

Definition at line 203 of file vtkLabelHierarchy.h.


Member Data Documentation

Definition at line 192 of file vtkLabelHierarchy.h.

Definition at line 193 of file vtkLabelHierarchy.h.

Definition at line 194 of file vtkLabelHierarchy.h.

Definition at line 195 of file vtkLabelHierarchy.h.

Definition at line 196 of file vtkLabelHierarchy.h.

Definition at line 199 of file vtkLabelHierarchy.h.


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

Generated on Wed Jun 3 19:14:43 2009 for VTK by  doxygen 1.5.6