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:
42 
44  vtkDiscretizableColorTransferFunction* function);
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();
65 
67  void SetOriginalRange(double min, double max);
68  double* GetOriginalRange();
69 
71  void CenterRange(double center);
72 
73  vtkCompositeControlPointsItem* GetControlPointsItem();
74 
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
void SetColorTransferFunction(vtkDiscretizableColorTransferFunction *function, double dataRangeMin, double dataRangeMax)
vtkTypeMacro(vtkDiscretizableColorTransferChart, vtkChartXY) static vtkDiscretizableColorTransferChart *New()
bool IsProcessingColorTransferFunction() const
void SetCurrentControlPointColor(const double rgb[3])
Set the color of the current color control point.
bool GetCurrentControlPointColor(double rgb[3])
is a currently selected control point, false otherwise.
vtkSmartPointer< vtkDiscretizableColorTransferControlPointsItem > ControlPoints
vtkSmartPointer< vtkHistogramMarker > MaxMarker
void CenterRange(double center)
Center the current position to the given point.
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) VTK_OVERRIDE
vtkSmartPointer< vtkCompositeTransferFunctionItem > CompositeHiddenItem
void SetCurrentRange(double min, double max)
vtkCompositeControlPointsItem * GetControlPointsItem()
void UpdateMarkerPosition(const vtkContextMouseEvent &m)
void SetColorTransferFunction(vtkDiscretizableColorTransferFunction *function)
void SetOriginalRange(double min, double max)
Set/Get the original range.
vtkSmartPointer< vtkHistogramMarker > MinMarker
vtkSmartPointer< vtkDiscretizableColorTransferFunction > ColorTransferFunction
static bool IsInRange(double min, double max, double value)
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) VTK_OVERRIDE
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) VTK_OVERRIDE
void SetDataRange(double min, double max)
Set/Get the data range.