MeVisLab Toolbox Reference
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{
36friend class Graph;
37friend class VesselEdge;
38
39public:
41 Skeleton(const PropertyManager::Pointer& manager, const Vector3& pos=Vector3(0), double minDistance=0, double maxDistance=0);
42
45
47
49
50 bool operator==(const Skeleton& other) const;
51 bool operator!=(const Skeleton& other) const { return !(*this==other); }
52
55 STATIC_GRAPH_PROPERTY(Vector3, pos, Pos)
56
57
59 ImageVector voxelPos();
60
62 void transform(const Matrix4& m);
63
65 void convertToVoxel(Matrix4* mat);
66 void convertToWorld(Matrix4* mat);
68
71 STATIC_GRAPH_PROPERTY(double, minDistance, MinDistance);
72
73 //----------------------------------------------------------------------------
76 //----------------------------------------------------------------------------
77 size_t getVoxelNum() const { return _vesselCoordinates.size()+1; }
78 size_t numVesselPos() const { return _vesselCoordinates.size(); }
79 void addVesselPos(const Vector3 &position) { _vesselCoordinates.push_back(position); }
80 void addVesselPos(const ImageVector &v) { _vesselCoordinates.push_back(Vector3(static_cast<MLdouble>(v.x), static_cast<MLdouble>(v.y), static_cast<MLdouble>(v.z))); }
81 const Vector3 &vesselPos(size_t index) const { return _vesselCoordinates.at(index); }
82 Vector3 &vesselPos(size_t index) { return _vesselCoordinates.at(index); }
83 ImageVector vesselVoxelPos(size_t index);
84 void clearVesselPos() { _vesselCoordinates.clear(); }
86
87private:
90 std::vector<Vector3> _vesselCoordinates;
91
93public:
96 enum LABELTYPE {TRACECOLOR,CONTINUOUS};
98
103
110
111 void setRGBA( float r, float g, float b, float a ) {
112 _colorRGBA[0] = r;
113 _colorRGBA[1] = g;
114 _colorRGBA[2] = b;
115 _colorRGBA[3] = a;
116 }
117
118 void setRGBA( float* rgba ){
119 for ( size_t i=0; i<4; ++i ) { _colorRGBA[i] = rgba[i]; }
120 }
121
122 void getRGBA( float* r, float* g, float* b, float* a ) const {
123 *r = _colorRGBA[0];
124 *g = _colorRGBA[1];
125 *b = _colorRGBA[2];
126 *a = _colorRGBA[3];
127 }
128
129 float *getRGBA(void){
130 return _colorRGBA;
131 }
133
135 void addStateToTree(TreeNode* parent) const override;
139 void readStateFromTree(TreeNode* parent) override;
140
142 static void setCopyVesselVoxels ( bool flag ){ Skeleton::_copyVesselVoxels = flag; }
143 static void setCopyVesselVoxelsDefault( void ) { Skeleton::_copyVesselVoxels = true; }
144
145private:
148 static bool _copyVesselVoxels;
149
151 float _colorRGBA[4];
152
154};
155
157
158#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:143
const Vector3 & vesselPos(size_t index) const
Definition mlSkeleton.h:81
STATIC_GRAPH_PROPERTY(double, distanceLabel, DistanceLabel)
void copyProperties(const Skeleton *other)
bool operator==(const Skeleton &other) const
float * getRGBA(void)
Definition mlSkeleton.h:129
void readStateFromTree(TreeNode *parent) override
Reads the object state from the children of the given parent node.
void clearVesselPos()
Definition mlSkeleton.h:84
static void setCopyVesselVoxels(bool flag)
Set global parameter for skeleton copy.
Definition mlSkeleton.h:142
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:80
size_t numVesselPos() const
Definition mlSkeleton.h:78
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:79
Vector3 & vesselPos(size_t index)
Definition mlSkeleton.h:82
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:51
void setRGBA(float r, float g, float b, float a)
Definition mlSkeleton.h:111
STATIC_GRAPH_PROPERTY(double, area, Area)
void setRGBA(float *rgba)
Definition mlSkeleton.h:118
void getRGBA(float *r, float *g, float *b, float *a) const
Definition mlSkeleton.h:122
Class VesselEdge.
#define ML_ABSTRACT_CLASS_HEADER(className)
Same like 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:425
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