CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
vtkScalarsToColorsContextItem.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 __vtkScalarsToColorsContextItem_h
22 #define __vtkScalarsToColorsContextItem_h
23 
24 #include "ctkVisualizationVTKCoreExport.h"
25 
26 #include <vtkAbstractContextItem.h>
27 #include <vtkNew.h>
28 #include <vtkSmartPointer.h>
29 #include <vtkVector.h>
30 
33 class vtkDiscretizableColorTransferFunction;
34 class vtkScalarsToColors;
36 class vtkTable;
37 
42 class CTK_VISUALIZATION_VTK_CORE_EXPORT vtkScalarsToColorsContextItem
43  : public vtkAbstractContextItem
44 {
45  vtkTypeMacro(vtkScalarsToColorsContextItem, vtkAbstractContextItem)
46 public:
47  static vtkScalarsToColorsContextItem* New();
48 
52  void SetLeftAxisMode(int mode);
53  int GetLeftAxisMode();
54 
56  void CopyColorTransferFunction(vtkScalarsToColors* ctf);
57  vtkDiscretizableColorTransferFunction* GetDiscretizableColorTransferFunction();
58  void ResetColorTransferFunction();
59  void BuildColorTransferFunction();
60 
62  void SetHistogramTable(vtkTable* table,
63  const char* xAxisColumn, const char* yAxisColumn);
64 
66  bool Paint(vtkContext2D* painter) VTK_OVERRIDE;
67 
69  void SetCurrentControlPointColor(const double rgb[3]);
70  bool GetCurrentControlPointColor(double rgb[3]);
71 
73  void SetDataRange(double min, double max);
74  double* GetDataRange();
75 
77  void SetCurrentRange(double min, double max);
78  double* GetCurrentRange();
79 
81  void SetVisibleRange(double min, double max);
82  double* GetVisibleRange();
83 
85  void CenterRange(double center);
86 
88  void RecalculateChartsRange();
89 
91  void SetGlobalOpacity(double opacity);
92 
95  void InvertColorTransferFunction();
96 
99  bool IsProcessingColorTransferFunction() const;
100 
101 protected:
102 
103  vtkSmartPointer<vtkDiscretizableColorTransferChart> EditorChart;
104  vtkSmartPointer<vtkScalarsToColorsPreviewChart> PreviewChart;
105  vtkSmartPointer<vtkScalarsToColorsHistogramChart> HistogramChart;
106 
107  vtkSmartPointer<vtkDiscretizableColorTransferFunction> ColorTransferFunction;
108 
109 private:
111  ~vtkScalarsToColorsContextItem() VTK_OVERRIDE;
112 
114  vtkVector2i LastSceneSize;
115 
117  class EventForwarder;
118  EventForwarder* PrivateEventForwarder;
119 };
120 #endif // __vtkScalarsToColorsContextItem_h
vtkSmartPointer< vtkScalarsToColorsHistogramChart > HistogramChart
vtkSmartPointer< vtkDiscretizableColorTransferFunction > ColorTransferFunction
vtkSmartPointer< vtkScalarsToColorsPreviewChart > PreviewChart
vtkSmartPointer< vtkDiscretizableColorTransferChart > EditorChart