Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkSliceBasedInterpolatorWidget.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 #ifndef QmitkSliceBasedInterpolatorWidget_h_Included
18 #define QmitkSliceBasedInterpolatorWidget_h_Included
19 
21 #include "mitkDataStorage.h"
23 
24 #include <map>
25 
26 #include <QWidget>
27 
28 #include "ui_QmitkSliceBasedInterpolatorWidgetGUIControls.h"
29 
30 namespace mitk
31 {
32  class PlaneGeometry;
33  class SliceNavigationController;
34  class LabelSetImage;
35  class ToolManager;
36  class DiffSliceOperation;
37 }
38 
63 {
64  Q_OBJECT
65 
66 public:
67  QmitkSliceBasedInterpolatorWidget(QWidget *parent = 0, const char *name = 0);
69 
70  void SetDataStorage(mitk::DataStorage &storage);
71 
75  void SetSliceNavigationControllers(const QList<mitk::SliceNavigationController *> &controllers);
76 
77  void OnToolManagerWorkingDataModified();
78 
79  void OnTimeChanged(itk::Object *sender, const itk::EventObject &);
80 
81  void OnSliceChanged(itk::Object *sender, const itk::EventObject &);
82 
83  void OnSliceNavigationControllerDeleted(const itk::Object *sender, const itk::EventObject &);
84 
88  void OnSliceInterpolationInfoChanged(const itk::EventObject &);
89 
90  Ui::QmitkSliceBasedInterpolatorWidgetGUIControls m_Controls;
91 
92 signals:
93 
94  void signalSliceBasedInterpolationEnabled(bool);
95 
96 public slots:
97 
101  void OnToggleWidgetActivation(bool);
102 
103 protected slots:
104 
108  void OnAcceptInterpolationClicked();
109 
110  /*
111  \brief Reaction to "Accept All Slices" button click.
112  Opens popup to ask about which orientation should be interpolated
113  */
114  void OnAcceptAllInterpolationsClicked();
115 
116  /*
117  \brief Called from popup menu of OnAcceptAllInterpolationsClicked()
118  Will trigger interpolation for all slices in given orientation
119  */
120  void OnAcceptAllPopupActivated(QAction *action);
121 
122 protected:
123  typedef std::map<QAction *, mitk::SliceNavigationController *> ActionToSliceDimensionMapType;
124 
125  const ActionToSliceDimensionMapType CreateActionToSliceDimension();
126 
127  ActionToSliceDimensionMapType m_ActionToSliceDimensionMap;
128 
129  void AcceptAllInterpolations(mitk::SliceNavigationController *slicer);
130 
131  void WaitCursorOn();
132 
133  void WaitCursorOff();
134 
135  void RestoreOverrideCursor();
136 
142  mitk::Image::Pointer GetWorkingSlice(const mitk::PlaneGeometry *planeGeometry);
143 
152  void TranslateAndInterpolateChangedSlice(const itk::EventObject &e, mitk::SliceNavigationController *slicer);
153 
159  void Interpolate(mitk::PlaneGeometry *plane, unsigned int timeStep, mitk::SliceNavigationController *slicer);
160 
165  void UpdateVisibleSuggestion();
166 
167 private:
168  mitk::SliceBasedInterpolationController::Pointer m_SliceInterpolatorController;
169 
170  mitk::ToolManager *m_ToolManager;
171 
172  bool m_Activated;
173 
174  template <typename TPixel, unsigned int VImageDimension>
175  void WritePreviewOnWorkingImage(itk::Image<TPixel, VImageDimension> *target,
176  const mitk::Image *source,
177  int overwritevalue);
178 
179  QHash<mitk::SliceNavigationController *, int> m_ControllerToTimeObserverTag;
180  QHash<mitk::SliceNavigationController *, int> m_ControllerToSliceObserverTag;
181  QHash<mitk::SliceNavigationController *, int> m_ControllerToDeleteObserverTag;
182 
183  unsigned int m_InterpolationInfoChangedObserverTag;
184 
185  mitk::DiffSliceOperation *m_doOperation;
186  mitk::DiffSliceOperation *m_undoOperation;
187 
188  mitk::DataNode::Pointer m_PreviewNode;
189  mitk::Image::Pointer m_PreviewImage;
190 
191  mitk::LabelSetImage::Pointer m_WorkingImage;
192 
194 
195  unsigned int m_LastSliceIndex;
196 
197  QHash<mitk::SliceNavigationController *, unsigned int> m_TimeStep;
198 
200 };
201 
202 #endif
Ui::QmitkSliceBasedInterpolatorWidgetGUIControls m_Controls
Data management class that handles 'was created by' relations.
itk::SmartPointer< Self > Pointer
DataCollection - Class to facilitate loading/accessing structured data.
An Operation for applying an edited slice to the volume.
Controls the selection of the slice the associated BaseRenderer will display.
mitk::DataStorage::Pointer m_DataStorage
Image class for storing images.
Definition: mitkImage.h:76
ActionToSliceDimensionMapType m_ActionToSliceDimensionMap
Describes a two-dimensional, rectangular plane.
std::map< QAction *, mitk::SliceNavigationController * > ActionToSliceDimensionMapType
#define MITKSEGMENTATIONUI_EXPORT
Manages and coordinates instances of mitk::Tool.