MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlSkeleton.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_SKELETON_H
14#define ML_SKELETON_H
15
16
18
19// dll specific settings.
20#include "mlVesselGraphSystem.h"
21#include "VesselGraphTypes.h"
22
23// graph includes
25#include "mlPropertiesMacros.h"
26
28#include <boost/shared_ptr.hpp>
30
32
35{
36 friend class Graph;
37 friend class VesselEdge;
38
39public:
41 Skeleton(const PropertyManager::Pointer& manager, const Vector3& pos = Vector3(0), double minDistance = 0,
42 double maxDistance = 0);
43
46
48
50
51 bool operator==(const Skeleton& other) const;
52 bool operator!=(const Skeleton& other) const
53 {
54 return !(*this == other);
55 }
56
59 STATIC_GRAPH_PROPERTY(Vector3, pos, Pos)
60
61
63 ImageVector voxelPos();
64
66 void transform(const Matrix4& m);
67
69 void convertToVoxel(Matrix4* mat);
70 void convertToWorld(Matrix4* mat);
72
75 STATIC_GRAPH_PROPERTY(double, minDistance, MinDistance);
76
77 //----------------------------------------------------------------------------
80 //----------------------------------------------------------------------------
81 size_t getVoxelNum() const
82 {
83 return _vesselCoordinates.size() + 1;
84 }
85 size_t numVesselPos() const
86 {
87 return _vesselCoordinates.size();
88 }
89 void addVesselPos(const Vector3& position)
90 {
91 _vesselCoordinates.push_back(position);
92 }
93 void addVesselPos(const ImageVector& v)
94 {
95 _vesselCoordinates.push_back(
96 Vector3(static_cast<MLdouble>(v.x), static_cast<MLdouble>(v.y), static_cast<MLdouble>(v.z)));
97 }
98 const Vector3& vesselPos(size_t index) const
99 {
100 return _vesselCoordinates.at(index);
101 }
102 Vector3& vesselPos(size_t index)
103 {
104 return _vesselCoordinates.at(index);
105 }
106 ImageVector vesselVoxelPos(size_t index);
108 {
109 _vesselCoordinates.clear();
110 }
112
113private:
116 std::vector<Vector3> _vesselCoordinates;
117
119
120public:
125 CONTINUOUS
126 };
128
133
140
141 void setRGBA(float r, float g, float b, float a)
142 {
143 _colorRGBA[0] = r;
144 _colorRGBA[1] = g;
145 _colorRGBA[2] = b;
146 _colorRGBA[3] = a;
147 }
148
149 void setRGBA(float* rgba)
150 {
151 for (size_t i = 0; i < 4; ++i) {
152 _colorRGBA[i] = rgba[i];
153 }
154 }
155
156 void getRGBA(float* r, float* g, float* b, float* a) const
157 {
158 *r = _colorRGBA[0];
159 *g = _colorRGBA[1];
160 *b = _colorRGBA[2];
161 *a = _colorRGBA[3];
162 }
163
164 float* getRGBA(void)
165 {
166 return _colorRGBA;
167 }
169
171 void addStateToTree(TreeNode* parent) const override;
175 void readStateFromTree(TreeNode* parent) override;
176
178 static void setCopyVesselVoxels(bool flag)
179 {
180 Skeleton::_copyVesselVoxels = flag;
181 }
183 {
184 Skeleton::_copyVesselVoxels = true;
185 }
186
187private:
190 static bool _copyVesselVoxels;
191
193 float _colorRGBA[4];
194
196};
197
199
200#endif // __mlSkeleton_H
Defines the basic Graph class which holds sets of nodes, edges and roots to model tubular structures ...
Definition mlGraph.h:64
boost::intrusive_ptr< type > Pointer
Skeleton objects represent centerline voxels stored in a VesselEdge object.
Definition mlSkeleton.h:35
STATIC_GRAPH_PROPERTY(double, label, Label)
STATIC_GRAPH_PROPERTY(MLuint64, enumLabel, EnumLabel)
label to enumerate the skeleton within a graph. not enumerated value is 0. not persistent.
STATIC_GRAPH_PROPERTY(double, freeLabel, FreeLabel)
static void setCopyVesselVoxelsDefault(void)
Definition mlSkeleton.h:182
const Vector3 & vesselPos(size_t index) const
Definition mlSkeleton.h:98
STATIC_GRAPH_PROPERTY(double, distanceLabel, DistanceLabel)
void copyProperties(const Skeleton *other)
bool operator==(const Skeleton &other) const
float * getRGBA(void)
Definition mlSkeleton.h:164
void readStateFromTree(TreeNode *parent) override
Reads the object state from the children of the given parent node.
void clearVesselPos()
Definition mlSkeleton.h:107
static void setCopyVesselVoxels(bool flag)
Set global parameter for skeleton copy.
Definition mlSkeleton.h:178
Skeleton(const PropertyManager::Pointer &manager, const Vector3 &pos=Vector3(0), double minDistance=0, double maxDistance=0)
Constructor.
void addVesselPos(const ImageVector &v)
Definition mlSkeleton.h:93
size_t numVesselPos() const
Definition mlSkeleton.h:85
STATIC_CASTED_GRAPH_PROPERTY(LABELTYPE, MLuint64, labelType, LabelType)
Skeleton(const Skeleton &other)
Copy Constructor.
ML_SET_ADDSTATE_VERSION(5)
Set current addStateToTree() version number:
void addVesselPos(const Vector3 &position)
Definition mlSkeleton.h:89
Vector3 & vesselPos(size_t index)
Definition mlSkeleton.h:102
ImageVector vesselVoxelPos(size_t index)
Skeleton & operator=(const Skeleton &other)
void addStateToTree(TreeNode *parent) const override
Attaches the object state as children of the given parent node.
bool operator!=(const Skeleton &other) const
Definition mlSkeleton.h:52
void setRGBA(float r, float g, float b, float a)
Definition mlSkeleton.h:141
STATIC_GRAPH_PROPERTY(double, area, Area)
void setRGBA(float *rgba)
Definition mlSkeleton.h:149
void getRGBA(float *r, float *g, float *b, float *a) const
Definition mlSkeleton.h:156
Class VesselEdge.
#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.
UINT64 MLuint64
Introduce platform-independent 64-bit unsigned integer type.
Definition mlTypeDefs.h:424
double MLdouble
Definition mlTypeDefs.h:217
#define VESSELGRAPH_END_NAMESPACE
#define VESSELGRAPH_EXPORT
Definiert systemspezifische Macros, die f"ur diese DLL gelten sollen.
#define VESSELGRAPH_BEGIN_NAMESPACE