GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GoTransferFunctionEditorWidget.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 /*=========================================================================
44  Modifications were made by the GoFigure Dev. Team.
45  while at Megason Lab, Systems biology, Harvard Medical school, 2009-11
46 
47  Copyright (c) 2009-11, President and Fellows of Harvard College.
48  All rights reserved.
49 
50  Redistribution and use in source and binary forms, with or without
51  modification, are permitted provided that the following conditions are met:
52 
53  Redistributions of source code must retain the above copyright notice,
54  this list of conditions and the following disclaimer.
55  Redistributions in binary form must reproduce the above copyright notice,
56  this list of conditions and the following disclaimer in the documentation
57 // and/or other materials provided with the distribution.
58  Neither the name of the President and Fellows of Harvard College
59  nor the names of its contributors may be used to endorse or promote
60  products derived from this software without specific prior written
61  permission.
62 
63  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
64  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
65  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
66  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
67  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
68  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
69  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
70  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
71  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
72  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
73  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
74 
75  =========================================================================*/
76 #ifndef __GoTransferFunctionEditorWidget_h
77 #define __GoTransferFunctionEditorWidget_h
78 
79 #include "QGoGUILibConfigure.h"
80 
81 // Qt
82 #include <QWidget>
83 #include <QBrush>
84 
85 //std
86 #include <vector>
87 #include <map>
88 
89 // gofigure
90 class HoverPoints;
92 
93 // qt
94 class QPolygonF;
95 class QTextStream;
96 class QPushButton;
97 class QSlider;
98 
99 //vtk
100 class vtkLookupTable;
101 class vtkImageAccumulate;
102 class vtkPiecewiseFunction;
103 
105 {
106  Q_OBJECT
107 public:
108  explicit GoTransferFunctionEditorWidget( QString iChannel,
109  const std::vector<double>& iColor,
110  std::vector<int> iLUTParameters,
111  double iMax,
112  QWidget *parent = 0 );
113 
119  void AddPoints( const std::map<unsigned int, unsigned int >& iPoints);
120 
125  void AddLookupTable(vtkLookupTable* iLUT);
126 
134  void AddHistogram(vtkImageAccumulate* iHistogram);
135 
143  void AddColor(const std::vector<double>& iColor);
144 
149  void AddName(QString iChannel);
150 
154  void AddOpacityTransferFunction(vtkPiecewiseFunction* iOpacity);
155 
160  void SetMaximumValue( double iMax);
161 
162 public slots:
167  void UpdateLUT();
174  void ChangeColor();
175 
179  void ResetLUT();
180 
185  void ApplyChanges();
186 
187  // opacity TF
188  // might be buggy, to be checked
189  void updateOpacityTF();
190 
195  void ShowHistogram(bool iShow);
196 
206  void AdjustWindowLevel(double iMin, double iMax);
207 
208 
214  void updateSliders(int iValue);
215 
216 signals:
220  void updateVisualization();
221 
226  std::map< unsigned int, unsigned int>,
227  QColor,
228  int,
229  int,
230  int);
231 
232 private:
239  const QPolygonF& iPoints, std::map< unsigned int, unsigned int>& iMap);
240 
247  const std::map< unsigned int, unsigned int>& iMap, QPolygonF& iPoints);
248 
253 
258 
263 
268 
273 
278 
283 
288 
292  vtkLookupTable *m_LUT;
293 
297  vtkPiecewiseFunction *m_OpacityTF;
298 
303 
307  double m_Max;
308 };
309 
310 #endif