CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkVTKHistogram.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 __ctkVTKHistogram_h
22 #define __ctkVTKHistogram_h
23 
24 // CTK includes
25 #include "ctkHistogram.h"
26 #include "ctkPimpl.h"
27 #include "ctkVisualizationVTKWidgetsExport.h"
28 #include "ctkVTKObject.h"
29 
30 class vtkDataArray;
31 class ctkVTKHistogramPrivate;
32 
37 class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKHistogram: public ctkHistogram
38 {
39  Q_OBJECT;
41  Q_PROPERTY(int component READ component WRITE setComponent)
42  Q_PROPERTY(QVariant maxValue READ maxValue)
43  Q_PROPERTY(QVariant minValue READ minValue)
44  Q_PROPERTY(int numberOfBins READ numberOfBins WRITE setNumberOfBins)
45 public:
46  ctkVTKHistogram(QObject* parent = 0);
47  ctkVTKHistogram(vtkDataArray* dataArray, QObject* parent = 0);
48  virtual ~ctkVTKHistogram();
49 
50  virtual ctkControlPoint* controlPoint(int index)const;
51  virtual QVariant value(qreal pos)const;
53  virtual int count()const;
54 
55  // Set/Get the range of the histogram.
56  // Please note that after an array is set, the range will be reset.
57  // \sa resetRange()
58  virtual void setRange(qreal minRang, qreal maxRange);
59  virtual void range(qreal& minRange, qreal& maxRange)const;
60 
61  // Reset the range to the array's range.
62  virtual void resetRange();
63 
64  virtual QVariant minValue()const;
65  virtual QVariant maxValue()const;
66 
67  Q_INVOKABLE void setDataArray(vtkDataArray* dataArray);
68  Q_INVOKABLE vtkDataArray* dataArray()const;
69 
70  void setComponent(int component);
71  int component()const;
72 
73  // Set the number of bins to use in the histogram. If this is set,
74  // the range will be ignored.
75  int numberOfBins()const;
76  void setNumberOfBins(int number);
77 
78  Q_INVOKABLE virtual void removeControlPoint( qreal pos );
79 
80  Q_INVOKABLE virtual void build();
81 protected:
82  qreal indexToPos(int index)const;
83  int posToIndex(qreal pos)const;
84 
85 protected:
86  QScopedPointer<ctkVTKHistogramPrivate> d_ptr;
87 
88 private:
89  Q_DECLARE_PRIVATE(ctkVTKHistogram);
90  Q_DISABLE_COPY(ctkVTKHistogram);
91 };
92 
93 #endif
ctkVTKHistogram::resetRange
virtual void resetRange()
ctkHistogram.h
ctkVTKObject.h
ctkVTKHistogram::setRange
virtual void setRange(qreal minRang, qreal maxRange)
ctkVTKHistogram::maxValue
virtual QVariant maxValue() const
ctkControlPoint
Definition: ctkTransferFunction.h:59
ctkVTKHistogram
Definition: ctkVTKHistogram.h:38
ctkVTKHistogram::count
virtual int count() const
Returns the number of bins. Returns 0 until build() is called.
ctkVTKHistogram::ctkVTKHistogram
ctkVTKHistogram(vtkDataArray *dataArray, QObject *parent=0)
ctkVTKHistogram::dataArray
Q_INVOKABLE vtkDataArray * dataArray() const
ctkVTKHistogram::setDataArray
Q_INVOKABLE void setDataArray(vtkDataArray *dataArray)
QVTK_OBJECT
#define QVTK_OBJECT
Define VTK/Qt event/slot connection utility methods. It is a convenient macro that declares and defin...
Definition: ctkVTKObject.h:222
ctkVTKHistogram::minValue
virtual QVariant minValue() const
ctkVTKHistogram::d_ptr
QScopedPointer< ctkVTKHistogramPrivate > d_ptr
Definition: ctkVTKHistogram.h:86
ctkHistogram
Definition: ctkHistogram.h:45
ctkVTKHistogram::posToIndex
int posToIndex(qreal pos) const
ctkVTKHistogram::setComponent
void setComponent(int component)
ctkVTKHistogram::removeControlPoint
virtual Q_INVOKABLE void removeControlPoint(qreal pos)
ctkVTKHistogram::indexToPos
qreal indexToPos(int index) const
ctkVTKHistogram::value
virtual QVariant value(qreal pos) const
ctkVTKHistogram::numberOfBins
int numberOfBins() const
ctkPimpl.h
ctkVTKHistogram::~ctkVTKHistogram
virtual ~ctkVTKHistogram()
ctkVTKHistogram::build
virtual Q_INVOKABLE void build()
ctkVTKHistogram::ctkVTKHistogram
ctkVTKHistogram(QObject *parent=0)
ctkVTKHistogram::component
int component() const
ctkVTKHistogram::controlPoint
virtual ctkControlPoint * controlPoint(int index) const
ctkVTKHistogram::setNumberOfBins
void setNumberOfBins(int number)
ctkVTKHistogram::range
virtual void range(qreal &minRange, qreal &maxRange) const