Medical Imaging Interaction Toolkit  2021.10.99-cbc78432
Medical Imaging Interaction Toolkit
mitkTubeGraphDataInteractor.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 mitkTubeGraphDataInteractor3D_h_
14 #define mitkTubeGraphDataInteractor3D_h_
15 
16 #include <MitkTubeGraphExports.h>
17 
18 #include <mitkBaseRenderer.h>
19 #include <mitkDataInteractor.h>
20 
21 #include "mitkTubeGraph.h"
22 #include "mitkTubeGraphProperty.h"
23 
24 namespace mitk
25 {
26  // Define events for TubeGraph interaction notifications
27  itkEventMacro(SelectionChangedTubeGraphEvent, itk::AnyEvent);
28 
34  // Inherit from DataInteratcor, this provides functionality of a state machine and configurable inputs.
36  {
37  public:
39  itkNewMacro(Self);
40 
53  {
54  None = 0,
59  Multiple
60  };
61 
63  {
64  AttributationMode = 0,
68  InformationMode
69  };
70 
71  void SetActivationMode(const ActivationMode &activationMode);
72  ActivationMode GetActivationMode();
73 
74  void SetActionMode(const ActionMode &actionMode);
75  ActionMode GetActionMode();
76 
77  void ResetPickedTubes();
78 
79  mitk::Point3D GetLastPickedPosition();
80 
81  protected:
83  ~TubeGraphDataInteractor() override;
84 
89  void ConnectActionsAndFunctions() override;
90 
94  void DataNodeChanged() override;
95 
99  virtual bool CheckOverTube(const InteractionEvent *);
100  virtual void SelectTube(StateMachineAction *, InteractionEvent *);
101  virtual void DeselectTube(StateMachineAction *, InteractionEvent *);
102 
103  void SelectTubesByActivationModus();
104  void UpdateActivation();
105 
106  private:
107  std::vector<TubeGraph::TubeDescriptorType> GetTubesToRoot();
108  std::vector<TubeGraph::TubeDescriptorType> GetTubesBetweenPoints();
109  std::vector<TubeGraph::TubeDescriptorType> GetPathToPeriphery();
110  std::vector<TubeGraph::TubeDescriptorType> GetPathBetweenTubes(const TubeGraph::TubeDescriptorType &start,
111  const TubeGraph::TubeDescriptorType &end);
112 
113  TubeGraph::Pointer m_TubeGraph;
114  TubeGraphProperty::Pointer m_TubeGraphProperty;
115  TubeGraph::TubeDescriptorType m_LastPickedTube;
116  TubeGraph::TubeDescriptorType m_SecondLastPickedTube;
117  ActivationMode m_ActivationMode;
118  ActionMode m_ActionMode;
119  mitk::TubeElement *m_LastPickedElement = nullptr;
120  };
121 }
122 #endif
#define MITKTUBEGRAPH_EXPORT
itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent)
DataCollection - Class to facilitate loading/accessing structured data.
Abstract class for elements which describes tubular structur.
itk::SmartPointer< Self > Pointer
Base class from with interactors that handle DataNodes are to be derived.
std::pair< VertexDescriptorType, VertexDescriptorType > TubeDescriptorType
Definition: mitkTubeGraph.h:49
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
Definition: mitkBaseData.h:46