MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
CSOPathPoints.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
17
18#pragma once
19
20
21#include "MLCSOIncludes.h"
22#include "CSOBoundingBox.h"
23#include <mlMacros.h>
24
26
27
28// Forward declaration
29class CSOSeedPoint;
30
32
37{
38
39public:
45 virtual ~CSOPathPoints();
46
48 inline void appendPosition(const Vector3& pos)
49 {
50 Vector4 entry(pos[0], pos[1], pos[2], 0);
51 _wPositions.push_back(entry);
52 }
53
55 inline unsigned int numPathPoints() const
56 {
57 return static_cast<unsigned int>(_wPositions.size());
58 }
61 inline float getValueAt(unsigned int index) const
62 {
63 return static_cast<float>(_wPositions[index][3]);
64 }
67 inline const Vector4& getPosValueAt(unsigned int index) const
68 {
69 return _wPositions[index];
70 }
73 inline Vector3 getPosAt(unsigned int index) const
74 {
75 const Vector4& atIndex = _wPositions[index];
76 const Vector3 retPos(atIndex[0], atIndex[1], atIndex[2]);
77 return retPos;
78 }
79
81 inline void getPosAt(unsigned int index, Vector3& pos)
82 {
83 pos = getPosAt(index);
84 }
85 inline void getPosAt(unsigned int index, Vector4& pos)
86 {
87 pos = getPosValueAt(index);
88 }
89
91 void setAllValuesTo(float value);
92
94 void setAllValuesTo(float startVal, float endVal);
95
97 void setValueAt(const float value, unsigned int index);
99 void setPosValueAt(const Vector4& posVal, unsigned int index);
101 void setPosAt(const Vector3& pos, unsigned int index);
102
104 inline void clearPositions()
105 {
106 _wPositions.clear();
107 }
108
110 double getLength() const;
111
113 void movePathPoints(double x, double y, double z);
114
119 void removePositions(unsigned int startIndex, unsigned int endIndex);
120
122 void getPositionValues(std::vector<Vector4>& posValues) const;
124 void getWorldPositions(std::vector<Vector3>& positions) const;
126 void setPositionValues(const std::vector<Vector4>& newPosValues);
128 void setWorldPositions(const std::vector<Vector3>& newPositions);
129
133 CSOBoundingBox getVoxelBoundingBox(const Matrix4& worldToVoxelMatrix, size_t hashKey);
134
138
143
144private:
145 /* STATE VARIABLES */
146
148 std::vector<Vector4> _wPositions;
149
151 bool _hasValidWorldBoundingBox;
152
154 CSOBoundingBox _worldBoundingBox;
155
157 boost::unordered_map<MatrixHashPair, CSOBoundingBox, MatrixHashFunction> _voxelBoundingBoxCache;
158};
159
161
#define MLCSO_EXPORT
Defines export symbols for classes, so they can be used in other DLLs.
Definition MLCSOSystem.h:23
The CSOBoundingBox defines an axis-parallel bounding box with double precision.
The CSOPathPoints is a list of world coordinates that are interpolated by a certain interpolation sch...
const Vector4 & getPosValueAt(unsigned int index) const
Returns a position with a value at a specified index.
const CSOBoundingBox & getWorldBoundingBox()
Returns the world bounding box for this PathPoints.
unsigned int numPathPoints() const
Returns the number of stored points.
void appendPosition(const Vector3 &pos)
Adds a new position to the internal vector.
void getPosAt(unsigned int index, Vector3 &pos)
Variants of getPosAt for use in templates.
CSOBoundingBox getVoxelBoundingBox(const Matrix4 &worldToVoxelMatrix, size_t hashKey)
Returns the voxel bounding box for this PathPoints.
virtual ~CSOPathPoints()
Standard destructor.
void setAllValuesTo(float value)
Sets all posValues to the specified value.
void setPositionValues(const std::vector< Vector4 > &newPosValues)
Sets the position/value pairs from the specified vector.
void setAllValuesTo(float startVal, float endVal)
Sets all posValues from first pos:startVal to last pos-:endVal.
void getPosAt(unsigned int index, Vector4 &pos)
float getValueAt(unsigned int index) const
Returns a value at a specified index.
CSOPathPoints(const CSOPathPoints &pathPoints)
Copy constructor.
CSOSeedPoint * tailSeedPoint
A pointer to this path's tail seed point.
void removePositions()
Removes all positions from the internal vector and marks this path point list as being changed (for b...
void setValueAt(const float value, unsigned int index)
Sets a value at the specified index.
void setPosAt(const Vector3 &pos, unsigned int index)
Sets the specified position at the specified index.
void getWorldPositions(std::vector< Vector3 > &positions) const
Fills the specified vector with all the internal positions.
void setPosValueAt(const Vector4 &posVal, unsigned int index)
Sets a position/value pair at the specified index.
void removePositions(unsigned int startIndex, unsigned int endIndex)
Removes positions from the internal vector in the specified range.
void setWorldPositions(const std::vector< Vector3 > &newPositions)
Sets the coordinates from the specified vector as the PathPoints world positions.
CSOPathPoints()
Standard constructor.
double getLength() const
Returns the length of this path point list.
void movePathPoints(double x, double y, double z)
Moves all the path points by the specified offset.
Vector3 getPosAt(unsigned int index) const
Returns a position at a specified index index.
void getPositionValues(std::vector< Vector4 > &posValues) const
Fills the specified vector with all position/value pairs.
void clearPositions()
Clears internal world positions.
void pathChanged()
Invalidates the world and voxel bounding boxes, so they are computed anew.
CSOSeedPoint * headSeedPoint
A pointer to this path's head seed point.
The CSOSeedPoint can be interactively set and modified, and is the framework for contours.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.