CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
vtkDiscretizableColorTransferChart.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 __vtkDiscretizableColorTransferChart_h
22 #define __vtkDiscretizableColorTransferChart_h
23 
24 #include "ctkVisualizationVTKCoreExport.h"
25 
26 #include <vtkChartXY.h>
27 #include <vtkSmartPointer.h>
28 
29 class vtkCompositeControlPointsItem;
30 class vtkCompositeTransferFunctionItem;
32 class vtkDiscretizableColorTransferFunction;
33 class vtkHistogramMarker;
34 class vtkTransform2D;
35 
36 class CTK_VISUALIZATION_VTK_CORE_EXPORT vtkDiscretizableColorTransferChart
37  : public vtkChartXY
38 {
39 public:
40  vtkTypeMacro(vtkDiscretizableColorTransferChart, vtkChartXY)
42 
43  void SetColorTransferFunction(
44  vtkDiscretizableColorTransferFunction* function);
45  void SetColorTransferFunction(
46  vtkDiscretizableColorTransferFunction* function,
47  double dataRangeMin, double dataRangeMax);
48 
50  bool GetCurrentControlPointColor(double rgb[3]);
51 
53  void SetCurrentControlPointColor(const double rgb[3]);
54 
56  void SetDataRange(double min, double max);
57  double* GetDataRange();
58 
62  void SetCurrentRange(double min, double max);
63  double* GetCurrentRange();
64  void RemapColorTransferFunction();
65 
67  void SetOriginalRange(double min, double max);
68  double* GetOriginalRange();
69 
71  void CenterRange(double center);
72 
73  vtkCompositeControlPointsItem* GetControlPointsItem();
74 
75  bool IsProcessingColorTransferFunction() const;
76 
77  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) VTK_OVERRIDE;
78  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) VTK_OVERRIDE;
79  bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) VTK_OVERRIDE;
80 
81 protected:
82 
83  static bool IsInRange(double min, double max, double value);
84  void UpdateMarkerPosition(const vtkContextMouseEvent& m);
85 
86  vtkSmartPointer<vtkCompositeTransferFunctionItem> CompositeHiddenItem;
87  vtkSmartPointer<vtkDiscretizableColorTransferControlPointsItem> ControlPoints;
88 
89  vtkSmartPointer<vtkTransform2D> Transform;
90  vtkSmartPointer<vtkDiscretizableColorTransferFunction> ColorTransferFunction;
91 
92  vtkPlot *MinPlot;
93  vtkPlot *MaxPlot;
94  vtkPlot *MinLinePlot;
95  vtkPlot *MaxLinePlot;
96  vtkSmartPointer<vtkHistogramMarker> MinMarker;
97  vtkSmartPointer<vtkHistogramMarker> MaxMarker;
98 
99  enum RangeMoving {
100  RangeMoving_NONE, RangeMoving_MIN, RangeMoving_MAX
101  };
103 
104  double DataRange[2];
105  double CurrentRange[2];
106  double OriginalRange[2];
107 
108 private:
111 };
112 
113 #endif
vtkDiscretizableColorTransferChart::RangeMoving_NONE
@ RangeMoving_NONE
Definition: vtkDiscretizableColorTransferChart.h:100
vtkDiscretizableColorTransferChart::rangeMoving
RangeMoving rangeMoving
Definition: vtkDiscretizableColorTransferChart.h:102
vtkDiscretizableColorTransferChart::ColorTransferFunction
vtkSmartPointer< vtkDiscretizableColorTransferFunction > ColorTransferFunction
Definition: vtkDiscretizableColorTransferChart.h:90
vtkDiscretizableColorTransferChart::MaxPlot
vtkPlot * MaxPlot
Definition: vtkDiscretizableColorTransferChart.h:93
vtkDiscretizableColorTransferChart::ControlPoints
vtkSmartPointer< vtkDiscretizableColorTransferControlPointsItem > ControlPoints
Definition: vtkDiscretizableColorTransferChart.h:87
vtkDiscretizableColorTransferChart::MaxMarker
vtkSmartPointer< vtkHistogramMarker > MaxMarker
Definition: vtkDiscretizableColorTransferChart.h:97
vtkDiscretizableColorTransferChart::CompositeHiddenItem
vtkSmartPointer< vtkCompositeTransferFunctionItem > CompositeHiddenItem
Definition: vtkDiscretizableColorTransferChart.h:86
vtkDiscretizableColorTransferChart::MinPlot
vtkPlot * MinPlot
Definition: vtkDiscretizableColorTransferChart.h:92
vtkDiscretizableColorTransferChart
Definition: vtkDiscretizableColorTransferChart.h:36
vtkDiscretizableColorTransferControlPointsItem
Definition: vtkDiscretizableColorTransferControlPointsItem.h:33
vtkDiscretizableColorTransferChart::MinLinePlot
vtkPlot * MinLinePlot
Definition: vtkDiscretizableColorTransferChart.h:94
vtkDiscretizableColorTransferChart::Transform
vtkSmartPointer< vtkTransform2D > Transform
Definition: vtkDiscretizableColorTransferChart.h:89
vtkDiscretizableColorTransferChart::MinMarker
vtkSmartPointer< vtkHistogramMarker > MinMarker
Definition: vtkDiscretizableColorTransferChart.h:96
vtkDiscretizableColorTransferChart::MaxLinePlot
vtkPlot * MaxLinePlot
Definition: vtkDiscretizableColorTransferChart.h:95
vtkDiscretizableColorTransferChart::RangeMoving
RangeMoving
Definition: vtkDiscretizableColorTransferChart.h:99