NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkPolyTool.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkPolyTool_h
16 #define niftkPolyTool_h
17 
18 #include "niftkMIDASExports.h"
19 
20 #include <mitkOperation.h>
21 #include <mitkOperationActor.h>
22 #include <mitkPointSet.h>
23 
24 #include "niftkContourTool.h"
26 
27 namespace niftk
28 {
29 
45 class NIFTKMIDAS_EXPORT PolyTool : public ContourTool {
46 
47 public:
48 
49  mitkClassMacro(PolyTool, Tool)
50  itkNewMacro(PolyTool)
51 
52 
53  virtual const char* GetName() const;
54 
56  virtual const char** GetXPM() const;
57 
60 
63 
65  virtual void ExecuteOperation(mitk::Operation* operation);
66 
68  virtual void Activated();
69 
71  virtual void Deactivated();
72 
74  virtual bool AddLine(mitk::StateMachineAction* action, mitk::InteractionEvent* event);
75 
77  virtual bool SelectPoint(mitk::StateMachineAction* action, mitk::InteractionEvent* event);
78 
80  virtual bool MovePoint(mitk::StateMachineAction* action, mitk::InteractionEvent* event);
81 
83  virtual bool DeselectPoint(mitk::StateMachineAction* action, mitk::InteractionEvent* event);
84 
88  virtual void ClearData();
89 
90 protected:
91 
92  PolyTool(); // purposely hidden
93  virtual ~PolyTool(); // purposely hidden
94 
95  virtual void InitializeStateMachine();
96 
98  virtual void ConnectActionsAndFunctions();
99 
100 private:
101 
103  void SetPolyLinePointSetVisible(bool visible);
104 
106  void SetPreviousContourVisible(bool visible);
107 
109  void Disable3dRenderingOfPreviousContour();
110 
112  void DrawWholeContour(const mitk::ContourModel& contourReferencePointsInput, const mitk::PlaneGeometry* planeGeometry, mitk::ContourModel& feedbackContour, mitk::ContourModel& backgroundContour);
113 
115  void UpdateContours(mitk::StateMachineAction* action, mitk::InteractionPositionEvent* positionEvent, bool provideUndo, bool registerNewPoint);
116 
118  void UpdateFeedbackContour(bool registerNewPoint, const mitk::Point3D& closestCornerPoint, const mitk::PlaneGeometry* planeGeometry, mitk::ContourModel& contourReferencePointsInput, mitk::ContourModel& feedbackContour, mitk::ContourModel& backgroundContour, bool provideUndo);
119 
121  mitk::Point3D m_MostRecentPointInMillimetres;
122 
124  mitk::ContourModel::Pointer m_ReferencePoints;
125 
127  mitk::ContourModel::Pointer m_PreviousContourReferencePoints;
128 
131  mitk::ContourModel::Pointer m_PreviousContour;
132  mitk::DataNode::Pointer m_PreviousContourNode;
133  bool m_PreviousContourVisible;
134 
136  mitk::PointSet::Pointer m_PolyLinePointSet;
137  mitk::DataNode::Pointer m_PolyLinePointSetNode;
138  bool m_PolyLinePointSetVisible;
139 
141  static const mitk::OperationType MIDAS_POLY_TOOL_OP_ADD_TO_FEEDBACK_CONTOUR;
142  static const mitk::OperationType MIDAS_POLY_TOOL_OP_UPDATE_FEEDBACK_CONTOUR;
143 
146 
150  unsigned int m_DraggedPointIndex;
151 
152 };
153 
154 }
155 
156 #endif
Base class for segmentor tools that need access to the list of seeds for the current reference data v...
Definition: niftkTool.h:61
Provides common functionality for DrawTool and PolyTool where these two tools enable drawing lines an...
Definition: niftkContourTool.h:51
static const std::string MIDAS_POLY_TOOL_ANCHOR_POINTS
We store the name of the anchor points node, which is used to store the first point on a poly line...
Definition: niftkPolyTool.h:59
Tool to draw poly lines around voxel edges like MIDAS does rather than through them as most of the MI...
Definition: niftkPolyTool.h:45
static const std::string MIDAS_POLY_TOOL_PREVIOUS_CONTOUR
We store the name of the previous contour node, which is the contour display in green when middle-cli...
Definition: niftkPolyTool.h:62
itk::SmartPointer< Self > Pointer
Definition: niftkPolyToolEventInterface.h:38
cl_event event
Definition: glew.h:3231
Definition: niftkExceptionObject.h:21
GLsizei const GLcharARB ** string
Definition: glew.h:5194