MeVisLab Toolbox Reference
CSO.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 
15 
16 #pragma once
17 
18 
19 #include "MLCSOIncludes.h"
20 
21 #include "CSOAttributes.h"
22 #include "CSOBase/CSOGroup.h"
23 #include "CSOBase/CSOSeedPoint.h"
24 #include "CSOBase/CSOPathPoints.h"
25 #include "CSOBase/CSOBoundingBox.h"
26 
27 
28 ML_START_NAMESPACE
29 
30 
31 // Forward declaration.
32 class CSOList;
33 class CSOManager;
34 
35 
37 
44 {
45 
46 public:
47 
49  CSO();
51  CSO(CSOList* csoList);
55  CSO(const CSO &cso, CSOList* csoList=nullptr, unsigned int csoId = INVALID_CSO_ID);
57  virtual ~CSO();
58 
59 
60  /* METHODS */
61 
63 
64 
67 
71 
73  inline void storeInUndoManager() { setInsertRemoveSeedPointCommand(); }
75 
77 
83  void applyTransformationMatrix(const Matrix4& matrix);
85  void moveSeedPointsAndPathPoints(const Vector3& offset, int timepoint);
87  void moveSeedPointsAndPathPoints(double dx, double dy, double dz, int timepoint);
89  void moveSeedPointsAndPathPoints(const Vector3& offset);
91  void moveSeedPointsAndPathPoints(double dx, double dy, double dz);
92 
94  void setAbsoluteMovementCommand(double fromX, double fromY, double fromZ, double toX, double toY, double toZ, int fromTimePointIndex, int toTimePointIndex);
96  void moveSingleSeedPoint(CSOSeedPoint* sPoint, double dx, double dy, double dz);
100  void setSeedPointsAndPathPoints(const CSO* cso);
102 
111 
119  void setSeedAndPathPoints(unsigned int numSeedPoints, bool isClosed=true);
122  void setInitialSeedAndPathPointsNoEvent(unsigned int numSeedPoints, bool isClosed = true);
136  CSOSeedPoint* insertSeedPointAt(CSOPathPoints* toBeSplitPath, const Vector3& toInsertPos);
140 
146  CSOSeedPoint* getSeedPointAt(unsigned int index) const;
148  inline CSOSeedPoint* getFirstSeedPoint() const { if (numSeedPoints()) { return _seedPointList[0]; } else { return nullptr; } }
150  inline CSOSeedPoint* getLastSeedPoint() const { if (numSeedPoints()) { return _seedPointList[numSeedPoints()-1];} else { return nullptr; } }
152  inline unsigned int numSeedPoints() const { return static_cast<unsigned int>(_seedPointList.size()); }
154  bool getSeedPointIndex(CSOSeedPoint* sPoint, unsigned int& index) const;
156  inline unsigned int numPathPointLists() const { return static_cast<unsigned int>(_pathPointsList.size()); }
158  void fillPathPointCoordinatesFlattened(std::vector<Vector3>& pathPointCoords) const;
160  void fillPathPointCoordinatesFlattened(std::vector<Vector4>& pathPointCoordsAndValues) const;
163  inline CSOPathPoints* getPathPointsAt(unsigned int index) const { return _pathPointsList[index]; }
165  unsigned int getTotalNumPathPoints() const;
167  unsigned int getTotalNumUniquePathPoints() const;
168 
170  void swapPoints(CSO& other);
171 
173 
175  bool isSelected() const;
176 
186  void setSeedPointSelectedAt(unsigned int index);
188  bool isSelectedSeedPoint(CSOSeedPoint* sPoint) const;
192  unsigned int getNumSelectedSeedPoints() const;
194  CSOSeedPoint* getSelectedSeedPointAt(unsigned int index) const;
196 
203  bool addToGroup(CSOGroup& group, bool useUndoRedo=true);
205  void removeFromGroup(CSOGroup &group, bool useUndoRedo=true);
207  bool isInGroup(const CSOGroup* group) const;
208  // Returns whether this CSO is in a same Group as the given CSO.
209  bool isInSameGroupsAs(CSO* cso) const;
211  bool isInGroup(unsigned int groupId) const;
213  inline unsigned int numGroups() const { return static_cast<unsigned int>(_csoGroupIds.size()); }
215  CSOGroup* getGroupAt(unsigned int index) const;
218  inline unsigned int getGroupIdAt(unsigned int index) const { return _csoGroupIds[index]; }
222 
227  void _addReferenceToGroup(const CSOGroup& group);
229  void _removeReferenceToGroup(const CSOGroup &group);
231 
237  inline void setType(const std::string& type) { _type = type; }
239  inline const std::string& getType() const { return _type; }
241  inline void setSubType(const std::string& subtype) { _subtype = subtype; }
243  inline const std::string& getSubType() const { return _subtype; }
245  inline void setCreatorId(int id) { _creatorId = id; }
247  inline int getCreatorId() const { return _creatorId; }
249 
255  inline void setUserData(const std::string& name, Variant value) { _attributes.setUserData(name, value); }
257  inline Variant getUserData(const std::string& name) const { return _attributes.getUserData(name); }
259  inline void getUserDataNames(std::vector< std::string >& names) const { _attributes.getUserDataNames(names); }
261  inline void removeUserData(const std::string& name) { _attributes.removeUserData(name); }
263 
271  CSOBoundingBox getVoxelBoundingBox(const Matrix4& worldToVoxelMatrix, size_t hashKey) const;
273  CSOBoundingBox getVoxelBoundingBoxSeedPoints(const Matrix4& worldToVoxelMatrix, size_t hashKey) const;
276  inline bool isInPlane() const { Vector3 dummy; return isInPlane(dummy); }
279  bool isInPlane(Vector3& planeNormal) const;
281  inline const Vector3& getPlaneNormal() const { _computeIsInPlane(); return _planeNormal; }
283  inline void computePlaneNormal() { _computeIsInPlane(); }
286  inline void setIsInPlane(bool status) { _isInPlane = status; }
288  inline void setPlaneNormal(const Vector3& planeNormal) { _planeNormal = planeNormal; _hasValidPlaneStatus = true; }
290  inline void invalidatePlaneNormal() { _hasValidPlaneStatus = false; }
292  double getLength() const;
294  inline double getArea() const { _computeArea(); return _area; }
296  inline void invalidateArea() { _hasValidArea = false; }
298  bool isSelfIntersecting() const;
304  void setIsClosed(bool isClosed);
306  inline bool isClosed() const { return _isClosed; }
308  bool isPoint() const;
310  bool isEmpty() const;
312  inline void setIsFinished(bool isFinished) { _isFinished = isFinished; }
314  inline bool getIsFinished() const { return _isFinished; }
316  inline void setNeedsInterpolation(bool needsInterpolation) { _needsInterpolation = needsInterpolation; }
318  inline bool getNeedsInterpolation() const { return _needsInterpolation; }
322  void setNeedInterpolationAllSeedPoints(bool needsInterpolation);
324  inline void setNeedInterpolation(CSOSeedPoint* seedPoint) { if (seedPoint != nullptr) { seedPoint->setNeedsInterpolation(true); _needsInterpolation = true; } }
326  void pathChanged();
328 
336  void setCSOList(CSOList* csoList);
338  inline CSOList* getCSOList() const { return _csoList; }
340  inline unsigned int getId() const { return _uniqueId; }
342 
348  void setLabel(const std::string& label);
350  inline const std::string& getLabel() const { return _attributes.label; }
352  void setDescription(std::string description);
354  inline const std::string& getDescription() const { return _attributes.description; }
355 
359  int getTimePointIndex() const;
361  void setShowState(bool state);
363  bool getShowState() const;
365  void setVoxelizeState(bool state);
367  bool getVoxelizeState() const;
369  void setEditableState(bool state);
371  bool getEditableState() const;
375  inline void setPathPointStyle(int style) { setPathPointStyle(static_cast<CSOPathPointsStyle>(style)); }
379  void setPathPointWidth(float width);
381  float getPathPointWidth() const;
383  void setPathPointColor(const Vector3& color);
387  void setPathPointAlpha(float alpha);
389  float getPathPointAlpha() const;
391  void setSeedPointStyle(int style);
393  int getSeedPointStyle() const;
395  void setSeedPointSize(float size);
397  float getSeedPointSize() const;
399  void setSeedPointColor(const Vector3& color);
403  void setSeedPointAlpha(float alpha);
405  float getSeedPointAlpha() const;
406 
408  void setVoxelWriteMode(int mode);
410  int getVoxelWriteMode() const;
412  void setVoxelWriteValue(float value);
414  float getVoxelWriteValue() const;
415 
417  void setAllValuesTo(float value);
419 
425  inline int getPrivateTimePointIndex() const { return _attributes.timePointIndex; }
427  inline bool getPrivateShowState() const { return _attributes.showState; }
429  inline bool getPrivateVoxelizeState() const { return _attributes.voxelizeState; }
431  inline bool getPrivateEditableState() const { return _attributes.editableState; }
433  inline int getPrivatePathPointStyle() const { return _attributes.pathPointStyle; }
435  inline float getPrivatePathPointWidth() const { return _attributes.pathPointWidth; }
437  inline Vector3 getPrivatePathPointColor() const { return _attributes.pathPointColor; }
439  inline float getPrivatePathPointAlpha() const { return _attributes.pathPointAlpha; }
441  inline int getPrivateSeedPointStyle() const { return _attributes.seedPointStyle; }
443  inline float getPrivateSeedPointSize() const { return _attributes.seedPointSize; }
445  inline Vector3 getPrivateSeedPointColor() const { return _attributes.seedPointColor; }
447  inline float getPrivateSeedPointAlpha() const { return _attributes.seedPointAlpha; }
448 
450  inline int getPrivateVoxelWriteMode() const { return _attributes.voxelWriteMode; }
452  inline float getPrivateVoxelWriteValue() const { return _attributes.voxelWriteValue; }
453 
454 
456  inline void setPrivateIsFinished(bool isFinished) { _isFinished = isFinished; }
458  inline void setPrivateIsClosed(bool isClosedP) { _isClosed = isClosedP; }
460  inline void setPrivateIsInPlane(bool isInPlaneP) { _isInPlane = isInPlaneP; }
462  inline void setPrivateBoundingBox(const CSOBoundingBox& bb) { _worldBoundingBox = bb; _hasValidWorldBoundingBox = true; }
464  inline void setPrivatePlaneNormal(const Vector3& normal) { _planeNormal = normal; _hasValidPlaneStatus = true; }
467  void setId(unsigned int newId);
469 
471  void setAttributesFrom(const CSO* const cso);
472 
474  bool saveAttributes(std::ostream& outStream, bool useAscii=false);
475 
477  void loadAttributes(std::istream& inStream, short version, bool swapBytes, bool useAscii=false);
478 
480  const CSOAttributes& getAttributes() const { return _attributes; }
481 
483  CSOAttributes& getWritableAttributes() { return _attributes; }
484 
485 #if ML_DEPRECATED_SINCE(3,5,0)
489  inline ML_DEPRECATED void moveSeedPoints(double dx, double dy, double dz, int timepoint) {
490  moveSeedPointsAndPathPoints(dx,dy,dz,timepoint);
491  }
494  inline ML_DEPRECATED void setLineStyle(CSOLineStyle style) { setPathPointStyle(style); }
497  inline ML_DEPRECATED CSOLineStyle getLineStyle() const { return static_cast<CSOLineStyle>(getPathPointStyle()); }
500  inline ML_DEPRECATED void setColor(const Vector3& color) { setPathPointColor(color); }
503  inline ML_DEPRECATED Vector3 getColor() const { return getPathPointColor(); }
506  inline ML_DEPRECATED void setAlpha(float alpha) { setPathPointAlpha(alpha); }
509  inline ML_DEPRECATED float getAlpha() const { return getPathPointAlpha(); }
512  inline ML_DEPRECATED void setLineWidth(float width) { setPathPointWidth(width); }
515  inline ML_DEPRECATED float getLineWidth() const { return getPathPointWidth(); }
518  inline ML_DEPRECATED void setMarkerMode(int mode) { setSeedPointStyle(mode); }
521  inline ML_DEPRECATED int getMarkerMode() const { return getSeedPointStyle(); }
524  inline ML_DEPRECATED void setMarkerColor(const Vector3& color) { setSeedPointColor(color); }
527  inline ML_DEPRECATED Vector3 getMarkerColor() const { return getSeedPointColor(); }
530  inline ML_DEPRECATED void setMarkerAlpha(float alpha) { setSeedPointAlpha(alpha); }
533  inline ML_DEPRECATED float getMarkerAlpha() const { return getSeedPointAlpha();}
536  inline ML_DEPRECATED void setMarkerSize(float size) { setSeedPointSize(size); }
539  inline ML_DEPRECATED float getMarkerSize() const { return getSeedPointSize(); }
542  inline ML_DEPRECATED CSOLineStyle getPrivateLineStyle() const { return static_cast<CSOLineStyle>(getPrivatePathPointStyle()); }
545  inline ML_DEPRECATED Vector3 getPrivateColor() const { return getPrivatePathPointColor(); }
548  inline ML_DEPRECATED float getPrivateAlpha() const { return getPrivatePathPointAlpha(); }
551  inline ML_DEPRECATED float getPrivateLineWidth() const { return getPrivatePathPointWidth(); }
554  inline ML_DEPRECATED int getPrivateMarkerMode() const { return getPrivateSeedPointStyle(); }
557  inline ML_DEPRECATED Vector3 getPrivateMarkerColor() const { return getPrivateSeedPointColor(); }
560  inline ML_DEPRECATED float getPrivateMarkerAlpha() const { return getPrivateSeedPointAlpha(); }
563  inline ML_DEPRECATED float getPrivateMarkerSize() const { return getPrivateSeedPointSize(); }
566  inline ML_DEPRECATED void removeGroup(CSOGroup& group, bool useUndoRedo = true) { removeFromGroup(group, useUndoRedo); }
569  inline ML_DEPRECATED void addGroup(CSOGroup& group, bool useUndoRedo = true) { addToGroup(group, useUndoRedo); }
572  inline ML_DEPRECATED void removeAllGroups() { removeFromAllGroups(); }
574 #endif
575 
576 protected:
577 
578 private:
579 
583  template <class Method>
584  int getOverrideGroupIndexForAttribute(Method method) const; // (defined in source file)
585 
587  template<class T>
588  void _fillPathPointCoordinatesFlattened(std::vector<T>& pathPointCoords) const;
589 
590  /* MEMBER VARIABLES */
591 
593  unsigned int _uniqueId;
594 
596  std::vector<CSOSeedPoint*> _seedPointList;
598  std::vector<CSOPathPoints*> _pathPointsList;
599 
600  friend class CSOList;
601 
603  CSOList* _csoList{};
604 
606  std::vector<unsigned int> _csoGroupIds;
607 
609  std::vector<unsigned int> _selectedSeedPointsIndices;
610 
612  std::string _type{"TYPE_NOT_SET"};
614  std::string _subtype{"SUB_TYPE_NOT_SET"};
616  int _creatorId{};
617 
619  CSOAttributes _attributes;
620 
622  mutable bool _hasValidWorldBoundingBox{};
624  mutable CSOBoundingBox _worldBoundingBox;
625 
627  mutable boost::unordered_map < MatrixHashPair, CSOBoundingBox, MatrixHashFunction > _voxelBoundingBoxCache;
629  mutable boost::unordered_map < MatrixHashPair, CSOBoundingBox, MatrixHashFunction > _voxelSeedPointBoundingBoxCache;
630 
632  mutable bool _hasValidPlaneStatus{};
634  mutable bool _hasValidArea{};
635 
637  mutable bool _hasValidSelfIntersectingStatus{};
638 
639 
641  bool _isFinished{};
643  bool _isClosed{};
645  mutable bool _isInPlane{};
647  mutable Vector3 _planeNormal;
648 
650  bool _needsInterpolation{};
651 
653  mutable double _area{};
654 
656  mutable bool _isSelfIntersecting{};
657 
658 
659  /* METHODS */
660 
662  void _computeIsInPlane() const;
664  void _computeArea() const;
666  void _resetSeedPathLinks();
667 };
668 
670 
671 ML_END_NAMESPACE
#define ML_DEPRECATED
Definition: CSOGroup.h:371
const unsigned int INVALID_CSO_ID
Defines a CSO/CSOGroup id that is invalid.
Definition: MLCSOIncludes.h:65
#define MLCSO_EXPORT
Defines export symbols for classes, so they can be used in other DLLs.
Definition: MLCSOSystem.h:23
This class comprises some attributes that are common for a CSO and a CSOGroup.
The CSOBoundingBox defines an axis parallel bounding box with double precision.
A CSOGroup comprises a number of CSOs, which themselves can be in a number of different CSOGroups.
Definition: CSOGroup.h:38
A CSOList comprises a number of CSOs and CSOGroups and is the central object for contour segmentation...
Definition: CSOList.h:61
The CSOManager allows for storing and iterating CSOs, and implements an undo/redo mechanism.
Definition: CSOManager.h:33
The CSOPathPoints is a list of world coordinates which are interpolated by a certain interpolation sc...
Definition: CSOPathPoints.h:37
The CSOSeedPoint can be interactively set and modified and is the framework for contours.
Definition: CSOSeedPoint.h:35
void setNeedsInterpolation(bool needsInterpolation)
Sets that this seed point needs interpolation (its incident path points).
The CSO represents a contour segmentation object.
Definition: CSO.h:44
void removeUserData(const std::string &name)
Removes a user data entry.
Definition: CSO.h:261
bool getPrivateEditableState() const
Returns the private attribute 'editableState'.
Definition: CSO.h:431
CSOSeedPoint * appendSeedAndPathPointNoEvent()
void invalidateArea()
Invalidates the internal area flag, so it can be recomputed.
Definition: CSO.h:296
unsigned int numSeedPoints() const
Returns the number of seed points.
Definition: CSO.h:152
CSOBoundingBox getVoxelBoundingBoxSeedPoints(const Matrix4 &worldToVoxelMatrix, size_t hashKey) const
Returns the bounding box of the seed points of this CSO in voxel coordinates computed by the given (i...
void swapPoints(CSO &other)
Swaps the seed and path points of two cso. No events are emitted.
CSOSeedPoint * appendSeedAndPathPoint()
Appends a seed point and a path point list to the end of the seed point list and returns a pointer to...
float getPathPointAlpha() const
Returns the alpha value of the path points.
bool isClosed() const
Returns whether the CSO is closed.
Definition: CSO.h:306
void setDescription(std::string description)
Sets the description of this CSO.
bool getEditableState() const
Returns the 'editable' state of this CSO.
CSOPathPoints * insertPathPointsEndStartNoEvent()
Inserts a CSOPathPoint between the ending and the starting seed points and returns a pointer to it.
void setSeedPointSize(float size)
Sets the size of the seed points.
float getPrivatePathPointWidth() const
Returns the private attribute 'path point width'.
Definition: CSO.h:435
unsigned int numPathPointLists() const
Returns the number of path point lists.
Definition: CSO.h:156
unsigned int numGroups() const
Returns the number of groups this CSO is in.
Definition: CSO.h:213
CSOPathPointsStyle getPathPointStyle() const
Returns the style of the path points.
Vector3 getSeedPointColor() const
Returns the color of the seed points.
float getPrivateSeedPointAlpha() const
Returns the private attribute 'seed point alpha'.
Definition: CSO.h:447
bool getIsFinished() const
Returns the finished status of this contour.
Definition: CSO.h:314
const std::string & getLabel() const
Returns the label of this CSO.
Definition: CSO.h:350
void applyTransformationMatrix(const Matrix4 &matrix)
void setPrivateIsFinished(bool isFinished)
Sets the 'isFinished' flag without any side effects.
Definition: CSO.h:456
CSOSeedPoint * getSelectedSeedPointAt(unsigned int index) const
Returns a pointer to a selected seed point at the given index.
CSOBoundingBox getVoxelBoundingBox(const Matrix4 &worldToVoxelMatrix, size_t hashKey) const
Returns the bounding box of this contour in voxel coordinates computed by the given (image) matrix.
void setNeedInterpolationAllSeedPoints(bool needsInterpolation)
Sets the need for interpolation to all member seed points.
void setSeedPointsAndPathPoints(const CSO *cso)
Sets the seed points and the path point of the given CSO.
float getPathPointWidth() const
Returns the width of the path points.
float getVoxelWriteValue() const
Returns the voxel write value of this CSO.
void setId(unsigned int newId)
Sets the unique ID of this CSO.
unsigned int getNumSelectedSeedPoints() const
Returns the number of selected seed points.
void setPrivatePlaneNormal(const Vector3 &normal)
Sets the plane normal of this CSO.
Definition: CSO.h:464
CSOManager * getManager() const
float getSeedPointAlpha() const
Returns the alpha value of the seed points.
void setVoxelWriteMode(int mode)
Sets the voxel write mode of this CSO.
bool isPoint() const
Returns whether the CSO is just a point.
void removeSeedPoint(CSOSeedPoint *sPoint)
Removes the given seed point from this CSO.
void setLabel(const std::string &label)
void _removeReferenceToGroup(const CSOGroup &group)
Removes the given group from the internal list.
float getPrivatePathPointAlpha() const
Returns the private attribute 'path point alpha'.
Definition: CSO.h:439
void clearSelectedSeedPoints()
Clears the list of selected seed points.
void setPrivateIsClosed(bool isClosedP)
Sets the 'isClosed' flag without any side effects.
Definition: CSO.h:458
void resortSeedPointsClockwise()
void getUserDataNames(std::vector< std::string > &names) const
Fills the given vector with the keys/name under which user data are stored for this CSO.
Definition: CSO.h:259
CSOSeedPoint * getFirstSeedPoint() const
Returns a pointer to the first seed point of this CSO.
Definition: CSO.h:148
CSOPathPoints * getPathPointsAt(unsigned int index) const
Returns the list of path points at a given position.
Definition: CSO.h:163
void setSeedPointColor(const Vector3 &color)
Sets the color of the seed points.
void setCreatorId(int id)
Sets the creator ID of the CSO. This is set by the Processor, which generates this CSO.
Definition: CSO.h:245
void moveSeedPointsAndPathPoints(const Vector3 &offset, int timepoint)
Moves all seed points and all path points by the given coordinates offset and sets it to the given ti...
bool getVoxelizeState() const
Returns the 'voxelize' state of this CSO.
Vector3 getPathPointColor() const
Returns the color of the path points.
bool isInSameGroupsAs(CSO *cso) const
void setUserData(const std::string &name, Variant value)
Definition: CSO.h:255
int getTimePointIndex() const
Returns the time point index of this CSO.
void moveSeedPointsAndPathPoints(double dx, double dy, double dz, int timepoint)
Moves all seed points and all path points by the given coordinates offset and sets it to the given ti...
float getPrivateSeedPointSize() const
Returns the private attribute 'seed point size'.
Definition: CSO.h:443
bool getSeedPointIndex(CSOSeedPoint *sPoint, unsigned int &index) const
Sets the sIndex to the index of the given seed point and returns whether such a seed point exists.
int getCreatorId() const
Returns the creator ID of the CSO. This is set by the Processor, which generated this CSO.
Definition: CSO.h:247
bool isInPlane(Vector3 &planeNormal) const
Returns the plane status and fills the argument vector with the plane normal (only valid if all seed ...
unsigned int getTotalNumUniquePathPoints() const
Returns the total number of unique path points in this CSO; this number equals the number of path poi...
void setPrivateBoundingBox(const CSOBoundingBox &bb)
Sets the bounding box of this CSO.
Definition: CSO.h:462
void setNeedInterpolation(CSOSeedPoint *seedPoint)
Sets the need of being interpolated to the given seed point and to the CSO's state.
Definition: CSO.h:324
int getPrivateSeedPointStyle() const
Returns the private attribute 'seed point style'.
Definition: CSO.h:441
bool isSelfIntersecting() const
Returns whether this CSO is self-intersecting.
CSO(const CSO &cso, CSOList *csoList=nullptr, unsigned int csoId=INVALID_CSO_ID)
Copy constructor; the unique id is taken from the given CSOList but if the CSOList is NULL,...
void setSeedAndPathPoints(unsigned int numSeedPoints, bool isClosed=true)
Generates the given number of seed points and path point lists between those.
void setPathPointAlpha(float alpha)
Sets the alpha value of the path points.
const CSOAttributes & getAttributes() const
Get const access to all CSO attributes.
Definition: CSO.h:480
void setPathPointStyle(CSOPathPointsStyle style)
Sets the style of the path points.
CSOGroup * getGroupAt(unsigned int index) const
Returns the group at the specified index. If the index is out of bounds, NULL is returned.
CSOSeedPoint * insertSeedPointAt(CSOPathPoints *toBeSplitPath, const Vector3 &toInsertPos)
Inserts a seed point into the given toBeSplitPath at the given position.
void setCSOList(CSOList *csoList)
const std::string & getSubType() const
Returns the type of the CSO. This is set by the Processor, which generated this CSO.
Definition: CSO.h:243
unsigned int getId() const
Returns the unique ID of this CSO.
Definition: CSO.h:340
CSOSeedPoint * getSeedPointAt(unsigned int index) const
void reverseSeedPointOrder()
Reverses the order of all seed points and clears all path points in between.
CSOAttributes & getWritableAttributes()
Get write access to all CSO attributes (NOTE: be careful, no events are emitted when changing the att...
Definition: CSO.h:483
CSO()
Standard constructor. The unique id is initialized with 0.
void storeInUndoManager()
Stores the geometric information of the CSO in the UndoRedo manager.
Definition: CSO.h:73
void moveSingleSeedPoint(CSOSeedPoint *sPoint, double dx, double dy, double dz)
Moves a certain seed point by the given coordinate offset.
int getPrivateTimePointIndex() const
Definition: CSO.h:425
void removeFromGroup(CSOGroup &group, bool useUndoRedo=true)
Removes this CSO from the given group.
void setVoxelizeState(bool state)
Sets the 'voxelize' state of this CSO.
void moveSeedPointsAndPathPoints(const Vector3 &offset)
Moves all seed points and all path points by the given coordinates offset.
void setSeedPointStyle(int style)
Sets the style of the seed points.
bool getPrivateVoxelizeState() const
Returns the private attribute 'voxelizeState'.
Definition: CSO.h:429
void removeAllSeedAndPathPoints()
Removes all seed points and all path point lists from this CSO.
void fillPathPointCoordinatesFlattened(std::vector< Vector4 > &pathPointCoordsAndValues) const
Fills up the given std::vector<Vector4> with all the path point coordinates and values in order.
double getArea() const
Returns the area of this CSO (this value is only meaningful if all points lie in a plane)
Definition: CSO.h:294
void setAbsoluteMovementCommand(double fromX, double fromY, double fromZ, double toX, double toY, double toZ, int fromTimePointIndex, int toTimePointIndex)
Sets the absolute movement for undo/redo.
bool isSelected() const
Returns whether this CSO is selected in its CSOList. If there is no enclosing CSOList,...
void invalidatePlaneNormal()
Invalidates the plane normal.
Definition: CSO.h:290
const CSOBoundingBox & getWorldBoundingBox() const
Vector3 getPrivatePathPointColor() const
Returns the private attribute 'path point color'.
Definition: CSO.h:437
Vector3 getPrivateSeedPointColor() const
Returns the private attribute 'seed point color'.
Definition: CSO.h:445
void setPrivateIsInPlane(bool isInPlaneP)
Sets the 'isInPlane' flag without any side effects.
Definition: CSO.h:460
void setInsertRemoveSeedPointCommand()
Triggers the according undo/redo command to be put on the stack.
bool isSelectedSeedPoint(CSOSeedPoint *sPoint) const
Returns whether the given seed point is selected.
void _addReferenceToGroup(const CSOGroup &group)
void setIsFinished(bool isFinished)
Sets the finished status of this contour. Note that the finished status is set to 'true' if the conto...
Definition: CSO.h:312
void setNeedsInterpolation(bool needsInterpolation)
Sets if this CSO needs interpolation.
Definition: CSO.h:316
void setPathPointWidth(float width)
Sets the width of the path points.
void setPlaneNormal(const Vector3 &planeNormal)
Sets the plane normal which becomes valid by this.
Definition: CSO.h:288
CSOList * getCSOList() const
Returns the internal pointer to the embracing CSOList.
Definition: CSO.h:338
CSOSeedPoint * appendSeedAndPathPointNoEvent(const Vector3 &position)
Appends a seed point and a path point list to the end of the seed point list and returns a pointer to...
void setSubType(const std::string &subtype)
Sets the subtype of the CSO. This is set by the Processor, which generates this CSO.
Definition: CSO.h:241
bool getShowState() const
Returns the 'show' status of this CSO.
void setIsInPlane(bool status)
Sets the plane normal status for this CSO.
Definition: CSO.h:286
void computePlaneNormal()
Forces to recompute the plane normal (status).
Definition: CSO.h:283
void storeVisualAttributesInUndoManager()
void setVoxelWriteValue(float value)
Sets the voxel write value of this CSO.
void removeFromAllGroups()
Removes this CSO from all its groups.
void setSeedPointSelectedAt(unsigned int index)
Sets the seed point at the given index selected.
unsigned int getGroupIdAt(unsigned int index) const
Returns a group id at the specified index.
Definition: CSO.h:218
bool isInPlane() const
Returns the plane status (do all seed points lie in a plane?).
Definition: CSO.h:276
double getLength() const
Returns the length of this CSO (this is sum of the the euclidean distances between all successive pat...
const std::string & getType() const
Returns the type of the CSO. This is set by the Processor, which generated this CSO.
Definition: CSO.h:239
void determineNeedsInterpolation()
Determines by investigating the CSO's seed points if this CSO needs interpolation and sets this state...
void setEditableState(bool state)
Sets the 'editable' state of this CSO.
bool saveAttributes(std::ostream &outStream, bool useAscii=false)
Save attributes to stream and returns whether the saving was successful.
int getPrivateVoxelWriteMode() const
Returns the private attribute 'voxelWriteMode'.
Definition: CSO.h:450
const Vector3 & getPlaneNormal() const
Returns the plane normal. Only valid, if isInPlane returns 'true'.
Definition: CSO.h:281
int getVoxelWriteMode() const
Returns the voxel write mode of this CSO.
void fillPathPointCoordinatesFlattened(std::vector< Vector3 > &pathPointCoords) const
Fills up the given std::vector<Vector3> with all the path point coordinates in order.
CSOSeedPoint * appendSeedPoint()
Appends just a seed point to the internal list and returns a pointer to it.
void setType(const std::string &type)
Definition: CSO.h:237
void setSeedPointAlpha(float alpha)
Sets the alpha value of the seed points.
CSOPathPoints * appendPathPoints()
Appends just a path point list the internal list and returns a pointer to it.
void setShowState(bool state)
Sets the 'show' status of this CSO.
CSOSeedPoint * appendSeedAndPathPoint(const Vector3 &position)
Appends a seed point and a path point list to the end of the seed point list and returns a pointer to...
void setPathPointStyle(int style)
Sets the style of the path points as an int.
Definition: CSO.h:375
CSO(CSOList *csoList)
Constructor takes a pointer to the CSOList this CSO is in; in this method, the unique id is set.
void setAllValuesTo(float value)
Sets all position values to the given value.
bool getNeedsInterpolation() const
Returns whether this CSO needs interpolation.
Definition: CSO.h:318
void loadAttributes(std::istream &inStream, short version, bool swapBytes, bool useAscii=false)
Load attributes from stream.
unsigned int getTotalNumPathPoints() const
Returns the total number of path points in this CSO; this number may differ from the number of path p...
bool isInGroup(unsigned int groupId) const
Returns whether this CSO is in the group with the given ID.
void setAbsoluteSeedPointMovementCommand()
Sets the absolute movement of a single seed point for undo/redo.
float getSeedPointSize() const
Returns the size of the seed points.
void setIsClosed(bool isClosed)
Sets the closed state of this contour.
float getPrivateVoxelWriteValue() const
Returns the private attribute 'voxelWriteValue'.
Definition: CSO.h:452
bool getPrivateShowState() const
Returns the private attribute 'showState'.
Definition: CSO.h:427
CSOPathPoints * insertPathPointsEndStart()
Inserts a CSOPathPoint between the ending and the starting seed points and returns a pointer to it.
CSOSeedPoint * getLastSeedPoint() const
Returns a pointer to the last seed point of this CSO.
Definition: CSO.h:150
void setSelectedSeedPoint(CSOSeedPoint *sPoint)
Sets the given seed point as being selected, and deselects all previously selected seed points.
bool isInGroup(const CSOGroup *group) const
Returns whether this CSO is in the given Group.
int getSeedPointStyle() const
Returns the style of the seed points.
void setAttributesFrom(const CSO *const cso)
Copies all attributes from the given CSO to this one.
int getPrivatePathPointStyle() const
Returns the private attribute 'path point style'.
Definition: CSO.h:433
void setPathPointColor(const Vector3 &color)
Sets the color of the path points.
void addSelectedSeedPoint(CSOSeedPoint *sPoint)
bool isEmpty() const
Returns whether the CSO is empty; an empty CSO has neither seed points nor path points.
Variant getUserData(const std::string &name) const
Returns the user data under the given name or an invalid value if the entry does not exist.
Definition: CSO.h:257
const std::string & getDescription() const
Returns the description of this CSO.
Definition: CSO.h:354
bool addToGroup(CSOGroup &group, bool useUndoRedo=true)
void setInitialSeedAndPathPointsNoEvent(unsigned int numSeedPoints, bool isClosed=true)
See setSeedAndPathPoints, but faster because no events are emitted and no checks are done,...
void pathChanged()
Sets any pre-computed values depending on the exact path to invalid.
void moveSeedPointsAndPathPoints(double dx, double dy, double dz)
Moves all seed points and all path points by the given coordinates offset.
void setTimePointIndex(MLint index)
Sets the time point index of this CSO.
virtual ~CSO()
Standard destructor.
The Variant class stores different data types.
Definition: mlVariant.h:36
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition: mlTypeDefs.h:578
CSOPathPointsStyle
Enumeration of line styles (order as StylePalette::LineStyle).
Definition: CSODefines.h:42
CSOLineStyle
\Deprecated
Definition: CSODefines.h:52
Tvec3< MLdouble > Vector3
A vector with 3 components of type double.
Definition: mlVector3.h:300