Medical Imaging Interaction Toolkit  2018.4.99-b7f3afaa
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkLiveWireTool2D_h
14 #define mitkLiveWireTool2D_h
15 
16 #include <mitkSegTool2D.h>
18 
19 namespace mitk
20 {
37  {
38  public:
40  itkFactorylessNewMacro(Self);
41 
42  us::ModuleResource GetCursorIconResource() const override;
43  us::ModuleResource GetIconResource() const override;
44  const char *GetName() const override;
45  const char **GetXPM() const override;
46 
48  void ConfirmSegmentation();
49 
51  void ClearSegmentation();
52 
53  protected:
55  ~LiveWireTool2D() override;
56 
57  void ConnectActionsAndFunctions() override;
58  void Activated() override;
59  void Deactivated() override;
60 
61  private:
63  void OnInitLiveWire(StateMachineAction *, InteractionEvent *interactionEvent);
64 
66  void OnAddPoint(StateMachineAction *, InteractionEvent *interactionEvent);
67 
69  void OnMouseMoved(StateMachineAction *, InteractionEvent *interactionEvent);
70 
72  bool OnCheckPoint(const InteractionEvent *interactionEvent);
73 
75  void OnFinish(StateMachineAction *, InteractionEvent *interactionEvent);
76 
78  void OnLastSegmentDelete(StateMachineAction *, InteractionEvent *interactionEvent);
79 
81  void OnMouseMoveNoDynamicCosts(StateMachineAction *, InteractionEvent *interactionEvent);
82 
84  void FinishTool();
85 
86  void EnableContourLiveWireInteraction(bool on);
87 
88  bool IsPositionEventInsideImageRegion(InteractionPositionEvent *positionEvent, BaseData *data);
89 
90  void ReleaseInteractors();
91 
92  void ReleaseHelperObjects();
93 
94  void RemoveHelperObjects();
95 
96  template <typename TPixel, unsigned int VImageDimension>
97  void FindHighestGradientMagnitudeByITK(itk::Image<TPixel, VImageDimension> *inputImage,
98  itk::Index<3> &index,
99  itk::Index<3> &returnIndex);
100 
101  mitk::ContourModel::Pointer m_Contour;
102  mitk::DataNode::Pointer m_ContourNode;
103 
104  mitk::ContourModel::Pointer m_LiveWireContour;
105  mitk::DataNode::Pointer m_LiveWireContourNode;
106 
107  mitk::ContourModel::Pointer m_EditingContour;
108  mitk::DataNode::Pointer m_EditingContourNode;
110 
111  mitk::Image::Pointer m_WorkingSlice;
112 
114 
115  bool m_CreateAndUseDynamicCosts;
116 
117  std::vector<std::pair<mitk::DataNode::Pointer, mitk::PlaneGeometry::Pointer>> m_WorkingContours;
118  std::vector<std::pair<mitk::DataNode::Pointer, mitk::PlaneGeometry::Pointer>> m_EditingContours;
119  std::vector<mitk::ContourModelLiveWireInteractor::Pointer> m_LiveWireInteractors;
120 
121  PlaneGeometry::ConstPointer m_PlaneGeometry;
122  };
123 }
124 
125 #endif
Super class for all position events.
Base of all data objects.
Definition: mitkBaseData.h:37
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
A 2D segmentation tool based on a LiveWire approach.
Represents an action, that is executed after a certain event (in statemachine-mechanism) TODO: implem...
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
itk::SmartPointer< Self > Pointer
Abstract base class for segmentation tools.
Definition: mitkSegTool2D.h:54
static std::string GetName(std::string fileName, std::string suffix)
Super-class that provides the functionality of a StateMachine to DataInteractors. ...