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 
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 
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
ImageLutWidget::setMaxColor
void setMaxColor()
slot called when the max color button is clicked
Definition: ImageLutWidget.cpp:490
ImageLutWidget::histogramGraphicsRectItem
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
ImageLutModel::getMaxBinValue
double getMaxBinValue()
get the highgest grey level value
Definition: ImageLutModel.cpp:101
ImageLutWidget::initWindow
void initWindow(double value)
Init window slider and text with its minimum, maximum and current value.
Definition: ImageLutWidget.cpp:375
ImageLutWidget::myComponent
camitk::ImageComponent * myComponent
the current ImageComponent
Definition: ImageLutWidget.h:144
ImageLutWidget::levelSpinBoxChanged
void levelSpinBoxChanged(double)
Slot called when the level sping box has changed.
Definition: ImageLutWidget.cpp:396
ImageLutModel::getWindowFromPercent
double getWindowFromPercent(int)
get window value from a percentage
Definition: ImageLutModel.cpp:174
ImageLutWidget
The class ImageLutWidget defines a widget controling the Look Up Table of an instance of ImageCompone...
Definition: ImageLutWidget.h:55
ImageLutWidget::resizeEvent
void resizeEvent(QResizeEvent *) override
overwritten from QWidget to ensure fit in view, see fitView()
Definition: ImageLutWidget.cpp:345
ImageLutModel::getLevelFromPercent
double getLevelFromPercent(int)
get level value from a percentage
Definition: ImageLutModel.cpp:169
ImageLutModel::getPercentFromWindow
int getPercentFromWindow(double)
get window value as a percentage between 0 and 100
Definition: ImageLutModel.cpp:164
ImageLutWidget.h
ImageLutWidget::setColor
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
a
#define a
ImageLutModel::getPercentFromLevel
int getPercentFromLevel(double)
get level value as a percentage between 0 and 100
Definition: ImageLutModel.cpp:159
camitk::ImageComponent
The manager of the Image Volume data. An image volume data has no concrete 3D representation,...
Definition: ImageComponent.h:77
ImageLutWidget::setMinColor
void setMinColor()
slot called when the min color button is clicked
Definition: ImageLutWidget.cpp:500
ImageLutWidget::allModels
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
ImageLutWidget::levelSliderChanged
void levelSliderChanged(int)
Slot called when the slider for the lut level has changed.
Definition: ImageLutWidget.cpp:407
ImageLutWidget::updateComponent
void updateComponent(camitk::ImageComponent *)
load the LUT data using the LUT from the image component
Definition: ImageLutWidget.cpp:88
HistogramGraphicsRectItem
The class HistogramGraphicsRectItem defines the histogram graphics item and is required to manage the...
Definition: HistogramGraphicsRectItem.h:43
ImageLutWidget::updateGradient
void updateGradient()
update the gradient display in the widget
Definition: ImageLutWidget.cpp:440
ImageLutModel::getMinValue
double getMinValue()
get the minimal voxel value (lutMin)
Definition: ImageLutModel.cpp:141
ImageLutWidget::drawGraphics
void drawGraphics()
draws the histogram and LUT graphic representations
Definition: ImageLutWidget.cpp:195
Log.h
camitk::ImageComponent::getLut
virtual vtkSmartPointer< vtkWindowLevelLookupTable > getLut()
get the current lookup table
Definition: ImageComponent.cpp:742
HistogramGraphicsRectItem.h
ImageLutWidget::ui
Ui::ui_ImageLutWidget ui
the Qt GUI (build by ImageLutWidget.ui)
Definition: ImageLutWidget.h:151
ImageLutWidget::windowSpinBoxChanged
void windowSpinBoxChanged(double)
Slot called when the line edit for the window width has changed.
Definition: ImageLutWidget.cpp:418
ImageLutWidget::blockAllSignals
void blockAllSignals(bool)
block/unblock signals for all the GUI widgets
Definition: ImageLutWidget.cpp:510
ImageLutWidget::binComboBoxChanged
void binComboBoxChanged(QString)
change the number of histogram bins
Definition: ImageLutWidget.cpp:162
camitk::Viewer::getDockWidget
QDockWidget * getDockWidget()
Get the QDockWidget* where this viewer is currently docked (or nullptr if it is not docked anywhere o...
Definition: Viewer.cpp:176
ImageLutWidget::maxColor
QColor maxColor
Definition: ImageLutWidget.h:155
ImageLutModel::getBinIndexAsDouble
double getBinIndexAsDouble(double value, bool checkBound=true)
image value to the histogram value (required to show the current level/window values on the graph)
Definition: ImageLutModel.cpp:121
ImageLutModel::getBinValue
double getBinValue(int)
get the number of voxels that end up in a given bin index
Definition: ImageLutModel.cpp:91
ImageLutWidget::model
ImageLutModel * model
the current image LUT model (histogram, etc...)
Definition: ImageLutWidget.h:158
camitk::ImageComponent::refresh
void refresh() override
force refresh of all interactive viewers that are displaying sub-components as ImageComponent is not ...
Definition: ImageComponent.cpp:801
ImageLutWidget::minColor
QColor minColor
min and max colors
Definition: ImageLutWidget.h:154
camitk::Viewer
Viewer is an abstract class that is the base class for all viewers.
Definition: Viewer.h:180
camitk::ImageComponent::getImageData
vtkSmartPointer< vtkImageData > getImageData() const override
get the image volume managed by this Component
Definition: ImageComponent.h:123
ImageLutWidget::resetLUT
virtual void resetLUT()
Slot that reset changed applied to the LUT.
Definition: ImageLutWidget.cpp:147
ImageLutWidget::~ImageLutWidget
~ImageLutWidget() override
destructor
Definition: ImageLutWidget.cpp:79
ImageLutModel::setNumberOfBins
void setNumberOfBins(int)
change the number of bins
Definition: ImageLutModel.cpp:151
Viewer.h
ImageLutWidget::fitView
void fitView()
ensure that all graphics are completely visible and only that
Definition: ImageLutWidget.cpp:338
ImageLutModel
The class ImageLutModel model the histogram of a given vtkImageData.
Definition: ImageLutModel.h:46
ImageLutWidget::showHistogramTooltip
void showHistogramTooltip(QPointF)
show tool tip from the histogramGraphicsRectItem
Definition: ImageLutWidget.cpp:355
ImageLutModel::getMaxValue
double getMaxValue()
get the maximal voxel value (lutMax)
Definition: ImageLutModel.cpp:136
ImageLutWidget::initLevel
void initLevel(double value)
Init level slider and text with its minimum, maximum and current value.
Definition: ImageLutWidget.cpp:364
ImageLutWidget::invertButtonClicked
void invertButtonClicked()
Slot called when the invert button is clicked.
Definition: ImageLutWidget.cpp:387
ImageLutModel::getNumberOfBins
int getNumberOfBins()
get the current number of bins
Definition: ImageLutModel.cpp:146
ImageLutWidget::updateBinComboBox
void updateBinComboBox()
update binComboBox with the actual number of bins in the model
Definition: ImageLutWidget.cpp:173
ImageLutWidget::showEvent
void showEvent(QShowEvent *) override
overwritten from QWidget to ensure fit in view, see fitView()
Definition: ImageLutWidget.cpp:350
ImageLutModel.h
ImageLutWidget::windowSliderChanged
void windowSliderChanged(int)
Slot called when the slider for the window width has changed.
Definition: ImageLutWidget.cpp:429
ImageLutWidget::applyLUT
void applyLUT()
Update the component LUT using the GUI values.
Definition: ImageLutWidget.cpp:125
ImageLutWidget::ImageLutWidget
ImageLutWidget(QWidget *parent=nullptr)
Default construtor.
Definition: ImageLutWidget.cpp:47
ImageComponent.h
Application.h
camitk
Definition: Action.cpp:35