NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkImageLookupTablesView.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 niftkImageLookupTablesView_h
16 #define niftkImageLookupTablesView_h
17 
18 #include "ui_niftkImageLookupTablesViewControls.h"
19 
20 #include <niftkBaseView.h>
21 #include <mitkLevelWindowManager.h>
22 #include <mitkDataNode.h>
23 #include <mitkImage.h>
24 
25 class QWidget;
26 class QSlider;
27 class vtkLookupTable;
28 
29 namespace niftk
30 {
31 
32 class LookupTableManager;
33 
40 {
41 
42  // this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
43  Q_OBJECT
44 
45 public:
46 
47  explicit ImageLookupTablesView();
49  virtual ~ImageLookupTablesView();
50 
54  static const QString VIEW_ID;
55 
59  virtual void CreateQtPartControl(QWidget *parent) override;
60 
64  virtual void OnSelectionChanged( berry::IWorkbenchPart::Pointer source,
65  const QList<mitk::DataNode::Pointer>& nodes ) override;
66 protected:
67 
71  virtual void Activated() override;
72 
76  virtual void SetFocus() override;
77 
81  virtual void OnPropertyChanged(const itk::EventObject&);
82 
86  virtual void OnLookupTablePropertyChanged(const itk::EventObject&);
87 
91  virtual void OnPropertyChanged();
92 
93 protected slots:
94 
99  void OnRangeChanged();
100 
104  void OnWindowBoundsChanged();
105 
109  void OnLevelWindowChanged();
110 
114  void OnLookupTableComboBoxChanged(int comboBoxIndex);
115 
119  void OnResetButtonPressed();
120 
124  void OnLoadButtonPressed();
125 
129  void OnSaveButtonPressed();
130 
134  void OnNewButtonPressed();
135 
140 
145 
150 
155 
159  void OnColorButtonPressed(int);
160 
164  void OnLabelMapTableCellChanged(int, int);
165 
166 private:
167 
171  void CreateConnections();
172 
177  bool IsSelectionValid(const QList<mitk::DataNode::Pointer>& nodes);
178 
182  void Register(const mitk::DataNode::Pointer node);
183 
187  void Unregister();
188 
192  void DifferentImageSelected();
193 
197  void UpdateGuiFromLevelWindow();
198 
202  void BlockSignals(bool b);
203 
207  void EnableControls(bool b);
208 
212  void EnableScaleControls(bool b);
213 ;
214 
218  void EnableLabelControls(bool b);
219 
220 
224  void UpdateLabelMapTable();
225 
226 
230  void UpdateLookupTableComboBox();
231 
235  void RetrievePreferenceValues();
236 
240  void LoadCachedLookupTables();
241 
245  QString LoadLookupTable(QString& fileName);
246 
250  virtual void OnPreferencesChanged(const berry::IBerryPreferences*) override;
251 
255  Ui::niftkImageLookupTablesViewControls* m_Controls;
256 
260  mitk::DataNode::Pointer m_CurrentNode;
261 
265  mitk::Image::Pointer m_CurrentImage;
266 
270  int m_Precision;
271 
275  bool m_InUpdate;
276 
280  int m_ThresholdForIntegerBehaviour;
281 
285  unsigned long int m_LevelWindowPropertyObserverTag;
286 };
287 
288 }
289 
290 #endif
virtual void SetFocus() override
Called by framework, sets the focus on a specific widget.
Definition: niftkImageLookupTablesView.cxx:260
virtual ~ImageLookupTablesView()
Definition: niftkImageLookupTablesView.cxx:99
void OnRangeChanged()
Called when a different image is selected or the min/max intensity limits has changed, which affects the actual minimum and maximum values that the sliders can reach.
Definition: niftkImageLookupTablesView.cxx:510
void OnMoveLabelUpButtonPressed()
Move the selected labels up one place in the list.
Definition: niftkImageLookupTablesView.cxx:1149
void OnLabelMapTableCellChanged(int, int)
Change name or value of selected cell.
Definition: niftkImageLookupTablesView.cxx:1320
virtual void OnLookupTablePropertyChanged(const itk::EventObject &)
Called when the user toggles the opacity control properties.
Definition: niftkImageLookupTablesView.cxx:644
static const QString VIEW_ID
Each view for a plugin has its own globally unique ID.
Definition: niftkImageLookupTablesView.h:54
void OnLevelWindowChanged()
Called when the window/level slider has changed.
Definition: niftkImageLookupTablesView.cxx:623
void OnLoadButtonPressed()
Called when the load button is pressed which will display a dialog allowing the user to load a lookup...
Definition: niftkImageLookupTablesView.cxx:750
virtual void OnPropertyChanged()
Actually updates the GUI when property changes.
Definition: niftkImageLookupTablesView.cxx:573
GLdouble GLdouble GLdouble b
Definition: glew.h:7885
void OnRemoveLabelButtonPressed()
Remove the selected labels to the current label map.
Definition: niftkImageLookupTablesView.cxx:1095
virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer source, const QList< mitk::DataNode::Pointer > &nodes) override
Called by framework when DataManager's selection has changed.
Definition: niftkImageLookupTablesView.cxx:324
void OnResetButtonPressed()
Called when the reset button is pressed which will recalculate the minimum and maximum intensity valu...
Definition: niftkImageLookupTablesView.cxx:723
virtual void CreateQtPartControl(QWidget *parent) override
Called by framework, this method creates all the controls for this view.
Definition: niftkImageLookupTablesView.cxx:111
ImageLookupTablesView()
Definition: niftkImageLookupTablesView.cxx:77
void OnSaveButtonPressed()
Called when the save button is pressed which will display a dialog allowing the user to save the curr...
Definition: niftkImageLookupTablesView.cxx:809
Base view component for plugins listening to visibility change events, focus changed events and so on...
Definition: niftkBaseView.h:47
void OnNewButtonPressed()
Called when the create new lookup table is pressed which will create an unscaled lookup table that is...
Definition: niftkImageLookupTablesView.cxx:907
Provides a simple GUI enabling the selection of window, level, min, max and a choice of lookup tables...
Definition: niftkImageLookupTablesView.h:39
void OnAddLabelButtonPressed()
Add a label to the current label map.
Definition: niftkImageLookupTablesView.cxx:1044
virtual void Activated() override
Definition: niftkImageLookupTablesView.cxx:381
void OnColorButtonPressed(int)
Change color of pressed label color.
Definition: niftkImageLookupTablesView.cxx:1253
void OnLookupTableComboBoxChanged(int comboBoxIndex)
Called when the lookup table combo box value changes, trigger the lookup table to be swapped...
Definition: niftkImageLookupTablesView.cxx:656
Definition: niftkExceptionObject.h:21
GLsizei GLsizei GLchar * source
Definition: glew.h:1816
void OnMoveLabelDownButtonPressed()
Move the selected labels down one place in the list.
Definition: niftkImageLookupTablesView.cxx:1201
void OnWindowBoundsChanged()
Called when the min/max slider has changed.
Definition: niftkImageLookupTablesView.cxx:602