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 {
36 friend class Graph;
37 friend class VesselEdge;
38 
39 public:
41  Skeleton(const PropertyManager::Pointer& manager, const Vector3& pos=Vector3(0), double minDistance=0, double maxDistance=0);
42 
44  Skeleton(const Skeleton& other);
45 
46  Skeleton& operator=(const Skeleton& other);
47 
48  void copyProperties(const Skeleton* other);
49 
50  bool operator==(const Skeleton& other) const;
51  bool operator!=(const Skeleton& other) const { return !(*this==other); }
52 
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 
87 private:
90  std::vector<Vector3> _vesselCoordinates;
91 
92  STATIC_GRAPH_PROPERTY(double, maxDistance, MaxDistance);
93 public:
96  enum LABELTYPE {TRACECOLOR,CONTINUOUS};
98 
99  STATIC_GRAPH_PROPERTY(double, area, Area);
100  STATIC_GRAPH_PROPERTY(double, distanceLabel, DistanceLabel);
101  STATIC_GRAPH_PROPERTY(double, freeLabel, FreeLabel);
102  STATIC_GRAPH_PROPERTY(double, label, Label);
103 
109  STATIC_GRAPH_PROPERTY(MLuint64, enumLabel, EnumLabel);
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 
145 private:
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
ML_ABSTRACT_CLASS_HEADER(PropertyContainer)
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
STATIC_GRAPH_PROPERTY(double, distanceLabel, DistanceLabel)
void copyProperties(const Skeleton *other)
float * getRGBA(void)
Definition: mlSkeleton.h:129
bool operator==(const Skeleton &other) const
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)
const Vector3 & vesselPos(size_t index) const
Definition: mlSkeleton.h:81
Skeleton(const Skeleton &other)
Copy Constructor.
Vector3 & vesselPos(size_t index)
Definition: mlSkeleton.h:82
ML_SET_ADDSTATE_VERSION(5)
Set current addStateToTree() version number:
void addVesselPos(const Vector3 &position)
Definition: mlSkeleton.h:79
Skeleton & operator=(const Skeleton &other)
ImageVector vesselVoxelPos(size_t index)
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.
Definition: mlVesselEdge.h:35
size_t getVoxelNum() const
Get number of edge voxels.
void transform(const Matrix4 &m)
Apply a 4x4 homogeneous transformation matrix to all skeleton positions.
void convertToVoxel(Matrix4 *mat)
Convert all skeleton coordinates.
void convertToWorld(Matrix4 *mat)
#define STATIC_GRAPH_PROPERTY(Type, lowerCaseName, upperCaseName)
UINT64 MLuint64
Introduce platform independent 64 bit unsigned integer type.
Definition: mlTypeDefs.h:513
double MLdouble
Definition: mlTypeDefs.h:223
#define VESSELGRAPH_END_NAMESPACE
#define VESSELGRAPH_EXPORT
Definiert systemspezifische Macros, die f"ur diese DLL gelten sollen.
#define VESSELGRAPH_BEGIN_NAMESPACE
Tmat4< MLdouble > Matrix4
The standard 4x4 matrix of type double.
Definition: mlMatrix4.h:726
Tvec3< MLdouble > Vector3
A vector with 3 components of type double.
Definition: mlVector3.h:300
TImageVector< MLint > ImageVector
Defines the standard ImageVector type which is used by the ML for indexing and coordinates.