NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
AffineTransformView.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef AffineTransformView_h
16 #define AffineTransformView_h
17 
18 #include <QmitkAbstractView.h>
19 #include <niftkBaseView.h>
20 #include <QmitkRenderWindow.h>
21 #include <berryISelectionListener.h>
22 
23 #include <itkImage.h>
24 
25 #include <vtkInteractorStyle.h>
26 #include <vtkMatrix4x4.h>
27 #include <vtkSmartPointer.h>
28 #include <vtkRenderWindowInteractor.h>
29 
30 #include <mitkBaseGeometry.h>
31 #include <mitkBoundingObject.h>
32 #include <mitkDataNode.h>
33 #include <mitkDataStorage.h>
34 #include <mitkGlobalInteraction.h>
35 #include <mitkWeakPointer.h>
36 
37 #include <niftkAffineTransformer.h>
40 
41 #include "ui_AffineTransformViewControls.h"
43 
53 {
54  // this is needed for all Qt objects that should have a Qt meta-object
55  // (everything that derives from QObject and wants to have signal/slots)
56  Q_OBJECT
57 
58  public:
59 
61  virtual ~AffineTransformView();
62 
63  protected slots:
64 
66  virtual void CreateQtPartControl(QWidget *parent) override;
67 
69  virtual void SetFocus() override;
70 
72  void OnParameterChanged();
73 
76 
78  void OnSaveTransformPushed();
79 
81  void OnLoadTransformPushed();
82 
85 
88 
91 
94 
96  void OnScalingValueChanged();
97 
100 
101  //************************************************************************************************************************
102 
104  void OnInteractiveModeToggled(bool on);
105 
107  void OnRotationToggled(bool on);
108 
110  void OnTransformReady();
111 
113  void OnFixAngleToggled(bool on);
114 
116  void OnAxisChanged(bool on);
117 
118  //************************************************************************************************************************
119 
120  protected:
121 
123  virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList<mitk::DataNode::Pointer> &nodes) override;
124 
125  private:
126 
128  void SetControlsEnabled(bool isEnabled);
129 
131  void SetInteractiveControlsEnabled(bool isEnabled);
132 
133  void SetSliderControlsEnabled(bool isEnabled);
134 
136  void SetUIValues(niftk::AffineTransformParametersDataNodeProperty::Pointer parametersProperty);
137 
139  void ResetUIValues();
140 
142  void GetValuesFromUI(niftk::AffineTransformParametersDataNodeProperty::Pointer parametersProperty);
143 
145  void GetValuesFromDisplay(vtkSmartPointer<vtkMatrix4x4> transform);
146 
160  void UpdateTransformDisplay();
161 
163  void ResetAffineTransformer();
164 
165  //************************************************************************************************************************
166  virtual void CreateNewBoundingObject(mitk::DataNode::Pointer);
167 
168  virtual void AddBoundingObjectToNode(mitk::DataNode::Pointer, bool fit);
169 
170  virtual void RemoveBoundingObjectFromNode();
171 
172  bool DisplayLegends(bool legendsON);
173  //************************************************************************************************************************
174 
175 
176 private:
177  Ui::AffineTransformWidget * m_Controls;
178  double m_CentreOfRotation[3];
179  mitk::DataNode::Pointer m_DataOwnerNode;
180  niftk::AffineTransformer::Pointer m_AffineTransformer;
181 
182 
183  //************************************************************************************************************************
184  bool m_InInteractiveMode;
185  bool m_RotationMode;
186  bool m_LegendAdded;
187  QWidget * m_ParentWidget;
188  mitk::WeakPointer<mitk::BaseData> m_CurrentDataObject;
189  mitk::BoundingObject::Pointer m_BoundingObject;
190  mitk::DataNode::Pointer m_BoundingObjectNode;
191  niftk::AffineTransformDataInteractor3D::Pointer m_AffineDataInteractor3D;
192  vtkLegendScaleActor * m_LegendActor;
193  niftk::CustomVTKAxesActor * m_CustomAxesActor;
194  //************************************************************************************************************************
195 };
196 
197 #endif // AffineTransformView_h
198 
virtual ~AffineTransformView()
Definition: AffineTransformView.cxx:94
virtual void SetFocus() override
Called by framework, sets the focus on a specific widget.
Definition: AffineTransformView.cxx:558
AffineTransformView()
Definition: AffineTransformView.cxx:70
void OnApplyTransformPushed()
Slot for updating the direction cosines of the current image.
Definition: AffineTransformView.cxx:817
GLuint GLenum GLenum transform
Definition: glew.h:12775
Definition: niftkCustomVTKAxesActor.h:27
void OnScalingValueChanged()
Slot for keeping the scaling sliders and spinboxes in synch.
Definition: AffineTransformView.cxx:410
void OnResetTransformPushed()
Slot for reset button that resets the parameter controls, and updates node geometry accordingly...
Definition: AffineTransformView.cxx:725
void OnRotationValueChanged()
Slot for keeping the rotation sliders and spinboxes in synch.
Definition: AffineTransformView.cxx:260
virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList< mitk::DataNode::Pointer > &nodes) override
Definition: AffineTransformView.cxx:563
void OnTransformReady()
Slot to update display when the interactive alignment has finished.
Definition: AffineTransformView.cxx:1101
void OnFixAngleToggled(bool on)
Slot for enabling / disabling fixed angle rotation / translations.
Definition: AffineTransformView.cxx:1055
void OnResampleTransformPushed()
Slot for resampling the current image.
Definition: AffineTransformView.cxx:800
void OnInteractiveModeToggled(bool on)
Slot for switching between interactive and regular transformation editing.
Definition: AffineTransformView.cxx:995
Base view component for plugins listening to visibility change events, focus changed events and so on...
Definition: niftkBaseView.h:47
void OnTranslationValueChanged()
Slot for keeping the translation sliders and spinboxes in synch.
Definition: AffineTransformView.cxx:335
void OnShearingValueChanged()
Slot for keeping the shearing sliders and spinboxes in synch.
Definition: AffineTransformView.cxx:483
void OnLoadTransformPushed()
Slot for loading transform from disk.
Definition: AffineTransformView.cxx:778
Affine transform UI plugin, provides controls to rotate, translate, scale and shear an mitk::DataNode...
Definition: AffineTransformView.h:52
void OnParameterChanged()
Slot for all changes to transformation parameters.
Definition: AffineTransformView.cxx:708
void OnRotationToggled(bool on)
Slot for switching between translation and rotation in interactive editing mode.
Definition: AffineTransformView.cxx:1031
void OnSaveTransformPushed()
Slot for saving transform to disk.
Definition: AffineTransformView.cxx:789
void OnAxisChanged(bool on)
Slot for swithcing the main axis of translation / rotation.
Definition: AffineTransformView.cxx:1082
virtual void CreateQtPartControl(QWidget *parent) override
Called by framework, this method creates all the controls for this view.
Definition: AffineTransformView.cxx:107