NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
QmitkPointSetCropper.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 #if !defined(QmitkPointSetCropper_h)
16 #define QmitkPointSetCropper_h
17 
18 #ifdef WIN32
19 #pragma warning( disable : 4250 )
20 #endif
21 
22 #include <niftkBaseView.h>
23 #include <mitkCuboid.h>
24 #include <mitkOperationActor.h>
25 #include <mitkOperation.h>
26 #include <mitkAffineInteractor.h>
27 #include <mitkWeakPointer.h>
28 #include <mitkPointSet.h>
29 #include <QProgressDialog>
30 
32 
33 #include "ui_QmitkPointSetCropperControls.h"
34 
40 class QmitkPointSetCropper : public niftk::BaseView, public mitk::OperationActor
41 {
42 
45  class opExchangeNodes: public mitk::Operation
46  {
47  public: opExchangeNodes( mitk::OperationType type, mitk::DataNode* node,
48  mitk::BaseData* oldData,
49  mitk::BaseData* newData );
50  ~opExchangeNodes();
51  mitk::DataNode* GetNode() { return m_Node; }
52  mitk::BaseData* GetOldData() { return m_OldData; }
53  mitk::BaseData* GetNewData() { return m_NewData; }
54  protected:
55  void NodeDeleted(const itk::Object * /*caller*/, const itk::EventObject & /*event*/);
56  private:
57  mitk::DataNode* m_Node;
58  mitk::BaseData::Pointer m_OldData;
59  mitk::BaseData::Pointer m_NewData;
60  long m_NodeDeletedObserverTag;
61  long m_OldDataDeletedObserverTag;
62  long m_NewDataDeletedObserverTag;
63  };
64 
65  Q_OBJECT
66 
67 public:
68 
72  QmitkPointSetCropper(QObject *parent=0);
73 
77  virtual ~QmitkPointSetCropper();
78 
82  virtual void SetFocus() override;
83 
87  virtual void CreateQtPartControl(QWidget* parent) override;
88 
92  virtual void CreateConnections();
93 
94  /*
95  \brief Interface of a mitk::StateMachine (for undo/redo)
96  */
97  virtual void ExecuteOperation (mitk::Operation*) override;
98 
99  QWidget* GetControls();
100 
101  virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList<mitk::DataNode::Pointer> &nodes) override;
102 
103 public slots:
104 
105  virtual void CropPointSet();
106  virtual void CreateNewBoundingObject();
107  virtual void ChkInformationToggled( bool on );
108 
109 protected:
110 
114  Ui::QmitkPointSetCropperControls * m_Controls;
115 
119  QWidget* m_ParentWidget;
120 
124  mitk::WeakPointer<mitk::DataNode> m_PointSetNode;
125 
129  mitk::WeakPointer<mitk::PointSet> m_PointSetToCrop;
130 
134  mitk::BoundingObject::Pointer m_CroppingObject;
135 
139  mitk::DataNode::Pointer m_CroppingObjectNode;
140 
144  mitk::AffineInteractor::Pointer m_AffineInteractor;
145 
149  virtual void CreateBoundingObject();
150 
154  virtual void AddBoundingObjectToNode(mitk::DataNode* node, bool fit);
155 
159  virtual void RemoveBoundingObjectFromNode();
160 
165  virtual void NodeRemoved(const mitk::DataNode* node) override;
166 
167 private:
168 
169  // Operation constant
170  static const mitk::OperationType OP_EXCHANGE;
171 
172  // Interface class for undo redo
174 
175 };
176 #endif // !defined(QmitkPointSetCropper_h)
virtual void SetFocus() override
SetFocus.
virtual void CropPointSet()
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1237
mitk::WeakPointer< mitk::PointSet > m_PointSetToCrop
A pointer to the PointSet to be cropped.
Definition: QmitkPointSetCropper.h:129
virtual void ChkInformationToggled(bool on)
mitk::AffineInteractor::Pointer m_AffineInteractor
Interactor for moving and scaling the cuboid.
Definition: QmitkPointSetCropper.h:144
virtual void CreateNewBoundingObject()
Definition: mitkPointSetCropperEventInterface.h:27
virtual void CreateQtPartControl(QWidget *parent) override
Creates the Qt widget containing the functionality controls, like sliders, buttons etc...
virtual void RemoveBoundingObjectFromNode()
Removes the cuboid from any node and hides it from the user.
mitk::WeakPointer< mitk::DataNode > m_PointSetNode
A pointer to the node of the PointSet to be croped.
Definition: QmitkPointSetCropper.h:124
QWidget * m_ParentWidget
Definition: QmitkPointSetCropper.h:119
Ui::QmitkPointSetCropperControls * m_Controls
Definition: QmitkPointSetCropper.h:114
virtual void CreateConnections()
Creates the Qt connections needed.
virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList< mitk::DataNode::Pointer > &nodes) override
mitk::BoundingObject::Pointer m_CroppingObject
The cuboid used for cropping.
Definition: QmitkPointSetCropper.h:134
Highly Experimental.
Definition: QmitkPointSetCropper.h:40
Base view component for plugins listening to visibility change events, focus changed events and so on...
Definition: niftkBaseView.h:47
virtual void NodeRemoved(const mitk::DataNode *node) override
NodeRemoved.
virtual void ExecuteOperation(mitk::Operation *) override
virtual void AddBoundingObjectToNode(mitk::DataNode *node, bool fit)
Finds the given node in the data tree and optionally fits the cuboid to it.
QmitkPointSetCropper(QObject *parent=0)
Constructor.
virtual ~QmitkPointSetCropper()
Destructor.
virtual void CreateBoundingObject()
Creates the cuboid and its data tree node.
mitk::DataNode::Pointer m_CroppingObjectNode
Tree node of the cuboid used for cropping.
Definition: QmitkPointSetCropper.h:139
QWidget * GetControls()