ctkVTKDiscretizableColorTransferWidget.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkVTKDiscretizableColorTransferWidget_h
  15. #define __ctkVTKDiscretizableColorTransferWidget_h
  16. // CTK includes
  17. #include "ctkVisualizationVTKWidgetsExport.h"
  18. class ctkVTKDiscretizableColorTransferWidgetPrivate;
  19. class ctkVTKScalarsToColorsComboBox;
  20. // VTK includes
  21. #include <vtkSmartPointer.h>
  22. class QVTKWidget;
  23. class vtkImageAccumulate;
  24. class vtkPiecewiseFunction;
  25. class vtkScalarsToColors;
  26. // Qt includes
  27. #include <QWidget>
  28. class QCheckBox;
  29. class QLineEdit;
  30. class QSpinBox;
  31. class QToolButton;
  32. class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKDiscretizableColorTransferWidget: public QWidget
  33. {
  34. Q_OBJECT
  35. /// This property controls the color of the view.
  36. /// Dark gray by default.
  37. /// \accessors viewBackgroundColor() setViewBackgroundColor()
  38. Q_PROPERTY(QColor viewBackgroundColor READ viewBackgroundColor WRITE setViewBackgroundColor)
  39. public:
  40. explicit ctkVTKDiscretizableColorTransferWidget(QWidget* parent_ = CTK_NULLPTR);
  41. virtual ~ctkVTKDiscretizableColorTransferWidget();
  42. void setColorTransferFunction(vtkScalarsToColors* ctf);
  43. vtkScalarsToColors* colorTransferFunction() const;
  44. void setHistogram(vtkImageAccumulate* hist);
  45. void setViewBackgroundColor(const QColor& i_color);
  46. QColor viewBackgroundColor() const;
  47. ctkVTKScalarsToColorsComboBox* scalarsToColorsSelector() const;
  48. signals:
  49. void currentScalarsToColorsModified();
  50. void currentScalarsToColorsChanged(vtkScalarsToColors* ctf);
  51. public slots:
  52. void onCurrentPointEdit();
  53. void onPaletteIndexChanged(vtkScalarsToColors* ctf);
  54. void setGlobalOpacity(double opacity);
  55. void resetColorTransferFunctionRange();
  56. void centerColorTransferFunctionRange();
  57. void invertColorTransferFunction();
  58. void setNaNColor();
  59. void setDiscretize(bool checked);
  60. void setNumberOfDiscreteValues(int value);
  61. void setColorTransferFunctionRange(double minValue, double maxValue);
  62. protected:
  63. QScopedPointer<ctkVTKDiscretizableColorTransferWidgetPrivate> d_ptr;
  64. private:
  65. Q_DECLARE_PRIVATE(ctkVTKDiscretizableColorTransferWidget);
  66. Q_DISABLE_COPY(ctkVTKDiscretizableColorTransferWidget);
  67. };
  68. #endif // __ctkVTKDiscretizableColorTransferWidget_h