CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkTransferFunctionItem.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 __ctkTransferFunctionItem_h
22#define __ctkTransferFunctionItem_h
23
25#include <QGraphicsObject>
26
28#include "ctkWidgetsExport.h"
29#include "ctkPimpl.h"
30#include "ctkTransferFunction.h"
31
32struct ctkControlPoint;
33class ctkTransferFunctionItemPrivate;
34
38class CTK_WIDGETS_EXPORT ctkTransferFunctionItem: public QGraphicsObject
39{
40 Q_OBJECT
41 Q_PROPERTY(QRectF rect READ rect WRITE setRect)
42public:
43 ctkTransferFunctionItem(QGraphicsItem* parent = 0);
45 QGraphicsItem* parent = 0);
47
48 Q_INVOKABLE void setTransferFunction(ctkTransferFunction* transferFunction);
50
51 inline void setRect(qreal x, qreal y, qreal width, qreal height);
52
53 void setRect(const QRectF& rectangle);
54 QRectF rect()const;
55/*
56 qreal rangeXDiff();
57 qreal rangeXOffSet();
58
59 qreal rangeYDiff();
60 qreal rangeYOffSet();
61
62 QPointF transferFunction2ScreenCoordinates( qreal x, qreal y);
63 QPointF screen2TransferFunctionCoordinates( qreal x, qreal y);
64*/
65 virtual QRectF boundingRect()const;
66protected:
67 //qreal y(const QVariant& value)const;
68 //inline qreal y(const ctkPoint& point)const;
69
70 QColor color(const QVariant& value)const;
71 inline QColor color(const ctkPoint& point)const;
72
73 //QList<ctkPoint> bezierParams(ctkControlPoint* start, ctkControlPoint* end)const;
74 //QList<ctkPoint> nonLinearPoints(ctkControlPoint* start, ctkControlPoint* end)const;
75 virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant& value);
76protected:
77 QScopedPointer<ctkTransferFunctionItemPrivate> d_ptr;
78
79private:
80 Q_DECLARE_PRIVATE(ctkTransferFunctionItem);
81 Q_DISABLE_COPY(ctkTransferFunctionItem);
82};
83
84//-----------------------------------------------------------------------------
85void ctkTransferFunctionItem::setRect(qreal x, qreal y, qreal width, qreal height)
86{
87 this->setRect(QRectF(x,y,width,height));
88}
89/*
90//-----------------------------------------------------------------------------
91qreal ctkTransferFunctionItem::y(const ctkPoint& p)const
92{
93 return this->y(p.Value);
94}
95
96//-----------------------------------------------------------------------------
97QColor ctkTransferFunctionItem::color(const ctkPoint& p)const
98{
99 return this->color(p.Value);
100}
101*/
102#endif
ctkTransferFunctionItem(ctkTransferFunction *transferFunction, QGraphicsItem *parent=0)
QColor color(const ctkPoint &point) const
void setRect(qreal x, qreal y, qreal width, qreal height)
Q_INVOKABLE void setTransferFunction(ctkTransferFunction *transferFunction)
QColor color(const QVariant &value) const
virtual ~ctkTransferFunctionItem()
QScopedPointer< ctkTransferFunctionItemPrivate > d_ptr
ctkTransferFunction * transferFunction() const
virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
ctkTransferFunctionItem(QGraphicsItem *parent=0)
void setRect(const QRectF &rectangle)
virtual QRectF boundingRect() const