NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkAffineTransformDataInteractor3D.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 
18 #ifndef niftkAffineTransformDataInteractor3D_h
19 #define niftkAffineTransformDataInteractor3D_h
20 
21 #include "niftkCoreExports.h"
22 
23 #include <mitkDataInteractor.h>
24 #include <mitkBaseRenderer.h>
25 //
26 #include <vtkPolyData.h>
27 #include <vtkRenderer.h>
28 #include <vtkRenderWindow.h>
29 #include <vtkRenderWindowInteractor.h>
30 #include <vtkLegendScaleActor.h>
31 #include <vtkAxesActor.h>
32 
33 #include <QApplication>
34 
35 namespace niftk
36 {
37 
43 class NIFTKCORE_EXPORT AffineTransformDataInteractor3D : public QObject, public mitk::DataInteractor
44 {
45  Q_OBJECT
46 
47 signals:
48  void transformReady();
49 
50 public:
51  enum { INTERACTION_MODE_TRANSLATION, INTERACTION_MODE_ROTATION };
52 
53  mitkClassMacro(AffineTransformDataInteractor3D, mitk::DataInteractor)
54  itkFactorylessNewMacro(Self)
55  itkCloneMacro(Self)
56 
58  void SetInteractionMode(unsigned int interactionMode);
60  void SetInteractionModeToTranslation();
62  void SetInteractionModeToRotation();
64  unsigned int GetInteractionMode() const;
65 
67  void SetAxesFixed(bool on, int which = 0);
68 
70  inline void SetBoundingObjectNode(mitk::DataNode * bObj) {m_BoundingObjectNode = bObj;}
71 
72  vtkMatrix4x4* GetUpdatedGeometry();
73 
74 protected:
75 
78 
83  virtual void ConnectActionsAndFunctions() override;
84 
85  bool UpdateCurrentRendererPointers(const mitk::InteractionEvent * interactionEvent);
86 
87  bool CheckObject(const mitk::InteractionEvent *interactionEvent);
88 
89  bool SelectObject(mitk::StateMachineAction* action, mitk::InteractionEvent* interactionEvent);
90 
91  bool DeselectObject(mitk::StateMachineAction* action, mitk::InteractionEvent* interactionEvent);
92 
93  bool InitMove(mitk::StateMachineAction* action, mitk::InteractionEvent* interactionEvent);
94 
95  bool Move(mitk::StateMachineAction* action, mitk::InteractionEvent* interactionEvent);
96 
97  bool AcceptMove(mitk::StateMachineAction* action, mitk::InteractionEvent* interactionEvent);
98 
99 private:
100 
102  bool m_InteractionMode;
103  bool m_AxesFixed;
104 
105  mitk::Point2D m_InitialPickedDisplayPoint;
106  double m_InitialPickedPointWorld[4];
107 
108  mitk::Point2D m_CurrentlyPickedDisplayPoint;
109  double m_CurrentlyPickedPointWorld[4];
110 
111  mitk::BaseGeometry::Pointer m_OriginalGeometry;
112 
113  mitk::BaseGeometry::Pointer m_UpdatedGeometry;
114 
115  mitk::Vector3D m_ObjectNormal;
116 
117  mitk::BaseRenderer * m_CurrentRenderer;
118  vtkRenderer * m_CurrentVtkRenderer;
119  vtkCamera * m_CurrentCamera;
120 
121  mitk::DataNode * m_BoundingObjectNode;
122 };
123 
124 }
125 
126 #endif /* MITKAFFINEDATAINTERACTOR3D_H*/
Definition: ReceptorMemberCommandTest.cxx:25
Affine data interaction with objects in 3D windows.
Definition: niftkAffineTransformDataInteractor3D.h:43
Definition: niftkAffineTransformDataInteractor3D.h:51
Definition: niftkExceptionObject.h:21