GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GoTransferFunctionWidget.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the demonstration applications of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** Commercial Usage
11 ** Licensees holding valid Qt Commercial licenses may use this file in
12 ** accordance with the Qt Commercial License Agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and Nokia.
15 **
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23 **
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27 **
28 ** GNU General Public License Usage
29 ** Alternatively, this file may be used under the terms of the GNU
30 ** General Public License version 3.0 as published by the Free Software
31 ** Foundation and appearing in the file LICENSE.GPL included in the
32 ** packaging of this file. Please review the following information to
33 ** ensure the GNU General Public License version 3.0 requirements will be
34 ** met: http://www.gnu.org/copyleft/gpl.html.
35 **
36 ** If you have questions regarding the use of this file, please contact
37 ** Nokia at qt-info@nokia.com.
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 /*=========================================================================
43  Modifications were made by the GoFigure Dev. Team.
44  while at Megason Lab, Systems biology, Harvard Medical school, 2009-11
45 
46  Copyright (c) 2009-11, President and Fellows of Harvard College.
47  All rights reserved.
48 
49  Redistribution and use in source and binary forms, with or without
50  modification, are permitted provided that the following conditions are met:
51 
52  Redistributions of source code must retain the above copyright notice,
53  this list of conditions and the following disclaimer.
54  Redistributions in binary form must reproduce the above copyright notice,
55  this list of conditions and the following disclaimer in the documentation
56 // and/or other materials provided with the distribution.
57  Neither the name of the President and Fellows of Harvard College
58  nor the names of its contributors may be used to endorse or promote
59  products derived from this software without specific prior written
60  permission.
61 
62  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
63  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
64  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
65  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
66  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
67  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
68  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
69  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
70  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
71  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
72  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
73 
74  =========================================================================*/
75 
76 #ifndef __GoTransferFunctionWidget_h
77 #define __GoTransferFunctionWidget_h
78 
79 #include <QtGui>
80 
81 class HoverPoints;
82 
83 // vtk
84 class vtkLookupTable;
85 
86 
88 {
89  Q_OBJECT
90 public:
91 
93  double iMax,
94  QWidget *parent);
95 
102  void paintEvent(QPaintEvent *e);
103 
104  QSize sizeHint() const { return QSize(150, 40); }
105  QPolygonF points() const;
106 
107 
113  void AddPointsToOpacityTF(const QPolygonF& iPoints);
114 
115 
121  void AddPointsToLUT(const QPolygonF& iPoints);
122 
130  void UpdateLookupTable(vtkLookupTable* iLUT,
131  qreal iGamma, qreal iMin, qreal iMax);
132 
136  void SetHistogram(QVector<qreal> iHistogram);
137 
141  void ResetOpacity();
142 
149  void setColor(QColor iColor);
150 
154  void setMax(double iMax);
155 
156 signals:
160  void opacityChanged();
161 
165  void enableOpacityTF(bool);
166 
170  void enableLUTCurve(bool);
171 
172 private:
176  void generateShade();
177 
182 
187 
192 
197 
202 
206  double m_Max;
207 };
208 
209 #endif
QVector< qreal > m_Histogram
the histogram
void enableLUTCurve(bool)
enable/disable LUT curve
void paintEvent(QPaintEvent *e)
Paint event: 1- generate new shade is size of the widget changed 2- draw the shade 3- draw the histog...
GoTransferFunctionWidget(QColor iColor, double iMax, QWidget *parent)
void AddPointsToOpacityTF(const QPolygonF &iPoints)
Add points to the opacity transfer function. Called at initialization or reset.
void opacityChanged()
Point added in the Opacity TF then update the visualization.
HoverPoints * m_LUTPoints
LUT points.
void AddPointsToLUT(const QPolygonF &iPoints)
Add points to the LUT. Called at initialization or reset.
double m_Max
Maximum pixel value in the current channel at given time point.
void UpdateLookupTable(vtkLookupTable *iLUT, qreal iGamma, qreal iMin, qreal iMax)
Modify LUT with given parameters.
HoverPoints * m_OpacityTFPoints
Opacity transfer function points.
void setMax(double iMax)
Set maximum pixel intensity for current channel at current T point.
QImage m_shade
Shade generated, based on the color.
QColor m_color
Color of the current channel.
void setColor(QColor iColor)
Set the color of the channel. 1- Modify the color 2- Update the shade 3- Update the visualization...
QObject * parent() const
void generateShade()
Generate the shade when the color changed.
void SetHistogram(QVector< qreal > iHistogram)
Set the histogram.
void ResetOpacity()
Reset the opacity TF from min to max, from 0 to 1.
void enableOpacityTF(bool)
enable/disable opacity TF