MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlGraph.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_GRAPH_H
14#define ML_GRAPH_H
15
21// Include dll-specific settings.
22#include "mlVesselGraphSystem.h"
23
24#include "VesselGraphTypes.h"
25
26// ThirdParty/System includes
28#include <boost/iterator/transform_iterator.hpp>
29#include <boost/shared_ptr.hpp>
30#include <boost/function.hpp>
31#include <map>
33
34// MLVesselGraph includes
36
37// Be sure that all your modules are part of the ml. So collisions
38// with names in system files or other libraries are minimized.
40
41// Forward-declarations
42class GraphAction;
43class VesselEdge;
44class VesselNode;
45
46
63class VESSELGRAPH_EXPORT Graph : public Base
64{
65
66 friend class GraphAnalyser;
67 friend class SaveTreeData;
68 friend class LoadTreeData;
69
70public:
73 enum {
75 edge
76 };
77
78 //----------------------------------------------------------
81 //----------------------------------------------------------
84
86 Graph(const Graph& g, bool reorder = false);
87
89 Graph(const Graph& g, const VesselNode* root, bool reorder = false);
90
92 Graph(const Graph& g, const std::vector<const VesselNode*>& roots, bool reorder = false);
93
95 Graph(Graph& g, int clusterId, bool reorder = false);
96
98#ifdef VESSELGRAPH_USE_MPIF
99 Graph* deepCopy() const
100 {
101 return new Graph(*this);
102 };
103#else
104 Graph* deepCopy() const override
105 {
106 return new Graph(*this);
107 };
108#endif
109
111 ~Graph() override;
113
114 //---------------------------------------------------------
117 //---------------------------------------------------------
118
120 VesselEdge* createEdge(VesselNode* predNode, VesselNode* succNode, MLint useId = -1);
124
126 VesselNode* createNode(const Vector3& pos = Vector3(0), MLint useId = -1);
128 VesselNode* createNode(const ImageVector& pos, MLint useId = -1)
129 {
130 return this->createNode(
131 Vector3(static_cast<MLdouble>(pos.x), static_cast<MLdouble>(pos.y), static_cast<MLdouble>(pos.z)), useId);
132 };
133
136
138
139
140 //---------------------------------------------------------
143 //---------------------------------------------------------
144
146 void addGraph(const Graph& g)
147 {
148 std::map<const VesselNode*, VesselNode*> nodeMapping;
149 std::map<const VesselEdge*, VesselEdge*> edgeMapping;
150 std::map<const VesselNode*, VesselNode*> rootMapping;
151 this->addGraph(g, nodeMapping, edgeMapping, rootMapping);
152 }
153
157 void addGraph(const Graph& g, std::map<const VesselNode*, VesselNode*>& nodeMapping,
158 std::map<const VesselEdge*, VesselEdge*>& edgeMapping,
159 std::map<const VesselNode*, VesselNode*>& rootMapping);
160
162 void addSubtrees(const std::vector<const VesselNode*>& roots);
163
166 void copyParts(const std::vector<const VesselNode*>& nodes, const std::vector<const VesselEdge*>& edges,
167 const std::vector<const VesselNode*>& roots)
168 {
169 std::map<const VesselNode*, VesselNode*> nodeMapping;
170 std::map<const VesselEdge*, VesselEdge*> edgeMapping;
171 std::map<const VesselNode*, VesselNode*> rootMapping;
172 this->copyParts(nodes, edges, roots, nodeMapping, edgeMapping, rootMapping);
173 }
174
178 void copyParts(const std::vector<const VesselNode*>& nodes, const std::vector<const VesselEdge*>& edges,
179 const std::vector<const VesselNode*>& roots, std::map<const VesselNode*, VesselNode*>& nodeMapping,
180 std::map<const VesselEdge*, VesselEdge*>& edgeMapping,
181 std::map<const VesselNode*, VesselNode*>& rootMapping);
182
184
185 //--------------------------------------------------------
188 //--------------------------------------------------------
190 bool removeEdge(VesselEdge* edge, bool removeEmptyNodes = true);
200
201
203 typedef std::map<MLint, VesselNode*> NodeMap;
205 typedef boost::function<VesselNode*(const NodeMap::value_type&)> NodeAccess;
207 typedef boost::function<const VesselNode*(const NodeMap::value_type&)> ConstNodeAccess;
209 typedef boost::transform_iterator<NodeAccess, NodeMap::iterator> NodeIterator;
211 typedef boost::transform_iterator<ConstNodeAccess, NodeMap::const_iterator> ConstNodeIterator;
212
214 typedef std::map<MLint, VesselEdge*> EdgeMap;
216 typedef boost::function<VesselEdge*(const EdgeMap::value_type&)> EdgeAccess;
218 typedef boost::function<const VesselEdge*(const EdgeMap::value_type&)> ConstEdgeAccess;
220 typedef boost::transform_iterator<EdgeAccess, EdgeMap::iterator> EdgeIterator;
222 typedef boost::transform_iterator<ConstEdgeAccess, EdgeMap::const_iterator> ConstEdgeIterator;
223
224 //---------------------------------------------------------
227 //--------------------------------------------------------
228
231 {
232 return boost::make_transform_iterator(_nodes.begin(), &getSecond<VesselNode*, NodeMap::value_type>);
233 }
236 {
237 return boost::make_transform_iterator(_nodes.end(), &getSecond<VesselNode*, NodeMap::value_type>);
238 }
239
242 {
243 return boost::make_transform_iterator(_nodes.begin(), &getSecond<const VesselNode*, NodeMap::value_type>);
244 }
247 {
248 return boost::make_transform_iterator(_nodes.end(), &getSecond<const VesselNode*, NodeMap::value_type>);
249 }
250
253 {
254 return boost::make_transform_iterator(_edges.begin(), &getSecond<VesselEdge*, EdgeMap::value_type>);
255 }
258 {
259 return boost::make_transform_iterator(_edges.end(), &getSecond<VesselEdge*, EdgeMap::value_type>);
260 }
261
264 {
265 return boost::make_transform_iterator(_edges.begin(), &getSecond<const VesselEdge*, EdgeMap::value_type>);
266 }
269 {
270 return boost::make_transform_iterator(_edges.end(), &getSecond<const VesselEdge*, EdgeMap::value_type>);
271 }
272
275 {
276 return boost::make_transform_iterator(_roots.begin(), &getSecond<VesselNode*, NodeMap::value_type>);
277 }
280 {
281 return boost::make_transform_iterator(_roots.end(), &getSecond<VesselNode*, NodeMap::value_type>);
282 }
283
286 {
287 return boost::make_transform_iterator(_roots.begin(), &getSecond<const VesselNode*, NodeMap::value_type>);
288 }
291 {
292 return boost::make_transform_iterator(_roots.end(), &getSecond<const VesselNode*, NodeMap::value_type>);
293 }
294
296 size_t numNodes() const
297 {
298 return _nodes.size();
299 };
301 size_t numEdges() const
302 {
303 return _edges.size();
304 };
306 size_t numRoots() const
307 {
308 return _roots.size();
309 };
310
312 const VesselNode* getIdNode(MLint id) const;
316 const VesselEdge* getIdEdge(MLint id) const;
319
321 const VesselNode* getNode(Vector3 pos) const;
323 VesselNode* getNode(Vector3 pos);
325 const VesselEdge* getEdge(Vector3 pos) const;
327 VesselEdge* getEdge(Vector3 pos);
329 const VesselNode* getRoot(Vector3 pos) const;
331 VesselNode* getRoot(Vector3 pos);
332
335 const VesselNode* getNode(size_t index) const;
338 VesselNode* getNode(size_t index);
339
342 const VesselEdge* getEdge(size_t index) const;
345 VesselEdge* getEdge(size_t index);
346
349 const VesselNode* getRoot(size_t index) const;
352 VesselNode* getRoot(size_t index);
353
355 size_t getIndex(const VesselNode* node) const;
357 size_t getIndex(const VesselEdge* edge) const;
359
360
365 {
366 return _nodePropertyManager;
367 }
369 {
370 return _nodePropertyManager;
371 }
372
375 {
376 return _edgePropertyManager;
377 }
379 {
380 return _edgePropertyManager;
381 }
382
385 {
386 return _skeletonPropertyManager;
387 }
389 {
390 return _skeletonPropertyManager;
391 }
393
394 //---------------------------------------------------------
397 //---------------------------------------------------------
398 void transform(const Matrix4& m);
399
401 void setToWorldMatrix(const Matrix4* m);
403 void setToWorldMatrix(const Matrix4& m);
405 const Matrix4* getToWorldMatrix() const;
407 void getToWorldMatrix(float* mat) const;
409 Matrix4 getToVoxelMatrix() const;
410
412 void setToWorld(void)
413 {
414 _isWorld = true;
415 }
417 void setToVoxel(void)
418 {
419 _isWorld = false;
420 }
422 bool isWorld() const
423 {
424 return _isWorld;
425 }
430 void convertToVoxel(void);
433 void convertToWorld(void);
434
436 void setImgExt(ImageVector v)
437 {
438 _imgExt = v;
439 }
440 ImageVector getImgExt() const
441 {
442 return _imgExt;
443 }
444 MLint extX() const
445 {
446 return _imgExt.x;
447 }
448 MLint extY() const
449 {
450 return _imgExt.y;
451 }
452 MLint extZ() const
453 {
454 return _imgExt.z;
455 }
456
457 void setVoxelExt(Vector3 v)
458 {
459 _voxelExt = v;
460 }
461 Vector3 getVoxelExt() const
462 {
463 return _voxelExt;
464 }
466
472
473 //--------------------------------------------------------
476 //--------------------------------------------------------
480 Graph* newGraph(bool unusedDeprecated = true) const;
482
483 //---------------------------------------------------------
486 //---------------------------------------------------------
490
512
520
521 //------------------------------------------------------
524 //------------------------------------------------------
526 SubImageBoxd getBoundingBox() const;
528
529protected:
530 template <typename ResultType, typename ParameterType> static ResultType getSecond(const ParameterType& p)
531 {
532 return p.second;
533 }
534
540 ImageVector _imgExt;
542 Vector3 _voxelExt;
543
545 std::map<MLint, VesselNode*> _nodes;
546 std::map<MLint, VesselEdge*> _edges;
547 std::map<MLint, VesselNode*> _roots;
548
549private:
550 PropertyManager::Pointer _nodePropertyManager;
551 PropertyManager::Pointer _edgePropertyManager;
552 PropertyManager::Pointer _skeletonPropertyManager;
553
554 MLint nextNodeId()
555 {
556 return _nodes.empty() ? 1 : _nodes.rbegin()->first + 1;
557 };
558 MLint nextEdgeId()
559 {
560 return _edges.empty() ? 1 : _edges.rbegin()->first + 1;
561 };
562 MLint nextRootId()
563 {
564 return _roots.empty() ? 1 : _roots.rbegin()->first + 1;
565 };
566
571 // [[deprecated("This method breaks the 'unique and stable ID' system.")]]
572 void reorderItems();
573
574public:
577 NoAction = 0, // Not changed.
578 LabelGraph, // Skeleton label values changed.
579 EditGraph, // Skeleton label colors changed.
580 ModifyRoots, // Roots modified: graph is redirected
581 ModifyNodesEdges, // Remove/Insert edges, insert nodes
582 NewGraph, // Everything new
583 NumActionTypes //
584 };
585
586 int getNumCluster() const
587 {
588 return _numCluster;
589 }
590
591 bool getFlag() const
592 {
593 return _bFlag;
594 }
595 void setFlag(bool bFlag)
596 {
597 _bFlag = bFlag;
598 }
599
603
605
606 //-------------------------------------------------------
609 //-------------------------------------------------------
612 void addStateToTree(TreeNode* parent) const override;
616 void readStateFromTree(TreeNode* parent) override;
617
620 int getVersion(void)
621 {
622 return _version;
623 }
626 {
627 _version = getAddStateVersion();
628 }
630 void setVersion(int version)
631 {
632 _version = version;
633 }
634
635#ifndef GRAPH_NO_BINARY_PERSISTENCE
637 {
638 return _useBinaryPersistence;
639 }
646 {
647 _useBinaryPersistence = use;
648 }
651 std::string toBinaryData() const;
653 void fromBinaryData(const std::string& data);
654#endif // GRAPH_NO_BINARY_PERSISTENCE
656
660
667 //------------------------------------------------------
670 //------------------------------------------------------
671 void setAction(ActionType action, std::string sender);
676
677 //-----------------------------------------------------------
681 static double getMinSkeletonLabel(void)
682 {
683 return MIN_SKELETON_LABEL;
684 }
685 static double getMaxSkeletonLabel(void)
686 {
687 return MAX_SKELETON_LABEL;
688 }
690
691protected:
693 bool _bFlag;
694
698
699
700 //------------------------------------------------------
703 //------------------------------------------------------
707
711
712 //-----------------------------------------------------------
716 static double MIN_SKELETON_LABEL;
717 static double MAX_SKELETON_LABEL;
719
720 bool _isContainedInImageExtent(const Vector3& pos, const Matrix4& toVoxelMatrix);
721
722private:
725 int _version;
726#ifndef GRAPH_NO_BINARY_PERSISTENCE
727 bool _useBinaryPersistence;
728#endif // GRAPH_NO_BINARY_PERSISTENCE
729
731};
732
734
735
736#endif
Defines the GraphAction class.
— Class GraphAnalyser
Defines the basic Graph class which holds sets of nodes, edges and roots to model tubular structures ...
Definition mlGraph.h:64
const VesselNode * getRoot(size_t index) const
Get root via index position.
bool getFlag() const
Definition mlGraph.h:591
Graph(const Graph &g, const std::vector< const VesselNode * > &roots, bool reorder=false)
Construct graph from trees in g.
void closeSkeletonGaps()
Closes gaps in the skeletons between the first or last skeleton of a VesselEdge and the closest node.
const VesselNode * getNode(size_t index) const
Get node via index position.
ConstNodeIterator beginNode() const
Provide const iterator access to the begin of the node map.
Definition mlGraph.h:241
size_t numEdges() const
Returns the number edges in this graph.
Definition mlGraph.h:301
VesselNode * getNode(Vector3 pos)
Get the node with minimal distance to \cpos. Uses method distance() of node classes.
VesselEdge * getIdEdge(MLint id)
Get edge with id id.
bool mergeEdges(VesselEdge *parent, VesselEdge *child)
void fromBinaryData(const std::string &data)
Reconstructs the graph using the binary data.
std::map< MLint, VesselNode * > _roots
Definition mlGraph.h:547
VesselNode * getRoot(Vector3 pos)
Get the root node with minimal distance to \cpos.
void worldVoxelConvert()
Convert all graph coordinates from the current coordinate system to the opposite.
bool isWorld() const
Return whether element coordinates are given in voxel or world coordinates.
Definition mlGraph.h:422
ActionType getActionValue(void) const
void purifyGraph()
Removes orphan nodes and unsets false cyclic edges (edges with a leaf node that are marked as cyclic)...
MLint splitEdge(MLint edgeID, size_t skeletonIndex)
Splits edge with id edgeID at skeleton index skeletonIndex and returns the ID of the additionally cre...
void setToWorldMatrix(const Matrix4 *m)
Set the conversion matrix for conversions from voxel to world coordinate.
Graph * deepCopy() const override
Implement generic deepCopy functionality using copy constructor.
Definition mlGraph.h:104
const VesselNode * getIdNode(MLint id) const
Get node with id id;.
void addGraph(const Graph &g)
Add an entire graph to the current graph.
Definition mlGraph.h:146
Graph(Graph &g, int clusterId, bool reorder=false)
Construct graph from subgraph of g, defined by clusterId in g.
VesselEdge * getEdge(size_t index)
Get edge via index position.
Matrix4 _toWorldMatrix
Matrix transform to get from voxel to world coordinates.
Definition mlGraph.h:538
void setVersion(int version)
Set version.
Definition mlGraph.h:630
std::map< MLint, VesselNode * > _nodes
Maps of graph items.
Definition mlGraph.h:545
void setAction(ActionType action, std::string sender)
boost::transform_iterator< NodeAccess, NodeMap::iterator > NodeIterator
Iterator used to traverse nodes in a node map (returns data elements of the map instead of tuples).
Definition mlGraph.h:209
ActionType _action
Definition mlGraph.h:704
PropertyManager::ConstPointer getEdgePropertyManager() const
Definition mlGraph.h:378
void removeOrphanNodes()
Remove nodes with no edges attached.
void getToWorldMatrix(float *mat) const
Get the conversion matrix for conversions from voxel to world coordinate.
PropertyManager::Pointer getEdgePropertyManager()
Get access to the GraphPropertyManager for edges.
Definition mlGraph.h:374
Graph & operator=(const Graph &g)
Clear current graph and build new one with props of g.
void clearRoots()
Remove all roots that have been defined.
void setActionCallBack(GraphAction *cbObj)
void insertRoot(VesselNode *node)
Insert a node to the list of root nodes.
PropertyManager::ConstPointer getSkeletonPropertyManager() const
Definition mlGraph.h:388
Graph(const Graph &g, bool reorder=false)
Default copy constructor.
bool _isWorld
Is the graph in world coordinates? Default is true.
Definition mlGraph.h:536
int getVersion(void)
Get graph's version.
Definition mlGraph.h:620
ImageVector _imgExt
Extension of the image the graph is compiled from.
Definition mlGraph.h:540
int getNumCluster() const
Definition mlGraph.h:586
void stripCycles()
Strip cyclic edges from the graph.
void addGraph(const Graph &g, std::map< const VesselNode *, VesselNode * > &nodeMapping, std::map< const VesselEdge *, VesselEdge * > &edgeMapping, std::map< const VesselNode *, VesselNode * > &rootMapping)
Add an entire graph to this graph.
NodeIterator beginNode()
Provide iterator access to the begin of the node map.
Definition mlGraph.h:230
void setVoxelExt(Vector3 v)
Definition mlGraph.h:457
NodeIterator beginRoot()
Provide iterator access to the begin of the root map.
Definition mlGraph.h:274
void transform(const Matrix4 &m)
VesselEdge * createEdge(MLint predNodeId, MLint succNodeId, MLint useId=-1)
Create a VesselEdge with unique id, add it to the Graph and Nodes identified by the respective IDs an...
Graph(const Graph &g, const VesselNode *root, bool reorder=false)
Construct graph from tree in g.
void setImgExt(ImageVector v)
Definition mlGraph.h:436
size_t getIndex(const VesselEdge *edge) const
Return the index of VesselEdge edge in the edgeMap or numEdges() if edge was not found.
Vector3 _voxelExt
Extension of a voxel of the image the graph is compiled from.
Definition mlGraph.h:542
VesselNode * getNode(size_t index)
Get node via index position.
Vector3 getVoxelExt() const
Definition mlGraph.h:461
static double MIN_SKELETON_LABEL
Definition mlGraph.h:716
std::map< MLint, VesselEdge * > EdgeMap
Internal edge storage.
Definition mlGraph.h:214
EdgeIterator beginEdge()
Provide iterator access to the begin of the edge map.
Definition mlGraph.h:252
MLint extZ() const
Definition mlGraph.h:452
void clampToImage()
NodeIterator endNode()
Provide iterator access to the end of the node map.
Definition mlGraph.h:235
ImageVector getImgExt() const
Definition mlGraph.h:440
void setToWorld(void)
Define all element coordinates to be in world coordinates (no conversion takes place).
Definition mlGraph.h:412
SubImageBoxd getBoundingBox() const
Calculate graph's bounding box from edge-bounding-boxes.
ML_SET_ADDSTATE_VERSION(3)
Set current addStateToTree() version number:
ConstEdgeIterator endEdge() const
Provide const iterator access to the end of the edge map.
Definition mlGraph.h:268
bool directGraph(double FloodThresh)
Build a rooted, directed graph.
void setCurrentVersion(void)
Set graph's version to persistent version number.
Definition mlGraph.h:625
ConstEdgeIterator beginEdge() const
Provide const iterator access to the begin of the edge map.
Definition mlGraph.h:263
static double getMinSkeletonLabel(void)
Definition mlGraph.h:681
int separateGraph()
Separate graph into clusters of connected edges.
bool removeNode(VesselNode *node)
Remove a node from the graph.
void setRootIdToAllChildren()
Descends recursively from all roots to the leaves in the trees and sets the rootId of the according r...
bool _isContainedInImageExtent(const Vector3 &pos, const Matrix4 &toVoxelMatrix)
MLint extX() const
Definition mlGraph.h:444
MLint extY() const
Definition mlGraph.h:448
void convertToWorld(void)
Convert all coordinates to world coordinates.
NodeIterator endRoot()
Provide iterator access to the end of the root map.
Definition mlGraph.h:279
GraphAction * _actionCBObject
Definition mlGraph.h:705
void removeRoot(VesselNode *r)
Remove a root from the graph.
const VesselEdge * getIdEdge(MLint id) const
Get edge with id id.
VesselNode * createNode(const Vector3 &pos=Vector3(0), MLint useId=-1)
Create a VesselNode with unique id, add it to the Graph and return a pointer to it.
const VesselNode * getRoot(Vector3 pos) const
Get the root node with minimal distance to \cpos.
ActionType
Graph modification modes. Ordered from minor to mayor modifications.
Definition mlGraph.h:576
@ EditGraph
Definition mlGraph.h:579
@ ModifyRoots
Definition mlGraph.h:580
@ LabelGraph
Definition mlGraph.h:578
@ ModifyNodesEdges
Definition mlGraph.h:581
@ NewGraph
Definition mlGraph.h:582
@ node
Definition mlGraph.h:74
VesselEdge * createEdge(VesselNode *predNode, VesselNode *succNode, MLint useId=-1)
Create a VesselEdge with unique id, add it to the Graph and Nodes and return a pointer to it.
~Graph() override
Destructor.
const Matrix4 * getToWorldMatrix() const
Get the conversion matrix for conversions from voxel to world coordinate.
boost::transform_iterator< ConstEdgeAccess, EdgeMap::const_iterator > ConstEdgeIterator
Iterator used to traverse const edges in a edge map (returns data elements of the map instead of tupl...
Definition mlGraph.h:222
static double getMaxSkeletonLabel(void)
Definition mlGraph.h:685
void readStateFromTree(TreeNode *parent) override
Reads the object state from the children of the given parent node.
bool getUseBinaryPersistence()
Definition mlGraph.h:636
VesselNode * createNode(const ImageVector &pos, MLint useId=-1)
Create a VesselNode with unique id, add it to the Graph and return a pointer to it.
Definition mlGraph.h:128
void addSubtrees(const std::vector< const VesselNode * > &roots)
Add subtrees rooted at nodes roots to this graph.
void _setRootIdToChildren(int rootId, VesselNode *node, VesselEdge *predEdge)
Sets the given root id to the given node and its child edges and calls itself recursively until the n...
void setFlag(bool bFlag)
Definition mlGraph.h:595
void setToVoxel(void)
Define all element coordinates to be in voxels coordinates (no conversion takes place).
Definition mlGraph.h:417
PropertyManager::Pointer getNodePropertyManager()
Definition mlGraph.h:364
VesselNode * getRoot(size_t index)
Get root via index position.
ConstNodeIterator beginRoot() const
Provide const iterator access to the begin of the root map.
Definition mlGraph.h:285
void useBinaryPersistence(bool use)
Set whether to use binary persistence instead of textual representation (text being the default).
Definition mlGraph.h:645
size_t numNodes() const
Returns the number nodes in this graph.
Definition mlGraph.h:296
Matrix4 getToVoxelMatrix() const
Get the conversion matrix for conversions from world to voxel coordinate.
const VesselEdge * getEdge(size_t index) const
Get edge via index position.
void copyParts(const std::vector< const VesselNode * > &nodes, const std::vector< const VesselEdge * > &edges, const std::vector< const VesselNode * > &roots)
Copy a collection of nodes, edges and roots from a different graph to this graph.
Definition mlGraph.h:166
bool removeEdge(VesselEdge *edge, bool removeEmptyNodes=true)
Remove an edge from the graph.
size_t getIndex(const VesselNode *node) const
Return the index of VesselNode node in the nodeMap or numNodes() if node was not found.
void convertToVoxel(void)
Convert all coordinates to voxel coordinates.
boost::transform_iterator< ConstNodeAccess, NodeMap::const_iterator > ConstNodeIterator
Iterator used to traverse const nodes in a node map (returns data elements of the map instead of tupl...
Definition mlGraph.h:211
void clearGraph()
Remove all elements from the graph.
const VesselNode * getNode(Vector3 pos) const
Get the node with minimal distance to \cpos. Uses method distance() of node classes.
void setToWorldMatrix(const Matrix4 &m)
Set the conversion matrix for conversions from voxel to world coordinate.
int _numCluster
Number of non-connected edge-clusters.
Definition mlGraph.h:697
ConstNodeIterator endNode() const
Provide const iterator access to the end of the node map.
Definition mlGraph.h:246
std::string toBinaryData() const
Returns string containing binary representation of all data necessary to reconstruct the graph.
static double MAX_SKELETON_LABEL
Definition mlGraph.h:717
static ResultType getSecond(const ParameterType &p)
Definition mlGraph.h:530
Graph()
Default constructor.
VesselNode * getIdNode(MLint id)
Get node with id id;.
void copyParts(const std::vector< const VesselNode * > &nodes, const std::vector< const VesselEdge * > &edges, const std::vector< const VesselNode * > &roots, std::map< const VesselNode *, VesselNode * > &nodeMapping, std::map< const VesselEdge *, VesselEdge * > &edgeMapping, std::map< const VesselNode *, VesselNode * > &rootMapping)
Copy a collection of nodes, edges and roots from a different graph to this graph.
std::map< MLint, VesselEdge * > _edges
Definition mlGraph.h:546
const VesselEdge * getEdge(Vector3 pos) const
Get the edge with minimal distance to \cpos. Uses method distance() of edge classes.
boost::transform_iterator< EdgeAccess, EdgeMap::iterator > EdgeIterator
Iterator used to traverse edges in a edge map (returns data elements of the map instead of tuples).
Definition mlGraph.h:220
std::map< MLint, VesselNode * > NodeMap
Internal node storage.
Definition mlGraph.h:203
EdgeIterator endEdge()
Provide iterator access to the end of the edge map.
Definition mlGraph.h:257
size_t numRoots() const
Returns the number roots in this graph.
Definition mlGraph.h:306
void setActionValue(ActionType action)
VesselEdge * getEdge(Vector3 pos)
Get the edge with minimal distance to \cpos. Uses method distance() of edge classes.
void addStateToTree(TreeNode *parent) const override
Overload base-methods: Attaches the object state as children of the given parent node.
Graph * newGraph(bool unusedDeprecated=true) const
Allocate new graph with same properties as this (slowly).
ConstNodeIterator endRoot() const
Provide const iterator access to the end of the root map.
Definition mlGraph.h:290
PropertyManager::ConstPointer getNodePropertyManager() const
Definition mlGraph.h:368
PropertyManager::Pointer getSkeletonPropertyManager()
Get access to the GraphPropertyManager for skeletons.
Definition mlGraph.h:384
bool _bFlag
Flag for diverse usage.
Definition mlGraph.h:693
boost::intrusive_ptr< const type > ConstPointer
boost::intrusive_ptr< type > Pointer
Class VesselEdge.
VesselNode is derived from GraphNode, hence it can be stored as node item in a class Graph object.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non-existing export symbol.
double MLdouble
Definition mlTypeDefs.h:217
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