MeVisLab Toolbox Reference
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 
25 ML_START_NAMESPACE
26 
27 
28 // Forward declaration
29 class CSOSeedPoint;
30 
32 
37 {
38 
39 public:
40 
44  CSOPathPoints(const CSOPathPoints &pathPoints);
46  virtual ~CSOPathPoints();
47 
49  inline void appendPosition(const Vector3& pos) { Vector4 entry(pos[0], pos[1], pos[2], 0); _wPositions.push_back(entry); }
50 
52  inline unsigned int numPathPoints() const { return static_cast<unsigned int>(_wPositions.size()); }
55  inline float getValueAt(unsigned int index) const { return static_cast<float>(_wPositions[index][3]); }
58  inline const Vector4& getPosValueAt(unsigned int index) const { return _wPositions[index]; }
61  inline Vector3 getPosAt(unsigned int index) const { const Vector4& atIndex = _wPositions[index];
62  const Vector3 retPos(atIndex[0],
63  atIndex[1],
64  atIndex[2]);
65  return retPos; }
66 
68  inline void getPosAt(unsigned int index, Vector3& pos) { pos = getPosAt(index); }
69  inline void getPosAt(unsigned int index, Vector4& pos) { pos = getPosValueAt(index); }
70 
72  void setAllValuesTo(float value);
73 
75  void setAllValuesTo(float startVal, float endVal);
76 
78  void setValueAt(const float value, unsigned int index);
80  void setPosValueAt(const Vector4& posVal, unsigned int index);
82  void setPosAt(const Vector3& pos, unsigned int index);
83 
85  inline void clearPositions() { _wPositions.clear(); }
86 
88  double getLength() const;
89 
91  void movePathPoints(double x, double y, double z);
92 
97  void removePositions(unsigned int startIndex, unsigned int endIndex);
98 
100  void getPositionValues(std::vector<Vector4>& posValues) const;
102  void getWorldPositions(std::vector<Vector3>& positions) const;
104  void setPositionValues(const std::vector<Vector4>& newPosValues);
106  void setWorldPositions(const std::vector<Vector3>& newPositions);
107 
111  CSOBoundingBox getVoxelBoundingBox(const Matrix4& worldToVoxelMatrix, size_t hashKey);
112 
115  void pathChanged();
116 
121 
122 #if ML_DEPRECATED_SINCE(3,5,0)
125  ML_DEPRECATED void invalidateBoundingBoxes() { pathChanged(); }
126 #endif
127 
128 private:
129 
130  /* STATE VARIABLES */
131 
133  std::vector<Vector4>_wPositions;
134 
136  bool _hasValidWorldBoundingBox;
137 
139  CSOBoundingBox _worldBoundingBox;
140 
142  boost::unordered_map < MatrixHashPair, CSOBoundingBox, MatrixHashFunction > _voxelBoundingBoxCache;
143 };
144 
146 
147 ML_END_NAMESPACE
#define ML_DEPRECATED
Definition: CSOGroup.h:371
#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 which are interpolated by a certain interpolation sc...
Definition: CSOPathPoints.h:37
const Vector4 & getPosValueAt(unsigned int index) const
Returns a positions with a value at a given index.
Definition: CSOPathPoints.h:58
unsigned int numPathPoints() const
Returns the number of stored points.
Definition: CSOPathPoints.h:52
void appendPosition(const Vector3 &pos)
Adds a new position to the internal vector.
Definition: CSOPathPoints.h:49
void getPosAt(unsigned int index, Vector3 &pos)
Variants of getPosAt for use in templates.
Definition: CSOPathPoints.h:68
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 given value.
void setPositionValues(const std::vector< Vector4 > &newPosValues)
Sets the position/value pairs from the given 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)
Definition: CSOPathPoints.h:69
float getValueAt(unsigned int index) const
Returns a value at a given index.
Definition: CSOPathPoints.h:55
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 given index.
void setPosAt(const Vector3 &pos, unsigned int index)
Sets the given position at the given index.
void getWorldPositions(std::vector< Vector3 > &positions) const
Fills the given vector with all the internal positions.
void setPosValueAt(const Vector4 &posVal, unsigned int index)
Sets a position/value pair at the given index.
void removePositions(unsigned int startIndex, unsigned int endIndex)
Removes positions from the internal vector in the given range.
void setWorldPositions(const std::vector< Vector3 > &newPositions)
Sets the coordinates from the given vector as the PathPoints world positions.
const CSOBoundingBox & getWorldBoundingBox()
Returns the world bounding box for this PathPoints.
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 given offset.
Vector3 getPosAt(unsigned int index) const
Returns a position at a given index index.
Definition: CSOPathPoints.h:61
void getPositionValues(std::vector< Vector4 > &posValues) const
Fills the given vector with all position/value pairs.
void clearPositions()
Clears internal world positions.
Definition: CSOPathPoints.h:85
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.
Definition: CSOSeedPoint.h:35