#include <vtkLabelHierarchy.h>
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 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 points we know that , where 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 , where is the dimensionality of the input points (fixed at 3 for now). As becomes large, . Using this approximation, we can solve for :
Given a set of input label anchors, we'll compute and then bin the anchors into tree nodes at level of the tree. After this, all the nodes will be in the leaves of the tree and those leaves will be at the -th level; no anchors will be in levels . 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.
Definition at line 76 of file vtkLabelHierarchy.h.
Enumeration of iterator types.
Definition at line 106 of file vtkLabelHierarchy.h.
vtkLabelHierarchy::vtkLabelHierarchy | ( | ) | [protected] |
virtual vtkLabelHierarchy::~vtkLabelHierarchy | ( | ) | [protected, virtual] |
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 .
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 .
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).
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.
[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.
[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.
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.
Inherited members (from vtkDataSet)
Implements vtkDataSet.
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.
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.
int vtkLabelHierarchy::TargetLabelCount [protected] |
Definition at line 192 of file vtkLabelHierarchy.h.
int vtkLabelHierarchy::MaximumDepth [protected] |
Definition at line 193 of file vtkLabelHierarchy.h.
vtkDataArray* vtkLabelHierarchy::Priorities [protected] |
Definition at line 194 of file vtkLabelHierarchy.h.
vtkCoincidentPoints* vtkLabelHierarchy::CoincidentPoints [protected] |
Definition at line 195 of file vtkLabelHierarchy.h.
vtkPoints* vtkLabelHierarchy::CenterPts [protected] |
Definition at line 196 of file vtkLabelHierarchy.h.
Implementation* vtkLabelHierarchy::Impl [protected] |
Definition at line 199 of file vtkLabelHierarchy.h.