Computer Assited Medical Intervention Tool Kit  version 5.0
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-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, TIMC, 38000 Grenoble, France
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// -- QT stuff
31#include <QMap>
32
33// -- Camitk stuff
34#include "ui_ImageLutWidget.h"
35
36// -- Core image component stuff classes
37#include <ImageComponent.h>
38
40class ImageLutModel;
55class ImageLutWidget : public QWidget {
56 Q_OBJECT
57
58public:
60 ImageLutWidget(QWidget* parent = nullptr);
61
63 ~ImageLutWidget() override;
64
67
69 void showHistogramTooltip(QPointF);
70
71private slots:
72
74 void levelSliderChanged(int);
75
77 void levelSpinBoxChanged(double);
78
80 void windowSliderChanged(int);
81
83 void windowSpinBoxChanged(double);
84
87
89 void setMinColor();
90
92 void setMaxColor();
93
95 virtual void resetLUT();
96
98 void binComboBoxChanged(QString);
99
101 void applyLUT();
102
103protected:
104
106 void resizeEvent(QResizeEvent*) override;
107
109 void showEvent(QShowEvent*) override;
110
111private:
112
114 void initLevel(double value);
115
117 void initWindow(double value);
118
120 void blockAllSignals(bool);
121
123 void drawGraphics();
124
126 void fitView();
127
129 void updateGradient();
130
132 void updateBinComboBox();
133
141 bool setColor(QString whichColor, QColor newColor);
142
145
149
151 Ui::ui_ImageLutWidget ui;
152
154 QColor minColor;
155 QColor maxColor;
156
159
163 QMap<camitk::ImageComponent*, ImageLutModel*> allModels;
164};
165
166#endif
The class HistogramGraphicsRectItem defines the histogram graphics item and is required to manage the...
Definition: HistogramGraphicsRectItem.h:43
The class ImageLutModel model the histogram of a given vtkImageData.
Definition: ImageLutModel.h:46
The class ImageLutWidget defines a widget controling the Look Up Table of an instance of ImageCompone...
Definition: ImageLutWidget.h:55
void fitView()
ensure that all graphics are completely visible and only that
Definition: ImageLutWidget.cpp:338
virtual void resetLUT()
Slot that reset changed applied to the LUT.
Definition: ImageLutWidget.cpp:147
void initLevel(double value)
Init level slider and text with its minimum, maximum and current value.
Definition: ImageLutWidget.cpp:364
ImageLutWidget(QWidget *parent=nullptr)
Default construtor.
Definition: ImageLutWidget.cpp:47
void showHistogramTooltip(QPointF)
show tool tip from the histogramGraphicsRectItem
Definition: ImageLutWidget.cpp:355
void updateGradient()
update the gradient display in the widget
Definition: ImageLutWidget.cpp:440
void resizeEvent(QResizeEvent *) override
overwritten from QWidget to ensure fit in view, see fitView()
Definition: ImageLutWidget.cpp:345
void showEvent(QShowEvent *) override
overwritten from QWidget to ensure fit in view, see fitView()
Definition: ImageLutWidget.cpp:350
void windowSliderChanged(int)
Slot called when the slider for the window width has changed.
Definition: ImageLutWidget.cpp:429
void setMaxColor()
slot called when the max color button is clicked
Definition: ImageLutWidget.cpp:490
void levelSpinBoxChanged(double)
Slot called when the level sping box has changed.
Definition: ImageLutWidget.cpp:396
void applyLUT()
Update the component LUT using the GUI values.
Definition: ImageLutWidget.cpp:125
ImageLutModel * model
the current image LUT model (histogram, etc...)
Definition: ImageLutWidget.h:158
QColor maxColor
Definition: ImageLutWidget.h:155
QColor minColor
min and max colors
Definition: ImageLutWidget.h:154
Ui::ui_ImageLutWidget ui
the Qt GUI (build by ImageLutWidget.ui)
Definition: ImageLutWidget.h:151
void setMinColor()
slot called when the min color button is clicked
Definition: ImageLutWidget.cpp:500
void updateComponent(camitk::ImageComponent *)
load the LUT data using the LUT from the image component
Definition: ImageLutWidget.cpp:88
void windowSpinBoxChanged(double)
Slot called when the line edit for the window width has changed.
Definition: ImageLutWidget.cpp:418
void drawGraphics()
draws the histogram and LUT graphic representations
Definition: ImageLutWidget.cpp:195
bool setColor(QString whichColor, QColor newColor)
Update minColor or maxColor attribut and set the given push button background to the given color usin...
Definition: ImageLutWidget.cpp:454
void levelSliderChanged(int)
Slot called when the slider for the lut level has changed.
Definition: ImageLutWidget.cpp:407
void initWindow(double value)
Init window slider and text with its minimum, maximum and current value.
Definition: ImageLutWidget.cpp:375
HistogramGraphicsRectItem * histogramGraphicsRectItem
the graphics item around all other item in the graphics view (needed to scale the histogram view to t...
Definition: ImageLutWidget.h:148
~ImageLutWidget() override
destructor
Definition: ImageLutWidget.cpp:79
void updateBinComboBox()
update binComboBox with the actual number of bins in the model
Definition: ImageLutWidget.cpp:173
void invertButtonClicked()
Slot called when the invert button is clicked.
Definition: ImageLutWidget.cpp:387
void blockAllSignals(bool)
block/unblock signals for all the GUI widgets
Definition: ImageLutWidget.cpp:510
void binComboBoxChanged(QString)
change the number of histogram bins
Definition: ImageLutWidget.cpp:162
QMap< camitk::ImageComponent *, ImageLutModel * > allModels
History of all the models computed so far This optimizes the change of images currently selected by t...
Definition: ImageLutWidget.h:163
camitk::ImageComponent * myComponent
the current ImageComponent
Definition: ImageLutWidget.h:144
The manager of the Image Volume data.
Definition: ImageComponent.h:77