ImFusion SDK 4.3
Tree Class Reference

#include <ImFusion/Base/Tree.h>

Data structure for trees. More...

+ Inheritance diagram for Tree:

Detailed Description

Data structure for trees.

Public Member Functions

 Tree (const Tree &)
 
Treeoperator= (const Tree &)
 
void clear ()
 
void setFilename (const std::string &name)
 Sets a filename from where this tree can be loaded.
 
const std::stringfilename () const
 Returns the filename from where this tree can be loaded or an empty string if it's not on disk.
 
Kind kind () const override
 Return the kind of this data.
 
Geometry::AlignedBox bounds () const override
 Returns the axis-aligned bounding box of this data in world space.
 
vec3 center () const
 Returns the center in object space.
 
vec3 extent () const
 Returns the extent in object space.
 
const mat4 & matrixRef () const
 
Pose::TransformationConvention matrixConvention () const override
 Matrices of trees map to world coordinate system.
 
bool isAnnotationType () const override
 Return whether this data type is visualized through an annotation (e.g. mesh)
 
void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
 
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.
 
virtual NodeaddNode (std::unique_ptr< Node > node, Node *parent)
 Insert node below parent into tree Returns a non-owning pointer to the node if node is added successfully, nullptr otherwise (probably due to invalid parent).
 
void addTreeAsNode (Node *node, std::unique_ptr< Tree > tree)
 Add tree as a child-node to node.
 
void removeNode (Node *node)
 Remove node and all its children. Deletes all affected nodes.
 
bool containsNode (Node *node) const
 Returns true if the tree contains the specified node.
 
bool containsNode (Node *parentNode, Node *possibleChildNode) const
 Check whether parentNode contains possibleChildNode as a child somewhere down the tree.
 
virtual std::unique_ptr< TreedetachNode (Node *node)
 Detach a node with all its children, and form a new tree from it.
 
void detachNode (Tree &tree, Node *node)
 Detach a node with all its children, and fill a tree from it.
 
void changeRoot (Node *rootNode)
 Change root of the tree to rootNode. rootNode must be a part of the tree.
 
Nodenode (int id) const
 Get node through its id.
 
Noderoot () const
 Get root node.
 
std::vector< Node * > children (Node *node) const
 Get child nodes.
 
Nodeparent (Node *node) const
 Get parent node.
 
int nodeLevel (Node *node) const
 get level of the node (root being 0, its children 1 and so on)
 
void traverse (std::function< void(Node *, int level)> fcn, bool breadthFirst, int maxLevel=-1)
 Function which traverses the tree using breadth-first approach (if flag breadthFirst is set to true), or depth-first approach (if flag breadthFirst is set to false).
 
virtual std::string typeName () const
 
int size () const
 Return number of nodes in the tree.
 
bool empty () const
 Check whether tree is empty.
 
- Public Member Functions inherited from Data
 Data (const std::string &name="")
 
 Data (const Data &other)
 
Dataoperator= (const Data &other)
 
virtual ~Data ()
 Mandatory virtual destructor.
 
virtual Modality modality () const
 Return the modality of this data.
 
const std::stringname () const
 Return the name of this data.
 
void setName (const std::string &name)
 Sets the name of this data.
 
const DataComponentListcomponents () const
 Returns the list of DataComponents for this data.
 
DataComponentListcomponents ()
 
virtual std::string describe () const
 Human readable description of the data for showing in the info bar.
 
virtual void setMatrixFromWorld (const mat4 &m)
 Set matrix mapping from the world coordinate system to the data coordinate system.
 
virtual void setMatrixToWorld (const mat4 &m)
 Set matrix mapping from the data coordinate system to the world coordinate system.
 
virtual mat4 matrixFromWorld () const
 Get matrix mapping from the world coordinate system to the data coordinate system.
 
virtual mat4 matrixToWorld () const
 Get matrix mapping from the data coordinate system to the world coordinate system.
 
virtual mat4 matrix () const
 Return the transformation matrix.
 
virtual void setMatrix (const mat4 &m)
 Set the transformation matrix.
 
- Public Member Functions inherited from Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 

Protected Attributes

std::unordered_map< int, std::unique_ptr< Node > > m_nodes
 
std::string m_filename
 
int m_idCounter
 
- Protected Attributes inherited from Data
mat4 m_matrix
 Transformation matrix.
 
std::recursive_mutexm_matrixMutex
 Used to internally synchronize access to the matrix of data.
 
DataComponentList m_dataComponentList
 The list of DataComponents for this data.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Additional Inherited Members

- Public Types inherited from Data
enum  Kind {
  UNKNOWN = 0 , IMAGE = 1 , VOLUME = 2 , IMAGESET = 3 ,
  VOLUMESET = 4 , IMAGESTREAM = 5 , VOLUMESTREAM = 6 , POINTSET = 7 ,
  SURFACE = 8 , TRACKINGSTREAM = 9 , LIVETRACKINGSTREAM = TRACKINGSTREAM , TRACKINGDATA = 10 ,
  TREE = 11 , TENSOR = 12 , POLYDATASTREAM = 13 , STEREOIMAGESET = 14 ,
  STEREOIMAGESTREAM = 15 , VOLUMETRICMESH = 16
}
 Kind of data. More...
 
enum  Modality {
  NA = 0 , XRAY = 1 , CT = 2 , MRI = 3 ,
  ULTRASOUND = 4 , VIDEO = 5 , NM = 6 , OCT = 7 ,
  LABEL = 8 , DISTANCE = 9
}
 Image modality of the data. More...
 
- Static Public Member Functions inherited from Data
static std::string modalityString (Data::Modality m)
 Return the name of an image modality.
 
static Data::Modality stringToModality (const std::string &s)
 Returns the modality corresponding to a modality string or NA if nothing matches.
 
- Public Attributes inherited from Data
Signal< const Data * > signalDeleted
 Signal emitted when this instance is deleted.
 
Signal< const Data * > signalMatrixChanged
 Signal emitted when the transformation of this Data has changed.
 
Signal< std::stringsignalNameChanged
 Signal emitted when the name changed.
 
- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 
- Protected Member Functions inherited from Data
void swapWith (Data &other)
 Swaps the data and emits a matrix and name changed signal for both.
 

Member Function Documentation

◆ kind()

Kind kind ( ) const
overridevirtual

Return the kind of this data.

Implements Data.

◆ bounds()

Geometry::AlignedBox bounds ( ) const
overridevirtual

Returns the axis-aligned bounding box of this data in world space.

Implements Data.

◆ matrixConvention()

Pose::TransformationConvention matrixConvention ( ) const
overridevirtual

Matrices of trees map to world coordinate system.

Implements Data.

◆ isAnnotationType()

bool isAnnotationType ( ) const
inlineoverridevirtual

Return whether this data type is visualized through an annotation (e.g. mesh)

Reimplemented from Data.

◆ configure()

void configure ( const Properties * p)
overridevirtual

Configure this object instance by de-serializing the given Properties.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configuration() for the inverse functionality

Reimplemented from Configurable.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Serialize the current object configuration into the given Properties object.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configure() for the inverse functionality

Reimplemented from Configurable.

◆ addNode()

virtual Node * addNode ( std::unique_ptr< Node > node,
Node * parent )
virtual

Insert node below parent into tree Returns a non-owning pointer to the node if node is added successfully, nullptr otherwise (probably due to invalid parent).

nullptr parent means that the node should become the root of the tree. If tree already has a root, the node will not be added.

Reimplemented in KeyTree, PointTree, TypedTree< T >, TypedTree< std::string >, TypedTree< std::vector< int > >, and TypedTree< vec3 >.

◆ detachNode()

virtual std::unique_ptr< Tree > detachNode ( Node * node)
virtual

Detach a node with all its children, and form a new tree from it.

Reimplemented in KeyTree, PointTree, TypedTree< T >, TypedTree< std::string >, TypedTree< std::vector< int > >, and TypedTree< vec3 >.

◆ traverse()

void traverse ( std::function< void(Node *, int level)> fcn,
bool breadthFirst,
int maxLevel = -1 )

Function which traverses the tree using breadth-first approach (if flag breadthFirst is set to true), or depth-first approach (if flag breadthFirst is set to false).

During a traversal, fcn is applied to a newly visited node maxLevel specifies maximum level for traversal. -1 means that all the levels must be traversed

◆ typeName()

virtual std::string typeName ( ) const
virtual

Reimplemented in KeyTree.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close