ctkVTKHistogram.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 __ctkVTKHistogram_h
  15. #define __ctkVTKHistogram_h
  16. // CTK includes
  17. #include "ctkHistogram.h"
  18. #include "ctkPimpl.h"
  19. #include "ctkVisualizationVTKWidgetsExport.h"
  20. #include "ctkVTKObject.h"
  21. class vtkDataArray;
  22. class ctkVTKHistogramPrivate;
  23. /// \ingroup Visualization_VTK_Widgets
  24. ///
  25. /// Transfer function for a vtkColorTransferFunction.
  26. /// The value is an RGB QColor (no alpha supported)
  27. class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKHistogram: public ctkHistogram
  28. {
  29. Q_OBJECT;
  30. QVTK_OBJECT;
  31. public:
  32. ctkVTKHistogram(QObject* parent = 0);
  33. ctkVTKHistogram(vtkDataArray* dataArray, QObject* parent = 0);
  34. virtual ~ctkVTKHistogram();
  35. virtual ctkControlPoint* controlPoint(int index)const;
  36. virtual QVariant value(qreal pos)const;
  37. /// Returns the number of bins. Returns 0 until build() is called.
  38. virtual int count()const;
  39. /// Please note that range only works if you have at least set an array.
  40. virtual void range(qreal& minRange, qreal& maxRange)const;
  41. virtual QVariant minValue()const;
  42. virtual QVariant maxValue()const;
  43. void setDataArray(vtkDataArray* dataArray);
  44. vtkDataArray* dataArray()const;
  45. void setComponent(int component);
  46. int component()const;
  47. void setNumberOfBins(int number);
  48. virtual void removeControlPoint( qreal pos );
  49. virtual void build();
  50. protected:
  51. qreal indexToPos(int index)const;
  52. int posToIndex(qreal pos)const;
  53. protected:
  54. QScopedPointer<ctkVTKHistogramPrivate> d_ptr;
  55. private:
  56. Q_DECLARE_PRIVATE(ctkVTKHistogram);
  57. Q_DISABLE_COPY(ctkVTKHistogram);
  58. };
  59. #endif