MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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{
36 friend class EdgeAnalyser;
37 friend class Graph;
38 friend class LoadTreeData;
39
40public:
42 //[[deprecated("Use copyProperties() instead.")]]
43 // VesselEdge(const VesselEdge& other) : BaseGraphItem(*other._graph, other.getId(), other._manager)
44 //{
45 // BaseGraphItem::copyProperties(&other);
46 //};
48 ~VesselEdge() override;
49
52
53 bool operator==(const VesselEdge& other) const;
54 bool operator!=(const VesselEdge& other) const
55 {
56 return !(*this == other);
57 }
58
63 {
64 return _predNode;
65 }
66 const VesselNode* predNode() const
67 {
68 return _predNode;
69 }
70
73 {
74 return _succNode;
75 }
76 const VesselNode* succNode() const
77 {
78 return _succNode;
79 }
80
82 void setPred(VesselNode* node);
83
85 void setSucc(VesselNode* node);
86
88 bool isPred(const VesselNode* node) const
89 {
90 return _predNode == node;
91 }
93 bool isSucc(const VesselNode* node) const
94 {
95 return _succNode == node;
96 }
97
100
102 void setCycle()
103 {
104 _cycle = true;
105 }
107 {
108 _cycle = false;
109 }
110 bool isCycle() const
111 {
112 return _cycle;
113 }
115
120 double distance(Vector3 vp) const
121 {
122 return getDistanceAndNearestSkeletonIndex(vp).first;
123 };
124
125 std::pair<MLdouble, size_t> getDistanceAndNearestSkeletonIndex(const Vector3& pos) const;
126
128 Vector3 extent() const;
129
131 SubImageBoxd getBoundingBox() const;
132
134 void transform(const Matrix4& m);
135
137 void convertToVoxel(Matrix4* mat);
138 void convertToWorld(Matrix4* mat);
140
152
154 typedef double (VesselEdge::*EdgeGetFkt)(void) const;
155 typedef void (VesselEdge::*EdgeSetFkt)(double);
156
160
161
164 Skeleton* createSkeleton(const Vector3& pos = Vector3(0), double minDistance = 0.0, double maxDistance = 0.0);
165 Skeleton* createSkeleton(const ImageVector& pos, double minDistance = 0.0, double maxDistance = 0.0)
166 {
167 return createSkeleton(
168 Vector3(static_cast<MLdouble>(pos.x), static_cast<MLdouble>(pos.y), static_cast<MLdouble>(pos.z)), minDistance,
170 }
172
173 void removeLeadingSkeletons(size_t count);
174 void removeTrailingSkeletons(size_t count);
175 void removeSkeleton(size_t index);
176
177 size_t numSkeletons(void) const
178 {
179 return _skeletons.size();
180 }
181 Skeleton* skeleton(size_t index)
182 {
183 return _skeletons.at(index);
184 }
185 const Skeleton* skeleton(size_t index) const
186 {
187 return _skeletons.at(index);
188 }
189
191 void skeletonsAscending(std::vector<Skeleton*>& skeletons);
192
194 void skeletonsAscending(std::vector<const Skeleton*>& skeletons) const;
195
197 void skeletonsDescending(std::vector<Skeleton*>& skeletons);
198
200 void skeletonsDescending(std::vector<const Skeleton*>& skeletons) const;
201
203
205 void skeletonsAscending(std::vector<Skeleton>& skeletons) const;
206
208 void skeletonsDescending(std::vector<Skeleton>& skeletons) const;
209
212
216 {
217 return _skeletons.front();
218 }
220 {
221 return _skeletons.back();
222 }
223 const Skeleton* frontSkeleton() const
224 {
225 return _skeletons.front();
226 }
227 const Skeleton* backSkeleton() const
228 {
229 return _skeletons.back();
230 }
231
235 Skeleton* skeleton(Vector3 pos, int itemType)
236 {
237 return const_cast<Skeleton*>(const_cast<const VesselEdge*>(this)->skeleton(pos, itemType));
238 }
239
243 const Skeleton* skeleton(Vector3 pos, int itemType) const;
244
246 size_t getVoxelNum() const;
247
251 void smooth(unsigned int numSmoothingPasses, double positionSmoothingFactor, double radiusSmoothingFactor,
252 double smoothingLimit = 0.0f);
254
255private:
258
260 VesselNode* _predNode;
262 VesselNode* _succNode;
263
266 bool _cycle;
267
269 std::vector<Skeleton*> _skeletons;
270
271public:
275 void addStateToTree(TreeNode* parent) const override;
276
279
281 void readStateFromTree(TreeNode* parent) override;
283
286
290 bool markST(int a_label, float r, float g, float b, float a, Vector3 pos, int snap);
291 bool markEdge(int a_label, float r, float g, float b, float a, Vector3 pos, int snap);
292
293private:
295 void readOldGraphEdgeStateFromTree(TreeNode* parent);
297 void readOldVesselEdgeStateFromTree(TreeNode* parent);
298
300};
301
303
304#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)
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
Copy constructor (creates an unconnected object, only copies properties), deprecated.
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)
Similar to 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:489
#define VESSELGRAPH_END_NAMESPACE
#define VESSELGRAPH_EXPORT
Definiert systemspezifische Macros, die f"ur diese DLL gelten sollen.
#define VESSELGRAPH_BEGIN_NAMESPACE