MeVisLab Toolbox Reference
CSOPrimitiveProcessor.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 CSOPRIMITIVE_PROCESSOR_H
14 #define CSOPRIMITIVE_PROCESSOR_H
15 
16 
19 
20 #include "SoCSOSystem.h"
22 
23 
24 ML_START_NAMESPACE
25 
27 
30 {
33 };
34 
36 
37 constexpr inline const char* SUB_TYPE_RECT = "SUB_TYPE_RECT";
38 constexpr inline const char* SUB_TYPE_ELLIPSE = "SUB_TYPE_ELLIPSE";
39 
41 
45 {
46 
47 public:
48 
51 
54  bool process(CSOEvalEventView2DInfos view2DInfos, CSOEvalEventCSOInfos csoInfos) override;
55 
58  bool needsMemoryImage() override;
60  virtual void setMemoryImage(float* imageData, int sizex, int sizey, int voxelPosZ,
61  float* voxelToWorldMatrix, float* worldToVoxelMatrix,
62  View2DSliceList* slicelist);
63 
65  bool isCurrentlyGenerating() override;
67  bool isCurrentlyEditing() override;
69  void resetInteractionState() override;
71  void triggerSetMouseCursor(SoView2D* view2d, bool shouldSetMouseCursor) override;
72 
73 protected:
74 
77 
78 private:
79 
80  /* FIELDS */
81 
83  TypedEnumField<PRIMITIVE_TYPE>* _primitiveTypeFld;
84 
86  BoolField* _createIsotropicPrimitiveFld;
88  BoolField* _createFromCenterFld;
89 
90 
91  /* STATE VARIABLES */
92 
94  CSOList* _csoList;
96  Vector3 _moveStartPosition;
98  Vector3 _lastCurrentPosition;
100  CSO* _currentlyActiveCSO;
102  CSOSeedPoint* _currentlyActiveSeedPoint;
104  CSOSeedPoint* _cornerSeedPoint[4];
105 
107  bool _isMovingSeedPoint;
109  bool _isGeneratingCSO;
111  bool _hasJustBegunMovingSeedPoint;
114  bool _notMovingInSlice;
115 
117  SbVec3f _sliceNormal0;
119  SbVec3f _sliceNormal1;
121  SbVec3f _sliceNormal2;
122 
123 
124  /* METHODS */
125 
128  void _interpolate();
131  void _computeDifferenceVectors(const Vector3& dif, Vector3& difX, Vector3& difY, bool shouldCreateIsotropic);
132 
134 };
135 
137 
138 
139 ML_END_NAMESPACE
140 
141 #endif // __CSOPrimitiveProcessor_H
#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
Field to encapsulate a boolean value.
Definition: mlFields.h:62
A CSOList comprises a number of CSOs and CSOGroups and is the central object for contour segmentation...
Definition: CSOList.h:61
Module which enables interactive generation of primitive contours such as ellipses and rectangles.
~CSOPrimitiveProcessor() override
Destructor.
bool needsMemoryImage() override
Returns whether the processor need the current memory image for interpolation.
CSOPrimitiveProcessor()
Constructor.
bool isCurrentlyGenerating() override
Returns whether the processor is currently generating a new contour.
bool isCurrentlyEditing() override
Returns whether the processor is currently editing an existing contour.
bool process(CSOEvalEventView2DInfos view2DInfos, CSOEvalEventCSOInfos csoInfos) override
Evaluates the interaction events and interpolates the contours accordingly.
void triggerSetMouseCursor(SoView2D *view2d, bool shouldSetMouseCursor) override
Triggers the setting of the processor's default mouse cursor.
void resetInteractionState() override
Sets back internal interaction state.
virtual void setMemoryImage(float *imageData, int sizex, int sizey, int voxelPosZ, float *voxelToWorldMatrix, float *worldToVoxelMatrix, View2DSliceList *slicelist)
Sets an image which can be used with an image based interpolation algorithm.
Base class for processor modules; those provide mechanisms for an interactive generation of seed poin...
Definition: CSOProcessor.h:42
The CSOSeedPoint can be interactively set and modified and is the framework for contours.
Definition: CSOSeedPoint.h:35
The CSO represents a contour segmentation object.
Definition: CSO.h:44
#define ML_MODULE_CLASS_HEADER(className)
Like ML_CLASS_HEADER for the usage of derived classes from Module.
constexpr const char * SUB_TYPE_ELLIPSE
Subtype: an ellipse.
PRIMITIVE_TYPE
Enumeration of the contour type.
@ PRIMITIVE_RECT
Contour is a rectangle.
@ PRIMITIVE_ELLIPSE
Contour is an ellipse.
constexpr const char * SUB_TYPE_RECT
Subtype: a rectangle.