Medical Imaging Interaction Toolkit  2021.10.99-1c4db16f
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 (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 QmitkSliceBasedInterpolatorWidget_h_Included
14 #define QmitkSliceBasedInterpolatorWidget_h_Included
15 
17 #include "mitkDataStorage.h"
19 
20 #include <map>
21 
22 #include <QWidget>
23 
24 #include "ui_QmitkSliceBasedInterpolatorWidgetGUIControls.h"
25 
26 namespace mitk
27 {
28  class PlaneGeometry;
29  class SliceNavigationController;
30  class LabelSetImage;
31  class ToolManager;
32  class DiffSliceOperation;
33 }
34 
58 {
59  Q_OBJECT
60 
61 public:
62  QmitkSliceBasedInterpolatorWidget(QWidget *parent = nullptr, const char *name = nullptr);
64 
65  void SetDataStorage(mitk::DataStorage &storage);
66 
70  void SetSliceNavigationControllers(const QList<mitk::SliceNavigationController *> &controllers);
71 
72  void OnToolManagerWorkingDataModified();
73 
74  void OnTimeChanged(itk::Object *sender, const itk::EventObject &);
75 
76  void OnSliceChanged(itk::Object *sender, const itk::EventObject &);
77 
78  void OnSliceNavigationControllerDeleted(const itk::Object *sender, const itk::EventObject &);
79 
83  void OnSliceInterpolationInfoChanged(const itk::EventObject &);
84 
85  Ui::QmitkSliceBasedInterpolatorWidgetGUIControls m_Controls;
86 
87 signals:
88 
89  void signalSliceBasedInterpolationEnabled(bool);
90 
91 public slots:
92 
96  void OnToggleWidgetActivation(bool);
97 
98 protected slots:
99 
103  void OnAcceptInterpolationClicked();
104 
105  /*
106  \brief Reaction to "Accept All Slices" button click.
107  Opens popup to ask about which orientation should be interpolated
108  */
109  void OnAcceptAllInterpolationsClicked();
110 
111  /*
112  \brief Called from popup menu of OnAcceptAllInterpolationsClicked()
113  Will trigger interpolation for all slices in given orientation
114  */
115  void OnAcceptAllPopupActivated(QAction *action);
116 
117 protected:
118  typedef std::map<QAction *, mitk::SliceNavigationController *> ActionToSliceDimensionMapType;
119 
120  const ActionToSliceDimensionMapType CreateActionToSliceDimension();
121 
122  ActionToSliceDimensionMapType m_ActionToSliceDimensionMap;
123 
124  void AcceptAllInterpolations(mitk::SliceNavigationController *slicer);
125 
126  void WaitCursorOn();
127 
128  void WaitCursorOff();
129 
130  void RestoreOverrideCursor();
131 
137  mitk::Image::Pointer GetWorkingSlice(const mitk::PlaneGeometry *planeGeometry);
138 
147  void TranslateAndInterpolateChangedSlice(const itk::EventObject &e, mitk::SliceNavigationController *slicer);
148 
154  void Interpolate(mitk::PlaneGeometry *plane, mitk::TimePointType timePoint, mitk::SliceNavigationController *slicer);
155 
160  void UpdateVisibleSuggestion();
161 
162 private:
163  mitk::SliceBasedInterpolationController::Pointer m_SliceInterpolatorController;
164 
165  mitk::ToolManager *m_ToolManager;
166 
167  bool m_Activated;
168 
169  template <typename TPixel, unsigned int VImageDimension>
170  void WritePreviewOnWorkingImage(itk::Image<TPixel, VImageDimension> *target,
171  const mitk::Image *source,
172  int overwritevalue);
173 
174  QHash<mitk::SliceNavigationController *, int> m_ControllerToTimeObserverTag;
175  QHash<mitk::SliceNavigationController *, int> m_ControllerToSliceObserverTag;
176  QHash<mitk::SliceNavigationController *, int> m_ControllerToDeleteObserverTag;
177 
178  unsigned int m_InterpolationInfoChangedObserverTag;
179 
180  mitk::DiffSliceOperation *m_doOperation;
181  mitk::DiffSliceOperation *m_undoOperation;
182 
183  mitk::DataNode::Pointer m_PreviewNode;
184  mitk::Image::Pointer m_PreviewImage;
185 
186  mitk::LabelSetImage::Pointer m_WorkingImage;
187 
188  QHash<mitk::SliceNavigationController *, mitk::TimePointType> m_TimePoints;
189 
190  mitk::DataStorage::Pointer m_DataStorage;
191 
193 
194  unsigned int m_LastSliceIndex;
195 };
196 
197 #endif
Ui::QmitkSliceBasedInterpolatorWidgetGUIControls m_Controls
Data management class that handles &#39;was created by&#39; relations.
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.
Image class for storing images.
Definition: mitkImage.h:69
mitk::ScalarType TimePointType
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.