MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00005 00010 //---------------------------------------------------------------------------------- 00011 #ifndef __mlVesselNode_H 00012 #define __mlVesselNode_H 00013 00014 // dll specific settings. 00015 #include "mlVesselGraphSystem.h" 00016 00017 // graph classes 00018 #include "mlBaseGraphItem.h" 00019 #include "mlVesselEdge.h" 00020 #include "mlPropertiesMacros.h" 00021 00022 ML_START_NAMESPACE 00023 00025 class VESSELGRAPH_EXPORT VesselNode : public BaseGraphItem 00026 { 00027 friend class Graph; 00028 friend class VesselEdge; 00029 friend class LoadTreeData; 00030 00031 public: 00033 #ifdef ML_DEPRECATED 00034 ML_DEPRECATED VesselNode(const VesselNode& other); 00035 #endif 00036 00037 ~VesselNode() { assert(_edges.empty()); } 00038 00040 #ifdef ML_DEPRECATED 00041 ML_DEPRECATED VesselNode& operator=(const VesselNode& other); 00042 #endif 00043 00045 void copyProperties(const VesselNode* other); 00046 00047 bool operator==(const VesselNode& other) const; 00048 bool operator!=(const VesselNode& other) const { return !(*this==other); } 00049 00051 00052 00053 bool isRoot() const; 00054 bool isEnd() const; 00055 bool isBranch() const; 00056 int nodeType() const; 00057 00059 size_t getEdgeNum() const { return _edges.size(); } 00061 VesselEdge* getDepEdge(size_t i) { return _edges[i]; } 00063 const VesselEdge* getDepEdge(size_t i) const { return _edges[i]; } 00064 // Get pointer to edge array 00065 std::vector<VesselEdge*>* edges() { return &_edges; } 00066 00068 VesselNode* getDepNode(size_t i); 00070 const VesselNode* getDepNode(size_t i)const; 00072 bool isPred(size_t i) const { return _edges[i]->succNode()==this; } 00074 bool isSucc(size_t i) const { return _edges[i]->predNode()==this; } 00076 bool isCycle(size_t i)const { return _edges[i]->isCycle(); } 00077 00079 bool closeCycle(); 00081 VesselNode* getPredNode(); 00083 const VesselNode* getPredNode() const; 00085 VesselEdge* getPredEdge(); 00087 const VesselEdge* getPredEdge() const; 00089 00091 00092 STATIC_GRAPH_PROPERTY(Vector3, pos, Pos); 00093 00095 void setVectorPos(const ImageVector& position) { setPos(Vector3(static_cast<MLdouble>(position.x), static_cast<MLdouble>(position.y), static_cast<MLdouble>(position.z))); } 00097 ImageVector getVectorPos() const { return ImageVector(static_cast<int>(getPos()[0]), static_cast<int>(getPos()[1]), static_cast<int>(getPos()[2]), 0, 0, 0); } 00098 00101 double distance(Vector3 position) const { return (position-getPos()).length(); } 00102 00104 void transform(const Matrix4& m); 00105 00107 void convertToVoxel(Matrix4* mat); 00108 00110 void convertToWorld(Matrix4* mat); 00112 00114 00115 00116 virtual void addStateToTree(TreeNode* parent) const; 00117 00119 ML_SET_ADDSTATE_VERSION(2); 00120 00122 virtual void readStateFromTree(TreeNode* parent); 00124 00126 00127 STATIC_GRAPH_PROPERTY(MLint, label, Label); 00128 STATIC_GRAPH_PROPERTY(MLdouble, minDistance, MinDistance); 00129 STATIC_GRAPH_PROPERTY(MLdouble, drainVolume, DrainVolume); 00130 STATIC_GRAPH_PROPERTY(MLdouble, maxPathLength, MaxPathLength); 00131 00134 STATIC_GRAPH_PROPERTY(MLdouble, weight, Weight); 00135 00137 STATIC_GRAPH_PROPERTY(MLint16, shortLabel, ShortLabel); 00138 00140 STATIC_GRAPH_PROPERTY(MLuint32, enumLabel, EnumLabel); 00141 00143 typedef MLdouble (VesselNode::*NodeGetFkt) (void) const; 00144 typedef void (VesselNode::*NodeSetFkt) (const MLdouble&); 00145 00147 00148 private: 00150 VesselNode(Graph& graph, MLint id, const Vector3& pos); 00151 00153 void readOldGraphNodeStateFromTree(TreeNode* parent); 00155 void readOldVesselNodeStateFromTree(TreeNode* parent); 00156 00158 00159 00160 void addEdge (VesselEdge *edge); 00161 void removeEdge(VesselEdge *edge); 00163 00165 std::vector<VesselEdge*> _edges; 00166 00167 ML_ABSTRACT_CLASS_HEADER(VesselNode) 00168 }; 00169 00170 #ifdef ML_DEPRECATED 00171 00172 00173 00174 00175 ML_DEPRECATED typedef VesselNode GraphNode; 00177 #endif // ML_DEPRECATED 00178 00179 ML_END_NAMESPACE 00180 00181 #endif // __mlVesselNode_H