MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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
29{
30 friend class Graph;
31 friend class VesselEdge;
32 friend class LoadTreeData;
33
34public:
36 ~VesselNode() override
37 {
38 assert(_edges.empty());
39 }
40
43
44 bool operator==(const VesselNode& other) const;
45 bool operator!=(const VesselNode& other) const
46 {
47 return !(*this == other);
48 }
49
53 bool isRoot() const;
54 bool isEnd() const;
55 bool isBranch() const;
56 int nodeType() const;
57
59 size_t getEdgeNum() const
60 {
61 return _edges.size();
62 }
65 {
66 return _edges[i];
67 }
69 const VesselEdge* getDepEdge(size_t i) const
70 {
71 return _edges[i];
72 }
74 std::vector<VesselEdge*>* edges()
75 {
76 return &_edges;
77 }
78
82 const VesselNode* getDepNode(size_t i) const;
84 bool isPred(size_t i) const
85 {
86 return _edges[i]->succNode() == this;
87 }
89 bool isSucc(size_t i) const
90 {
91 return _edges[i]->predNode() == this;
92 }
94 bool isCycle(size_t i) const
95 {
96 return _edges[i]->isCycle();
97 }
98
104 const VesselNode* getPredNode() const;
108 const VesselEdge* getPredEdge() const;
110
114
116 void setVectorPos(const ImageVector& position)
117 {
118 setPos(Vector3(static_cast<MLdouble>(position.x), static_cast<MLdouble>(position.y),
119 static_cast<MLdouble>(position.z)));
120 }
122 ImageVector getVectorPos() const
123 {
124 return ImageVector(static_cast<int>(getPos()[0]), static_cast<int>(getPos()[1]), static_cast<int>(getPos()[2]), 0,
125 0, 0);
126 }
127
130 double distance(const Vector3& position) const
131 {
132 return (position - getPos()).length();
133 }
134
136 void transform(const Matrix4& m);
137
139 void convertToVoxel(Matrix4* mat);
140
142 void convertToWorld(Matrix4* mat);
144
150
154
156 typedef MLdouble (VesselNode::*NodeGetFkt)() const;
157 typedef void (VesselNode::*NodeSetFkt)(const MLdouble&);
158
160
161private:
163 VesselNode(Graph& graph, MLint id, const Vector3& pos);
164
168 void addEdge(VesselEdge* edge);
169 void removeEdge(VesselEdge* edge);
171
173 std::vector<VesselEdge*> _edges;
174
178
181
182public:
186 void addStateToTree(TreeNode* parent) const override;
187
190
192 void readStateFromTree(TreeNode* parent) override;
194
195private:
197 void readOldGraphNodeStateFromTree(TreeNode* parent);
199 void readOldVesselNodeStateFromTree(TreeNode* parent);
200
202};
203
204
206
207#endif // __mlVesselNode_H
class BaseGraphItem
Defines the basic Graph class which holds sets of nodes, edges and roots to model tubular structures ...
Definition mlGraph.h:64
Class VesselEdge.
VesselNode is derived from GraphNode, hence it can be stored as node item in a class Graph object.
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.
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.
bool isRoot() const
bool isCycle(size_t i) const
Is the dependent edge with index i a cycle?
double distance(const Vector3 &position) const
Get the euclidean distance between _worldPos and pos.
void convertToVoxel(Matrix4 *mat)
Convert nodes' coordinates.
void addStateToTree(TreeNode *parent) const override
bool isBranch() const
STATIC_GRAPH_PROPERTY(MLdouble, weight, Weight)
Weight of the node.
VesselNode * getDepNode(size_t i)
Get dependent node via edge with index i.
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.
#define ML_ABSTRACT_CLASS_HEADER(className)
Similar to ML_ABSTRACT_CLASS_HEADER_EXPORTED with a non-existing export symbol.
#define STATIC_GRAPH_PROPERTY(Type, lowerCaseName, upperCaseName)
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
unsigned int MLuint32
Definition mlTypeDefs.h:185
double MLdouble
Definition mlTypeDefs.h:217
signed short MLint16
Definition mlTypeDefs.h:125
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:489
#define VESSELGRAPH_END_NAMESPACE
#define VESSELGRAPH_EXPORT
Definiert systemspezifische Macros, die f"ur diese DLL gelten sollen.
#define VESSELGRAPH_BEGIN_NAMESPACE