Computer Assisted Medical Intervention Tool Kit  version 5.2
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-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, 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 
40 class ImageLutModel;
55 class ImageLutWidget : public QWidget {
56  Q_OBJECT
57 
58 public:
60  ImageLutWidget(QWidget* parent = nullptr);
61 
63  ~ImageLutWidget() override;
64 
67 
69  void showHistogramTooltip(QPointF);
70 
71 private slots:
72 
74  void levelSliderChanged(int);
75 
77  void levelSpinBoxChanged(double);
78 
80  void windowSliderChanged(int);
81 
83  void windowSpinBoxChanged(double);
84 
86  void invertButtonClicked();
87 
89  void setMinColor();
90 
92  void setMaxColor();
93 
95  virtual void resetLUT();
96 
98  void binComboBoxChanged(QString);
99 
101  void applyLUT();
102 
103 protected:
104 
106  void resizeEvent(QResizeEvent*) override;
107 
109  void showEvent(QShowEvent*) override;
110 
111 private:
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 
144  camitk::ImageComponent* myComponent;
145 
148  HistogramGraphicsRectItem* histogramGraphicsRectItem;
149 
151  Ui::ui_ImageLutWidget ui;
152 
154  QColor minColor;
155  QColor maxColor;
156 
158  ImageLutModel* model;
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
ImageLutWidget(QWidget *parent=nullptr)
Default construtor.
Definition: ImageLutWidget.cpp:46
void showHistogramTooltip(QPointF)
show tool tip from the histogramGraphicsRectItem
Definition: ImageLutWidget.cpp:354
void resizeEvent(QResizeEvent *) override
overwritten from QWidget to ensure fit in view, see fitView()
Definition: ImageLutWidget.cpp:344
void showEvent(QShowEvent *) override
overwritten from QWidget to ensure fit in view, see fitView()
Definition: ImageLutWidget.cpp:349
void updateComponent(camitk::ImageComponent *)
load the LUT data using the LUT from the image component (requires an ImageComponent with a LUT)
Definition: ImageLutWidget.cpp:87
~ImageLutWidget() override
destructor
Definition: ImageLutWidget.cpp:78
The manager of the Image Volume data.
Definition: ImageComponent.h:77