Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkLiveWireTool2D.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkCorrectorTool2D_h_Included
18 #define mitkCorrectorTool2D_h_Included
19 
20 #include "mitkCommon.h"
21 #include "mitkSegTool2D.h"
23 #include <mitkContourModel.h>
26 
27 namespace us
28 {
29  class ModuleResource;
30 }
31 
32 namespace mitk
33 {
50  {
51  public:
53  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
54 
55  virtual const char **GetXPM() const override;
56  virtual us::ModuleResource GetCursorIconResource() const override;
57  us::ModuleResource GetIconResource() const override;
58 
59  virtual const char *GetName() const override;
60 
62  void ConfirmSegmentation();
63 
65  void ClearSegmentation();
66 
67  protected:
69  virtual ~LiveWireTool2D();
70 
71  void ConnectActionsAndFunctions() override;
72 
73  virtual void Activated() override;
74  virtual void Deactivated() override;
75 
77  virtual void OnInitLiveWire(StateMachineAction *, InteractionEvent *interactionEvent);
78 
80  virtual void OnAddPoint(StateMachineAction *, InteractionEvent *interactionEvent);
81 
83  virtual void OnMouseMoved(StateMachineAction *, InteractionEvent *interactionEvent);
84 
86  virtual bool OnCheckPoint(const InteractionEvent *interactionEvent);
87 
89  virtual void OnFinish(StateMachineAction *, InteractionEvent *interactionEvent);
90 
92  virtual void OnLastSegmentDelete(StateMachineAction *, InteractionEvent *interactionEvent);
93 
95  virtual void OnMouseMoveNoDynamicCosts(StateMachineAction *, InteractionEvent *interactionEvent);
96 
98  void FinishTool();
99 
105  virtual bool IsPositionEventInsideImageRegion(InteractionPositionEvent *positionEvent, BaseData *data);
106 
112  void EnableContourLiveWireInteraction(bool on);
113 
114  // the contour already set by the user
116 
117  // the corresponding datanode
119 
120  // the current LiveWire computed contour
122 
123  // the corresponding datanode
125 
126  // the contour for the editing portion
128 
129  // the corresponding datanode
131 
132  // the corresponding contour interactor
134 
135  // the current reference image
137 
138  // the filter for live wire calculation
140 
142 
143  std::vector<std::pair<mitk::DataNode::Pointer, mitk::PlaneGeometry::Pointer>> m_WorkingContours;
144  std::vector<std::pair<mitk::DataNode::Pointer, mitk::PlaneGeometry::Pointer>> m_EditingContours;
145  std::vector<mitk::ContourModelLiveWireInteractor::Pointer> m_LiveWireNodes;
146 
147  template <typename TPixel, unsigned int VImageDimension>
148  void FindHighestGradientMagnitudeByITK(itk::Image<TPixel, VImageDimension> *inputImage,
149  itk::Index<3> &index,
150  itk::Index<3> &returnIndex);
151 
152  private:
153  void RemoveHelperObjects();
154  void ReleaseHelperObjects();
155  void ReleaseInteractors();
156 
157  const PlaneGeometry *m_PlaneGeometry;
158  };
159 
160 } // namespace
161 
162 #endif
Super class for all position events.
Base of all data objects.
Definition: mitkBaseData.h:39
itk::SmartPointer< Self > Pointer
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
A 2D segmentation tool based on LiveWire approach. The contour between the last user added point and ...
mitk::ContourModel::Pointer m_LiveWireContour
mitk::ContourModelLiveWireInteractor::Pointer m_ContourInteractor
mitk::Image::Pointer m_WorkingSlice
mitk::DataNode::Pointer m_ContourModelNode
mitk::DataNode::Pointer m_LiveWireContourNode
Represents an action, that is executed after a certain event (in statemachine-mechanism) TODO: implem...
virtual void ConnectActionsAndFunctions() override
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
itk::SmartPointer< Self > Pointer
Abstract base class for segmentation tools.
Definition: mitkSegTool2D.h:58
static std::string GetName(std::string fileName, std::string suffix)
mitk::ContourModel::Pointer m_Contour
mitk::ContourModel::Pointer m_EditingContour
Describes a two-dimensional, rectangular plane.
mitk::DataNode::Pointer m_EditingContourNode
std::vector< std::pair< mitk::DataNode::Pointer, mitk::PlaneGeometry::Pointer > > m_EditingContours
std::vector< std::pair< mitk::DataNode::Pointer, mitk::PlaneGeometry::Pointer > > m_WorkingContours
itk::SmartPointer< Self > Pointer
Definition: mitkBaseData.h:42
mitk::ImageLiveWireContourModelFilter::Pointer m_LiveWireFilter
std::vector< mitk::ContourModelLiveWireInteractor::Pointer > m_LiveWireNodes
Super-class that provides the functionality of a StateMachine to DataInteractors. ...