CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkVTKDiscretizableColorTransferWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkVTKDiscretizableColorTransferWidget_h
22 #define __ctkVTKDiscretizableColorTransferWidget_h
23 
24 // CTK includes
25 #include "ctkVisualizationVTKWidgetsExport.h"
26 class ctkVTKDiscretizableColorTransferWidgetPrivate;
28 
29 // VTK includes
30 #include <vtkSmartPointer.h>
31 class vtkAlgorithmOutput;
32 class vtkDiscretizableColorTransferFunction;
33 class vtkImageAccumulate;
34 class vtkPiecewiseFunction;
35 class vtkScalarsToColors;
36 
37 // Qt includes
38 #include <QWidget>
39 class QCheckBox;
40 class QLineEdit;
41 class QSpinBox;
42 class QToolButton;
43 
44 class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKDiscretizableColorTransferWidget: public QWidget
45 {
46  Q_OBJECT
50  Q_PROPERTY(QColor viewBackgroundColor READ viewBackgroundColor WRITE setViewBackgroundColor)
51 public:
52  explicit ctkVTKDiscretizableColorTransferWidget(QWidget* parent_ = CTK_NULLPTR);
54 
56  {
60  ONLY_CTF
61  };
62 
64  {
65  CTF,
67  VISIBLE
68  };
69 
70  void copyColorTransferFunction(vtkScalarsToColors* ctf, bool useCtfRange = false);
71  vtkDiscretizableColorTransferFunction* discretizableColorTransferFunction() const;
72 
76  void setLeftAxisMode(int mode);
77  int leftAxisMode();
78 
79  void setHistogramConnection(vtkAlgorithmOutput* input);
80  void updateHistogram(bool updateDataRange);
81 
82  void setViewBackgroundColor(const QColor& i_color);
83  QColor viewBackgroundColor() const;
84 
86 
87  void setVisibleRange(double min, double max);
90 
91  void setColorTransferFunctionRange(double min, double max);
95 
96  void setDataRange(double min, double max);
98 
100 
101 signals:
103  void currentScalarsToColorsChanged(vtkDiscretizableColorTransferFunction* ctf);
104 
105 public slots:
107  void onPaletteIndexChanged(vtkScalarsToColors* ctf);
112  void onRangeSliderValueChange(double min, double max);
113 
115  void setGlobalOpacity(double opacity);
116  void setNaNColor();
117  void setDiscretize(bool checked);
118  void setNumberOfDiscreteValues(int value);
119 
120 protected:
121  QScopedPointer<ctkVTKDiscretizableColorTransferWidgetPrivate> d_ptr;
122 
124  double* getVisibleRange();
125  double* getDataRange();
130 
131 private:
132  Q_DECLARE_PRIVATE(ctkVTKDiscretizableColorTransferWidget);
134 };
135 #endif // __ctkVTKDiscretizableColorTransferWidget_h
vtkDiscretizableColorTransferFunction * discretizableColorTransferFunction() const
ctkVTKDiscretizableColorTransferWidget(QWidget *parent_=CTK_NULLPTR)
void setHistogramConnection(vtkAlgorithmOutput *input)
void updateHistogram(bool updateDataRange)
void setViewBackgroundColor(const QColor &i_color)
QScopedPointer< ctkVTKDiscretizableColorTransferWidgetPrivate > d_ptr
ctkVTKScalarsToColorsComboBox * scalarsToColorsSelector() const
void setVisibleRange(double min, double max)
void onRangeSliderValueChange(double min, double max)
void resetVisibleRange(ResetVisibleRange resetMode)
void setDataRange(double min, double max)
void resetColorTransferFunctionRange(ResetCTFRange resetMode)
void onPaletteIndexChanged(vtkScalarsToColors *ctf)
void copyColorTransferFunction(vtkScalarsToColors *ctf, bool useCtfRange=false)
void currentScalarsToColorsChanged(vtkDiscretizableColorTransferFunction *ctf)
void setColorTransferFunctionRange(double min, double max)