MeVisLab Toolbox Reference
CSOModifyProcessor.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 CSOMODIFY_PROCESSOR_H
14 #define CSOMODIFY_PROCESSOR_H
15 
16 
18 
19 #include "SoCSOSystem.h"
21 
22 ML_START_NAMESPACE
23 
25 
28 {
32  ModProcLimitSM = 3
33 };
34 
36 {
39  ModSelectGroups = 2
40 };
41 
43 
46 {
47 
48 public:
49 
52 
55  bool process(CSOEvalEventView2DInfos view2DInfos, CSOEvalEventCSOInfos csoInfos) override;
56 
59  bool needsMemoryImage() override;
60 
62  bool isCurrentlyGenerating() override;
64  bool isCurrentlyEditing() override;
66  bool couldCloseCSO() override;
67 
69  void resetInteractionState() override;
71  void triggerSetMouseCursor(SoView2D* view2d, bool shouldSetMouseCursor) override;
72 
73 protected:
74 
76  ~CSOModifyProcessor() override;
78  void activateAttachments() override;
80  void handleNotification(Field* field) override;
81 
82 private:
83 
84  /* FIELDS */
85 
87  FloatField* _limitValueFld;
89  TypedEnumField<ModProcLimitUnits>* _limitUnitFld;
91  TypedEnumField<ModCSOSelectionMode>* _editableModeFld;
93  StringField* _editableCSOsFld;
94 
95  /* MEMBER VARIABLES */
96 
98  CSOList* _csoList;
100  Vector3 _currentHitPointWorld;
102  int _timePoint;
104  CSO* _mainModificatorCSO;
106  CSO* _helperModificatorCSO;
108  bool _isCurrentlyEditing;
110  std::vector<unsigned int> _selectedIDs;
112  bool _interactOnlyOnSelectedCSOs;
113 
114  /* DATA STRUCTURES */
115 
116  typedef std::vector<Vector3> PosVector;
117 
119  struct CSOAndPositions {
120  CSO* cso;
121  PosVector* posVector;
122  };
124  struct CrossingIndices {
125  int modifyIndex;
126  int csoAllIndex;
127  Vector3 crossingPoint;
128  };
130  struct EntryExitSegment {
131  EntryExitSegment() { entryIndex = exitIndex = -1; }
132  int entryIndex;
133  int exitIndex;
134  };
135 
136  /* METHODS */
137 
140  bool _computeCrossingsAndPerformSplit(View2DSliceList* slicelist);
143  void _collectSegments(const std::vector<Vector3>& clipee,
144  const std::vector<Vector3>& clipper,
145  bool insideOutsideValue,
146  std::vector<PosVector>& positionSegments,
147  std::vector<EntryExitSegment>& eeSegments);
149  bool _segmentsAreCrossing(const Vector3& start0, const Vector3& end0, const Vector3& start1, const Vector3& end1, Vector3& crossingPoint);
151  float _getScreenDistance(View2DSliceList* slicelist, const Vector3& worldPos1, const Vector3& worldPos2);
153  void _parseSelection();
155  bool _isEditable(CSO* cso);
156 
157  ML_MODULE_CLASS_HEADER(CSOModifyProcessor);
158 };
159 
161 
162 
163 ML_END_NAMESPACE
164 
165 
166 #endif //__CSOModifyProcessor_H
167 
#define SOCSO_EXPORT
Header file for system independent resolution.
Definition: SoCSOSystem.h:21
SoView2D is a 2D viewer for image data.
Definition: SoView2D.h:62
a list that holds all View2DSlice objects (lazily created) of a SoView2D
A CSOList comprises a number of CSOs and CSOGroups and is the central object for contour segmentation...
Definition: CSOList.h:61
Module which allows for a modification of CSOs of all types.
bool isCurrentlyGenerating() override
Returns whether the processor is currently generating a new contour.
CSOModifyProcessor()
Standard constructor.
~CSOModifyProcessor() override
Standard destructor.
bool isCurrentlyEditing() override
Returns whether the processor is currently editing an existing contour.
void activateAttachments() override
Initialize module after loading.
bool couldCloseCSO() override
Returns whether the processor could close an open CSO by the processor's rules.
bool process(CSOEvalEventView2DInfos view2DInfos, CSOEvalEventCSOInfos csoInfos) override
Processes the interaction events and interpolates the contours accordingly.
void triggerSetMouseCursor(SoView2D *view2d, bool shouldSetMouseCursor) override
Triggers the setting of the processors default mouse cursor.
bool needsMemoryImage() override
Returns whether the processor need the current memory image for interpolation.
void resetInteractionState() override
Sets back internal interaction state.
void handleNotification(Field *field) override
Called when input changes.
Base class for processor modules; those provide mechanisms for an interactive generation of seed poin...
Definition: CSOProcessor.h:42
The CSO represents a contour segmentation object.
Definition: CSO.h:44
Base class for all fields used in the ML.
Definition: mlField.h:73
Field to encapsulate a float value.
Definition: mlFields.h:627
Field to encapsulate a string value.
Definition: mlFields.h:1000
#define ML_MODULE_CLASS_HEADER(className)
Like ML_CLASS_HEADER for the usage of derived classes from Module.
ModCSOSelectionMode
@ ModSelectCSOs
@ ModSelectAll
@ ModSelectGroups
ModProcLimitUnits
Enumeration of limiting units.
@ ModProcLimitSMM
Limit unit: square millimeter.
@ ModProcLimitSCM
Limit unit: square centimeter.
@ ModProcLimitSM
Limit unit: square meter.
@ ModProcLimitNumPoints
Limit unit: number of points.
Tvec3< MLdouble > Vector3
A vector with 3 components of type double.
Definition: mlVector3.h:300