NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkDrawTool.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 niftkDrawTool_h
16 #define niftkDrawTool_h
17 
18 #include "niftkMIDASExports.h"
19 
20 #include <mitkPlanarCircle.h>
21 
22 #include "niftkContourTool.h"
24 
25 namespace niftk
26 {
27 
44 class NIFTKMIDAS_EXPORT DrawTool : public ContourTool {
45 
46 public:
47 
48  mitkClassMacro(DrawTool, ContourTool)
49  itkNewMacro(DrawTool)
50 
51  virtual void InitializeStateMachine();
52 
54  virtual void ExecuteOperation(mitk::Operation* operation);
55 
57  virtual const char* GetName() const;
58 
60  virtual const char** GetXPM() const;
61 
64  double GetCursorSize() const;
65 
67  void SetCursorSize(double cursorSize);
68 
70  mitk::Message1<double> CursorSizeChanged;
71 
73  virtual bool StartDrawing(mitk::StateMachineAction* action, mitk::InteractionEvent* event);
74 
76  virtual bool KeepDrawing(mitk::StateMachineAction* action, mitk::InteractionEvent* event);
77 
79  virtual bool StopDrawing(mitk::StateMachineAction* action, mitk::InteractionEvent* event);
80 
82  virtual bool StartErasing(mitk::StateMachineAction* action, mitk::InteractionEvent* event);
83 
85  virtual bool KeepErasing(mitk::StateMachineAction* action, mitk::InteractionEvent* event);
86 
88  virtual bool StopErasing(mitk::StateMachineAction* action, mitk::InteractionEvent* event);
89 
91  virtual void ClearWorkingData();
92 
95  virtual void Clean(int sliceNumber, int axisNumber);
96 
97 protected:
98 
99  DrawTool(); // purposely hidden
100  virtual ~DrawTool(); // purposely hidden
101 
103  virtual void ConnectActionsAndFunctions();
104 
110  virtual void Activated();
111 
112 private:
113 
114  template<typename TPixel, unsigned int VImageDimension>
115  void ITKCleanContours(
116  itk::Image<TPixel, VImageDimension> *itkImage,
117  mitk::ContourModelSet& inputContours,
118  mitk::ContourModelSet& outputContours,
119  int axis,
120  int sliceNumber
121  );
122 
124  static const mitk::OperationType MIDAS_DRAW_TOOL_OP_ERASE_CONTOUR;
125 
127  static const mitk::OperationType MIDAS_DRAW_TOOL_OP_CLEAN_CONTOUR;
128 
130  bool DeleteFromContour(int workingDataNumber, mitk::StateMachineAction* action, mitk::InteractionEvent* event);
131 
133  void SetEraserScopeVisible(bool visible, mitk::BaseRenderer* renderer = 0);
134 
136  double m_CursorSize;
137 
139  mitk::Point3D m_MostRecentPointInMm;
140 
143 
144  mitk::PlanarCircle::Pointer m_EraserScope;
145  mitk::DataNode::Pointer m_EraserScopeNode;
146  bool m_EraserScopeVisible;
147 
148 };
149 
150 }
151 
152 #endif
itk::SmartPointer< Self > Pointer
Definition: niftkDrawToolEventInterface.h:38
Provides common functionality for DrawTool and PolyTool where these two tools enable drawing lines an...
Definition: niftkContourTool.h:51
Tool to draw lines around voxel edges like MIDAS does rather than through them as most of the MITK to...
Definition: niftkDrawTool.h:44
mitk::Message1< double > CursorSizeChanged
Used to send messages when the cursor size is changed or should be updated in a GUI. */.
Definition: niftkDrawTool.h:70
cl_event event
Definition: glew.h:3231
Definition: niftkExceptionObject.h:21