Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmlMitkTransferFunctionItem.h
Go to the documentation of this file.
1 /*===================================================================
2 
3  The Medical Imaging Interaction Toolkit (MITK)
4 
5  Copyright (c) German Cancer Research Center,
6  Division of Medical and Biological Informatics.
7  All rights reserved.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without
10  even the implied warranty of MERCHANTABILITY or FITNESS FOR
11  A PARTICULAR PURPOSE.
12 
13  See LICENSE.txt or http://www.mitk.org for details.
14 
15  ===================================================================*/
16 
17 #ifndef __QmlmMitkTransferFunctionItem_h
18 #define __QmlmMitkTransferFunctionItem_h
19 
20 #include "MitkQmlItemsExports.h"
21 
22 #include <mitkCommon.h>
23 #include <mitkDataNode.h>
25 
28 
29 #include <QQuickItem>
30 #include <QSlider>
31 #include <QPushButton>
32 
33 namespace mitk
34 {
35  class BaseRenderer;
36 }
37 
39 {
40  Q_OBJECT
41  Q_PROPERTY(QmlMitkPiecewiseFunctionCanvas* opacityItem READ getOpacityItem WRITE setOpactityItem);
42  Q_PROPERTY(QmlMitkColorTransferFunctionCanvas* colorItem READ getColorItem WRITE setColorItem);
43 
44  Q_PROPERTY(double min READ getMin WRITE setMin NOTIFY minChanged);
45  Q_PROPERTY(double max READ getMax WRITE setMax NOTIFY maxChanged);
46  Q_PROPERTY(double currentMin READ getCurrentMin WRITE setCurrentMin NOTIFY currentMinChanged);
47  Q_PROPERTY(double currentMax READ getCurrentMax WRITE setCurrentMax NOTIFY currentMaxChanged);
48 public:
50 
51  QmlMitkTransferFunctionItem(QQuickItem* parent = nullptr);
53 
54  void SetDataNode(mitk::DataNode* node, const mitk::BaseRenderer* renderer = nullptr);
55 
56 public slots:
57  void OnUpdateCanvas();
58  void UpdateRanges();
59  void OnResetSlider();
60 
61  void wheelEvent(QWheelEvent* event) override;
62 
63  void OnSpanChanged (int lower, int upper);
64 
65  void setOpactityItem(QmlMitkPiecewiseFunctionCanvas* item);
66  void setColorItem(QmlMitkColorTransferFunctionCanvas* item);
67 
68  QmlMitkPiecewiseFunctionCanvas* getOpacityItem();
69  QmlMitkColorTransferFunctionCanvas* getColorItem();
70 
71  void setMin(double min);
72  void setMax(double max);
73  void setCurrentMin(double currentMin);
74  void setCurrentMax(double currentMax);
75 
76  double getMin();
77  double getMax();
78  double getCurrentMin();
79  double getCurrentMax();
80 
81  static void create();
82 
83 protected:
85 
86  int m_Min;
87  int m_Max;
88 
91 
94 
96 
97 signals:
98  void currentMinChanged();
99  void currentMaxChanged();
100  void minChanged();
101  void maxChanged();
102  void sync();
103 };
104 
105 #endif
QmlMitkColorTransferFunctionCanvas * m_ColorItem
#define MITKQMLITEMS_EXPORT
static QmlMitkTransferFunctionItem * instance
Organizes the rendering process.
DataCollection - Class to facilitate loading/accessing structured data.
QmlMitkPiecewiseFunctionCanvas * m_OpacityItem
mitk::TransferFunctionProperty::Pointer tfpToChange
static T max(T x, T y)
Definition: svm.cpp:70
virtual void SetDataNode(DataNode *dataNode) override
static T min(T x, T y)
Definition: svm.cpp:67
mitk::SimpleHistogramCache histogramCache
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66