![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/Tree.h>
Data structure for trees. More...
Data structure for trees.
Public Member Functions | |
Tree (const Tree &) | |
Tree & | operator= (const Tree &) |
void | clear () |
void | setFilename (const std::string &name) |
Sets a filename from where this tree can be loaded. | |
const std::string & | filename () 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 Node * | addNode (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< Tree > | detachNode (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. | |
Node * | node (int id) const |
Get node through its id. | |
Node * | root () const |
Get root node. | |
std::vector< Node * > | children (Node *node) const |
Get child nodes. | |
Node * | parent (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. | |
![]() | |
Data (const std::string &name="") | |
Data (const Data &other) | |
Data & | operator= (const Data &other) |
virtual | ~Data () |
Mandatory virtual destructor. | |
virtual Modality | modality () const |
Return the modality of this data. | |
const std::string & | name () const |
Return the name of this data. | |
void | setName (const std::string &name) |
Sets the name of this data. | |
const DataComponentList & | components () const |
Returns the list of DataComponents for this data. | |
DataComponentList & | components () |
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. | |
![]() | |
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 | |
Configurable & | operator= (const Configurable &) |
Configurable & | operator= (Configurable &&) noexcept |
Protected Attributes | |
std::unordered_map< int, std::unique_ptr< Node > > | m_nodes |
std::string | m_filename |
int | m_idCounter |
![]() | |
mat4 | m_matrix |
Transformation matrix. | |
std::recursive_mutex * | m_matrixMutex |
Used to internally synchronize access to the matrix of data. | |
DataComponentList | m_dataComponentList |
The list of DataComponents for this data. | |
![]() | |
std::vector< Param > | m_params |
List of all registered Parameter and SubProperty instances. | |
Additional Inherited Members | |
![]() | |
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 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. | |
![]() | |
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::string > | signalNameChanged |
Signal emitted when the name changed. | |
![]() | |
Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
![]() | |
void | swapWith (Data &other) |
Swaps the data and emits a matrix and name changed signal for both. | |
|
overridevirtual |
Returns the axis-aligned bounding box of this data in world space.
Implements Data.
|
overridevirtual |
Matrices of trees map to world coordinate system.
Implements Data.
|
inlineoverridevirtual |
Return whether this data type is visualized through an annotation (e.g. mesh)
Reimplemented from Data.
|
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.
Reimplemented from Configurable.
|
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.
Reimplemented from Configurable.
|
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 >.
|
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 >.
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
|
virtual |
Reimplemented in KeyTree.