MeVisLab Toolbox Reference
mlVesselNode.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_VESSEL_NODE_H
14#define ML_VESSEL_NODE_H
15
16
18
19#include "mlVesselGraphSystem.h"
20#include "VesselGraphTypes.h"
21#include "mlBaseGraphItem.h"
22#include "mlVesselEdge.h"
23#include "mlPropertiesMacros.h"
24
26
28class VESSELGRAPH_EXPORT VesselNode : public BaseGraphItem
29{
30friend class Graph;
31friend class VesselEdge;
32friend class LoadTreeData;
33
34public:
36 ~VesselNode() override { assert(_edges.empty()); }
37
39 void copyProperties(const VesselNode* other);
40
41 bool operator==(const VesselNode& other) const;
42 bool operator!=(const VesselNode& other) const { return !(*this==other); }
43
47 bool isRoot() const;
48 bool isEnd() const;
49 bool isBranch() const;
50 int nodeType() const;
51
53 size_t getEdgeNum() const { return _edges.size(); }
55 VesselEdge* getDepEdge(size_t i) { return _edges[i]; }
57 const VesselEdge* getDepEdge(size_t i) const { return _edges[i]; }
59 std::vector<VesselEdge*>* edges() { return &_edges; }
60
62 VesselNode* getDepNode(size_t i);
64 const VesselNode* getDepNode(size_t i)const;
66 bool isPred(size_t i) const { return _edges[i]->succNode()==this; }
68 bool isSucc(size_t i) const { return _edges[i]->predNode()==this; }
70 bool isCycle(size_t i)const { return _edges[i]->isCycle(); }
71
73 bool closeCycle();
75 VesselNode* getPredNode();
77 const VesselNode* getPredNode() const;
81 const VesselEdge* getPredEdge() const;
83
86 STATIC_GRAPH_PROPERTY(Vector3, pos, Pos);
87
89 void setVectorPos(const ImageVector& position) { setPos(Vector3(static_cast<MLdouble>(position.x), static_cast<MLdouble>(position.y), static_cast<MLdouble>(position.z))); }
91 ImageVector getVectorPos() const { return ImageVector(static_cast<int>(getPos()[0]), static_cast<int>(getPos()[1]), static_cast<int>(getPos()[2]), 0, 0, 0); }
92
95 double distance(const Vector3& position) const { return (position - getPos()).length(); }
96
98 void transform(const Matrix4& m);
99
101 void convertToVoxel(Matrix4* mat);
102
104 void convertToWorld(Matrix4* mat);
106
110 STATIC_GRAPH_PROPERTY(MLdouble, minDistance, MinDistance);
111 STATIC_GRAPH_PROPERTY(MLdouble, maxPathLength, MaxPathLength);
112
116
118 typedef MLdouble (VesselNode::*NodeGetFkt) () const;
119 typedef void (VesselNode::*NodeSetFkt) (const MLdouble&);
120
122
123private:
125 VesselNode(Graph& graph, MLint id, const Vector3& pos);
126
130 void addEdge (VesselEdge *edge);
131 void removeEdge(VesselEdge *edge);
133
135 std::vector<VesselEdge*> _edges;
136
137 STATIC_GRAPH_PROPERTY(MLdouble, drainVolume, DrainVolume);
139 STATIC_GRAPH_PROPERTY(MLint16, shortLabel, ShortLabel);
140
142 STATIC_GRAPH_PROPERTY(MLuint32, enumLabel, EnumLabel);
143
144public:
148 void addStateToTree(TreeNode* parent) const override;
149
152
154 void readStateFromTree(TreeNode* parent) override;
156
157private:
159 void readOldGraphNodeStateFromTree(TreeNode* parent);
161 void readOldVesselNodeStateFromTree(TreeNode* parent);
162
163 ML_ABSTRACT_CLASS_HEADER(VesselNode)
164};
165
166
168
169#endif // __mlVesselNode_H
BaseGraphItem(Graph &graph, MLint id, const ManagerPointer &manager)
Constructor.
bool isPred(size_t i) const
Is the dependent edge with index i preceding?
const VesselNode * getPredNode() const
Get the one and only predecessor node (return NULL for rootnode).
VesselEdge * getPredEdge()
Get the one and only predecessor edge (return NULL for rootnode).
void convertToWorld(Matrix4 *mat)
Convert nodes' coordinates.
const VesselEdge * getPredEdge() const
Get the one and only predecessor edge (return NULL for rootnode).
~VesselNode() override
Destructor.
void copyProperties(const VesselNode *other)
Copy all properties (topology information is left unchanged).
void readStateFromTree(TreeNode *parent) override
Reads the object state from the children of the given parent node.
void(VesselNode::* NodeSetFkt)(const MLdouble &)
function to set double parameter value
STATIC_GRAPH_PROPERTY(MLdouble, minDistance, MinDistance)
int nodeType() const
VesselNode * getPredNode()
Get the one and only predecessor node (return NULL for rootnode).
STATIC_GRAPH_PROPERTY(Vector3, pos, Pos)
bool isEnd() const
bool isSucc(size_t i) const
Is the dependent edge with index i succeeding?
size_t getEdgeNum() const
Get number of edges dependent on the node.
void setVectorPos(const ImageVector &position)
Position in world.
bool closeCycle()
TODO: Unclear what this does.
void transform(const Matrix4 &m)
Apply a 4x4 homogeneous transformation matrix to the node position.
bool operator==(const VesselNode &other) const
STATIC_GRAPH_PROPERTY(MLint, label, Label)
VesselEdge * getDepEdge(size_t i)
Get the pointer of edge with index i.
ImageVector getVectorPos() const
Position in world.
ML_SET_ADDSTATE_VERSION(2)
Set current addStateToTree() version number:
STATIC_GRAPH_PROPERTY(MLdouble, maxPathLength, MaxPathLength)
std::vector< VesselEdge * > * edges()
Get pointer to edge array.
MLdouble(VesselNode::* NodeGetFkt)() const
object bound function pointer: position of function relative to (individual) object base
bool isRoot() const
bool isCycle(size_t i) const
Is the dependent edge with index i a cycle?
double distance(const Vector3 &position) const
void convertToVoxel(Matrix4 *mat)
Convert nodes' coordinates.
void addStateToTree(TreeNode *parent) const override
bool isBranch() const
STATIC_GRAPH_PROPERTY(MLdouble, weight, Weight)
friend class LoadTreeData
VesselNode * getDepNode(size_t i)
Get dependent node via edge with index i.
friend class VesselEdge
bool operator!=(const VesselNode &other) const
const VesselEdge * getDepEdge(size_t i) const
Get the pointer of edge with index i.
const VesselNode * getDepNode(size_t i) const
Get dependent node via edge with index i.
friend class Graph
#define ML_ABSTRACT_CLASS_HEADER(className)
#define STATIC_GRAPH_PROPERTY(Type, lowerCaseName, upperCaseName)
unsigned int MLuint32
Definition mlTypeDefs.h:184
double MLdouble
Definition mlTypeDefs.h:216
signed short MLint16
Definition mlTypeDefs.h:124
MLint64 MLint
Definition mlTypeDefs.h:489
#define VESSELGRAPH_END_NAMESPACE
#define VESSELGRAPH_EXPORT
#define VESSELGRAPH_BEGIN_NAMESPACE