Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ImageLutWidget.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 
27 #ifndef ImageLutWidget_H
28 #define ImageLutWidget_H
29 
30 // -- stl stuff
31 #include <string>
32 #include <fstream>
33 #include <vector>
34 #include <sstream>
35 
36 // -- QT stuff
37 #include <QListWidget>
38 #include <QLineEdit>
39 #include <QCheckBox>
40 #include <QMap>
41 #include <QPushButton>
42 #include <QGraphicsView>
43 #include <QGraphicsSimpleTextItem>
44 
45 // -- vtk stuff
46 #include <vtkWindowLevelLookupTable.h>
47 #include <vtkSmartPointer.h>
48 
49 // -- Camitk stuff
50 #include "ui_ImageLutWidget.h"
51 
52 // -- Core image component stuff classes
53 #include <ImageComponent.h>
54 
66 class ImageLutWidget : public QWidget {
67  Q_OBJECT
68 
69 public:
71  ImageLutWidget(QWidget* parent = 0);
72 
75 
78 
79 private slots:
80 
82  void sliderLUTLevelChanged(int);
83 
86 
88  void sliderLUTWindowChanged(int);
89 
92 
94  void invertButtonClicked();
95 
97  void setMinColor();
98 
100  void setMaxColor();
101 
103  virtual void resetLUT();
104 
106  void applyLUT();
107 
108 protected:
109 
111  virtual void resizeEvent(QResizeEvent *);
112 
114  virtual void showEvent(QShowEvent *);
115 
116 private:
117 
119  void initLevelGUI(int min, int max, int value);
120 
122  void initWindowGUI(int min, int max, int value);
123 
125  void initSlider(QSlider *slider, int min, int max, int value);
126 
128  void blockAllSignals(bool);
129 
131  void draw();
132 
134  void fitView();
135 
137  template<class DATATYPE> void fillHistogramTable(DATATYPE * data, unsigned int dataDim, DATATYPE minVal, DATATYPE maxVal);
138 
140  void updateGradient();
141 
144 
146  double lutMin;
147 
149  double lutMax;
150 
152  double * greyLevels;
153 
156 
158  unsigned int nbHistoBins;
159 
161  bool invert;
162 
164  QGraphicsRectItem * sceneRectItem;
165 
167  Ui::ui_ImageLutWidget ui;
168 
169 };
170 
171 #endif
double lutMin
Min the possible data value (given by the data type of the image)
Definition: ImageLutWidget.h:146
void lineEditLUTWindowChanged()
Slot called when the line edit for the window width has changed.
void fillHistogramTable(DATATYPE *data, unsigned int dataDim, DATATYPE minVal, DATATYPE maxVal)
fill the data for the histogram
void initLevelGUI(int min, int max, int value)
Init level slider and text with its minimum, maximum and current value.
void applyLUT()
Update the component LUT using the GUI values.
virtual void showEvent(QShowEvent *)
overwritten from QWidget to ensure fit in view, see fitView()
unsigned int nbHistoBins
size of greyLevels
Definition: ImageLutWidget.h:158
void setMinColor()
slot called when the min color button is clicked
virtual void resizeEvent(QResizeEvent *)
overwritten from QWidget to ensure fit in view, see fitView()
void sliderLUTLevelChanged(int)
Slot called when the slider for the lut level has changed.
void draw()
draws the histogram and LUT graphic representation
Ui::ui_ImageLutWidget ui
the Qt GUI (build by ImageLutWidget.ui)
Definition: ImageLutWidget.h:167
void sliderLUTWindowChanged(int)
Slot called when the slider for the window width has changed.
void updateComponent(camitk::ImageComponent *)
load the LUT data using the LUT from the image component
Definition: ImageComponent.h:69
bool invert
does the user asked for an invert LUT
Definition: ImageLutWidget.h:161
void fitView()
ensure that all graphics are completely visible and only that
camitk::ImageComponent * myComponent
the current ImageComponent
Definition: ImageLutWidget.h:143
void updateGradient()
update the gradient display in the widget
The class ImageLutWidget defines a widget controling the Look Up Table of an instance of ImageCompone...
Definition: ImageLutWidget.h:66
double lutMax
Min the possible data value (given by the data type of the image)
Definition: ImageLutWidget.h:149
double * greyLevels
Table containing histogram bins.
Definition: ImageLutWidget.h:152
void setMaxColor()
slot called when the max color button is clicked
void blockAllSignals(bool)
block/unblock signals for all the GUI widgets
ImageLutWidget(QWidget *parent=0)
Default construtor.
virtual void resetLUT()
Slot that reset changed applied to the LUT.
QGraphicsRectItem * sceneRectItem
the graphics item around all other item in the graphics view
Definition: ImageLutWidget.h:164
void initSlider(QSlider *slider, int min, int max, int value)
init a slider
void invertButtonClicked()
Slot called when the invert button is clicked.
void lineEditLUTLevelChanged()
Slot called when the line edit for the lut level has changed.
double highestGreyLevel
highest number of grey level (highest value in greyLevels array)
Definition: ImageLutWidget.h:155
void initWindowGUI(int min, int max, int value)
Init window slider and text with its minimum, maximum and current value.
~ImageLutWidget()
destructor