Medical Imaging Interaction Toolkit  2021.10.99-1c4db16f
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 {
45  {
46  public:
48  itkFactorylessNewMacro(Self);
49 
50  us::ModuleResource GetCursorIconResource() const override;
51  us::ModuleResource GetIconResource() const override;
52  const char *GetName() const override;
53  const char **GetXPM() const override;
54 
56  void ConfirmSegmentation();
57 
59  void ClearSegmentation();
60 
61  protected:
63  ~LiveWireTool2D() override;
64 
65  void ConnectActionsAndFunctions() override;
66  void Activated() override;
67  void Deactivated() override;
68  void UpdateLiveWireContour();
69  void OnTimePointChanged() override;
70 
71  private:
73  void OnInitLiveWire(StateMachineAction *, InteractionEvent *interactionEvent);
74 
76  void OnAddPoint(StateMachineAction *, InteractionEvent *interactionEvent);
77 
79  void OnMouseMoved(StateMachineAction *, InteractionEvent *interactionEvent);
80 
82  bool OnCheckPoint(const InteractionEvent *interactionEvent);
83 
85  void OnFinish(StateMachineAction *, InteractionEvent *interactionEvent);
86 
88  void OnLastSegmentDelete(StateMachineAction *, InteractionEvent *interactionEvent);
89 
91  void OnMouseMoveNoDynamicCosts(StateMachineAction *, InteractionEvent *interactionEvent);
92 
94  void FinishTool();
95 
96  void EnableContourLiveWireInteraction(bool on);
97 
98  bool IsPositionEventInsideImageRegion(InteractionPositionEvent *positionEvent, BaseData *data);
99 
100  void ReleaseInteractors();
101 
102  void ReleaseHelperObjects();
103 
104  void RemoveHelperObjects();
105 
106  template <typename TPixel, unsigned int VImageDimension>
107  void FindHighestGradientMagnitudeByITK(itk::Image<TPixel, VImageDimension> *inputImage,
108  itk::Index<3> &index,
109  itk::Index<3> &returnIndex);
110 
111  ContourModel::Pointer CreateNewContour() const;
112 
113  mitk::ContourModel::Pointer m_Contour;
114  mitk::DataNode::Pointer m_ContourNode;
115 
116  mitk::ContourModel::Pointer m_LiveWireContour;
117  mitk::DataNode::Pointer m_LiveWireContourNode;
118 
119  mitk::ContourModel::Pointer m_ClosureContour;
120  mitk::DataNode::Pointer m_ClosureContourNode;
121 
122  mitk::ContourModel::Pointer m_EditingContour;
123  mitk::DataNode::Pointer m_EditingContourNode;
125 
128  mitk::Image::Pointer m_ReferenceDataSlice;
129 
131  mitk::ImageLiveWireContourModelFilter::Pointer m_LiveWireFilterClosure;
132 
133  bool m_CreateAndUseDynamicCosts;
134 
135  std::vector<std::pair<mitk::DataNode::Pointer, mitk::PlaneGeometry::Pointer>> m_WorkingContours;
136  std::vector<std::pair<mitk::DataNode::Pointer, mitk::PlaneGeometry::Pointer>> m_EditingContours;
137  std::vector<mitk::ContourModelLiveWireInteractor::Pointer> m_LiveWireInteractors;
138 
139  PlaneGeometry::ConstPointer m_PlaneGeometry;
140  };
141 }
142 
143 #endif
Super class for all position events.
Base of all data objects.
Definition: mitkBaseData.h:42
#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:36
itk::SmartPointer< Self > Pointer
Abstract base class for segmentation tools.
Definition: mitkSegTool2D.h:54
Super-class that provides the functionality of a StateMachine to DataInteractors. ...