MeVisLab Toolbox Reference
mlVesselEdge.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_EDGE_H
14#define ML_VESSEL_EDGE_H
15
16
20
21#include "mlVesselGraphSystem.h"
22#include "VesselGraphTypes.h"
23#include "mlGraph.h"
24#include "mlBaseGraphItem.h"
25#include "mlSkeleton.h"
26#include "mlPropertiesMacros.h"
27
29
30class VesselNode;
31class Graph;
32
35{
36friend class EdgeAnalyser;
37friend class Graph;
38friend class LoadTreeData;
39
40public:
44 ~VesselEdge() override;
45
48
49 bool operator==(const VesselEdge& other) const;
50 bool operator!=(const VesselEdge& other) const { return !(*this==other); }
51
55 VesselNode* predNode() { return _predNode; }
56 const VesselNode* predNode() const { return _predNode; }
57
59 VesselNode* succNode() { return _succNode; }
60 const VesselNode* succNode() const { return _succNode; }
61
63 void setPred(VesselNode* node);
64
66 void setSucc(VesselNode* node);
67
69 bool isPred(const VesselNode* node) const { return _predNode==node; }
71 bool isSucc(const VesselNode* node) const { return _succNode==node; }
72
75
77 void setCycle() { _cycle = true; }
78 void unsetCycle() { _cycle = false; }
79 bool isCycle() const { return _cycle; }
81
86 double distance(Vector3 vp) const { return getDistanceAndNearestSkeletonIndex(vp).first; };
87
88 std::pair<MLdouble, size_t> getDistanceAndNearestSkeletonIndex(const Vector3& pos) const;
89
91 Vector3 extent() const;
92
94 SubImageBoxd getBoundingBox() const;
95
97 void transform(const Matrix4& m);
98
100 void convertToVoxel(Matrix4* mat);
101 void convertToWorld(Matrix4* mat);
103
115
117 typedef double (VesselEdge::*EdgeGetFkt) (void) const;
118 typedef void (VesselEdge::*EdgeSetFkt) (double);
119
123
124
127 Skeleton* createSkeleton(const Vector3& pos=Vector3(0), double minDistance = 0.0,
128 double maxDistance = 0.0);
129 Skeleton* createSkeleton(const ImageVector& pos, double minDistance = 0.0,
130 double maxDistance = 0.0)
131 {
132 return createSkeleton(Vector3(static_cast<MLdouble>(pos.x),
133 static_cast<MLdouble>(pos.y),
134 static_cast<MLdouble>(pos.z)),
135 minDistance, maxDistance);
136 }
138
139 void removeLeadingSkeletons(size_t count);
140 void removeTrailingSkeletons(size_t count);
141 void removeSkeleton(size_t index);
142
143 size_t numSkeletons(void) const { return _skeletons.size(); }
144 Skeleton* skeleton(size_t index) { return _skeletons.at(index); }
145 const Skeleton* skeleton(size_t index) const { return _skeletons.at(index); }
146
148 void skeletonsAscending(std::vector<Skeleton*> &skeletons);
149
151 void skeletonsAscending(std::vector<const Skeleton*> &skeletons) const;
152
154 void skeletonsDescending(std::vector<Skeleton*> &skeletons);
155
157 void skeletonsDescending(std::vector<const Skeleton*> &skeletons) const;
158
160
162 void skeletonsAscending(std::vector<Skeleton>& skeletons) const;
163
165 void skeletonsDescending(std::vector<Skeleton>& skeletons) const;
166
169
172 Skeleton* frontSkeleton() {return _skeletons.front();}
173 Skeleton* backSkeleton() {return _skeletons.back();}
174 const Skeleton* frontSkeleton() const {return _skeletons.front();}
175 const Skeleton* backSkeleton() const {return _skeletons.back();}
176
180 Skeleton *skeleton(Vector3 pos,int itemType) { return const_cast<Skeleton*>(const_cast<const VesselEdge*>(this)->skeleton(pos, itemType)); }
181
185 const Skeleton *skeleton(Vector3 pos,int itemType) const;
186
188 size_t getVoxelNum() const;
189
192 void smooth(unsigned int numSmoothingPasses, double positionSmoothingFactor, double radiusSmoothingFactor, double smoothingLimit = 0.0f );
194
195private:
198
200 VesselNode* _predNode;
202 VesselNode* _succNode;
203
206 bool _cycle;
207
209 std::vector <Skeleton*> _skeletons;
210
211public:
215 void addStateToTree(TreeNode* parent) const override;
216
219
221 void readStateFromTree(TreeNode* parent) override;
223
226
230 bool markST( int a_label, float r, float g, float b, float a, Vector3 pos, int snap );
231 bool markEdge( int a_label, float r, float g, float b, float a, Vector3 pos, int snap );
232
233private:
235 void readOldGraphEdgeStateFromTree(TreeNode* parent);
237 void readOldVesselEdgeStateFromTree(TreeNode* parent);
238
240};
241
243
244#endif // __mlVesselEdge_H
class BaseGraphItem
— Class EdgeAnalyser
Defines the basic Graph class which holds sets of nodes, edges and roots to model tubular structures ...
Definition mlGraph.h:64
Skeleton objects represent centerline voxels stored in a VesselEdge object.
Definition mlSkeleton.h:35
Class VesselEdge.
Skeleton * skeleton(Vector3 pos, int itemType)
Get the skeleton with minimal distance to pos.
Skeleton * skeleton(size_t index)
void readStateFromTree(TreeNode *parent) override
Reads the object state from the children of the given parent node.
void removeSkeleton(size_t index)
STATIC_GRAPH_PROPERTY(MLint, label, Label)
size_t getVoxelNum() const
Get number of edge voxels.
bool isCycle() const
STATIC_GRAPH_PROPERTY(MLdouble, STLength, STLength)
STATIC_GRAPH_PROPERTY(MLdouble, STVolume, STVolume)
void removeTrailingSkeletons(size_t count)
void transform(const Matrix4 &m)
Apply a 4x4 homogeneous transformation matrix to all skeleton positions.
const VesselNode * predNode() const
void convertToVoxel(Matrix4 *mat)
Convert all skeleton coordinates.
bool markEdge(int a_label, float r, float g, float b, float a, Vector3 pos, int snap)
void skeletonsAscending(std::vector< Skeleton * > &skeletons)
Return copy of skeletons' addresses in ascending order (graph hierarchy)
const Skeleton * skeleton(size_t index) const
void switchDirection()
Change direction of the edge by exchanging pred. and succ. node.
Vector3 extent() const
Get the edge's extent.
void skeletonsDescending(std::vector< Skeleton * > &skeletons)
Return copy of skeletons' addresses in descending order (graph hierarchy)
void setSucc(VesselNode *node)
Connect edge-tail to node node.
VesselNode * predNode()
Skeleton * createSkeleton(const ImageVector &pos, double minDistance=0.0, double maxDistance=0.0)
Skeleton * createSkeleton(const Vector3 &pos=Vector3(0), double minDistance=0.0, double maxDistance=0.0)
void setSTLabel(int nLabel)
Set label of edge and the attached subtree defined by edge directions.
SubImageBoxd getBoundingBox() const
Bounding box of the edge.
void removeLeadingSkeletons(size_t count)
const Skeleton * skeleton(Vector3 pos, int itemType) const
Get the skeleton with minimal distance to pos.
STATIC_GRAPH_PROPERTY(MLdouble, weight, Weight)
void setCycle()
Separate circles in the graph or connections between trees.
STATIC_GRAPH_PROPERTY(Vector3, STBarycenter, STBarycenter)
void skeletonsAscending(std::vector< Skeleton > &skeletons) const
Return copy of skeletons in ascending order (graph hierarchy from pred -> succ)
void smooth(unsigned int numSmoothingPasses, double positionSmoothingFactor, double radiusSmoothingFactor, double smoothingLimit=0.0f)
Smooths the skeletons' positions and radii.
bool markST(int a_label, float r, float g, float b, float a, Vector3 pos, int snap)
Set label and rgb color of edge and the attached subtree defined by edge directions.
const Skeleton * frontSkeleton() const
void addStateToTree(TreeNode *parent) const override
double distance(Vector3 vp) const
void orderSkeletonsAscending()
VesselNode * succNode()
Get the successor node of this edge.
Skeleton * createSkeleton(const Skeleton *skeletonTemplate)
void skeletonsDescending(std::vector< Skeleton > &skeletons) const
Return copy of skeletons in descending order (graph hierarchy from succ -> pred)
VesselEdge(const VesselEdge &other)
Copy constructor (creates an unconnected object, only copies properties), deprecated.
void setPred(VesselNode *node)
Connect edge-head to node node.
void skeletonsDescending(std::vector< const Skeleton * > &skeletons) const
Return copy of skeletons' addresses in descending order (graph hierarchy)
bool operator==(const VesselEdge &other) const
STATIC_GRAPH_PROPERTY(MLdouble, averageMinDistance, AverageMinDistance)
std::pair< MLdouble, size_t > getDistanceAndNearestSkeletonIndex(const Vector3 &pos) const
Skeleton * backSkeleton()
void clearSkeletons()
Encapsulate std::vector access.
size_t numSkeletons(void) const
STATIC_GRAPH_PROPERTY(MLdouble, volume, Volume)
STATIC_GRAPH_PROPERTY(MLdouble, length, Length)
const Skeleton * backSkeleton() const
ML_SET_ADDSTATE_VERSION(3)
Set current addStateToTree() version number:
bool operator!=(const VesselEdge &other) const
bool isSucc(const VesselNode *node) const
Is the graphNode the succeeding node of the edge?
void copyProperties(const VesselEdge *other)
Copy all properties (topology information is left unchanged)
~VesselEdge() override
Destructor.
void unsetCycle()
void skeletonsAscending(std::vector< const Skeleton * > &skeletons) const
Return copy of skeletons' addresses in ascending order (graph hierarchy)
Skeleton * frontSkeleton()
bool skeletonsAreAscending() const
Returns if the skeletons are ordered ascending.
const VesselNode * succNode() const
void setSTLabel(Graph *pGraph)
Set label of edge and the attached subtree defined by edge directions according to labels of pGraph.
void convertToWorld(Matrix4 *mat)
STATIC_GRAPH_PROPERTY(MLint, hierarchy, Hierarchy)
bool isPred(const VesselNode *node) const
Is the graphNode the preceding node of the edge?
VesselNode is derived from GraphNode, hence it can be stored as node item in a class Graph object.
#define ML_ABSTRACT_CLASS_HEADER(className)
Same like ML_ABSTRACT_CLASS_HEADER_EXPORTED with a non existing export symbol.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
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:490
#define VESSELGRAPH_END_NAMESPACE
#define VESSELGRAPH_EXPORT
Definiert systemspezifische Macros, die f"ur diese DLL gelten sollen.
#define VESSELGRAPH_BEGIN_NAMESPACE