Computer Assisted Medical Intervention Tool Kit  version 5.2
VolumeRenderingWidget.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 VOLUMERENDERINGWIDGET_H
28 #define VOLUMERENDERINGWIDGET_H
29 
30 // - Qt stuff
31 #include <QWidget>
32 #include <QString>
33 
34 // - Local Stuff
35 #include "ColorPointWidget.h"
36 #include "GradientOpacityWidget.h"
38 
39 #include "ui_VolumeRenderingWidget.h"
40 
52 class VolumeRenderingWidget : public QWidget {
53  Q_OBJECT
54 
55 public:
57  VolumeRenderingWidget(VolumeRenderingAction* myAction, QWidget* parent = nullptr);
58 
62  void updateUI(QString name, bool existVR);
63 
65  bool visibility();
66 
67  // ----------- Destructor
68  ~VolumeRenderingWidget() override;
69 
70  // ----------- Transparency
72 
73  void setDefaultTransparencies(QMap<int, double> defaultTransparencies);
74 
75  void addTransparency(int grayLevel, double transparency);
76 
77  QMap<int, double> getTransparencyPoints();
78 
79  // ----------- Colors
81 
82  void setDefaultColors(QMap<int, QColor> defaultColors);
83 
84  void addColor(int grayLevel, QColor color);
85 
86  QMap<int, QColor> getColorPoints();
87 
88  // ----------- Gradient Opacity
90 
91  void setDefaultOpacities(QMap<int, double> defaultOpacities);
92 
93  void addGradientOpacity(int grayLevel, double opacity);
94 
95  QMap<int, double> getOpacityPoints();
96 
97  // ----------- Lights
98  void setAmbient(double ambient);
99  double getAmbient();
100 
101  void setDiffuse(double diffuse);
102  double getDiffuse();
103 
104  void setSpecular(double specular);
105  double getSpecular();
106 
107  void load(QString filename);
108 
109 signals:
111  void refresh();
112 
113 public slots:
115  virtual void loadColorMap();
116  virtual void saveColorMap();
117  virtual void resetColorMap();
119  virtual void refreshVolumeRendering();
121  virtual void addTransparency();
123  virtual void addColor();
125  virtual void addGradientOpacity();
127  virtual void ambientLightSliderChanged(int);
128  virtual void ambientLightSpinBoxChanged(double);
130  virtual void diffuseLightSliderChanged(int);
131  virtual void diffuseLightSpinBoxChanged(double);
133  virtual void specularLightSliderChanged(int);
134  virtual void specularLightSpinBoxChanged(double);
135  // visibilty
136  virtual void visibilityToggled(bool);
137 private:
138  Ui_VolumeRenderingWidget ui;
139  QList<ColorPointWidget*> colorPoints;
140  QList<GradientOpacityWidget*> gradientOpacities;
141  QList<TransparencyPointWidget*> transparencies;
142  VolumeRenderingAction* myAction;
143 };
144 
145 #endif
This widget handle specifically the color of each voxel (R, G, B) in the output rendered image.
Definition: ColorPointWidget.h:44
This widget handle specifically the gradient opacity in the output image.
Definition: GradientOpacityWidget.h:44
This widget handle specifically the transparency in the output image.
Definition: TransparencyPointWidget.h:48
This action perform a volume rendering.
Definition: VolumeRenderingAction.h:44
The widget allows the user to select the desired parameter for the transfer function.
Definition: VolumeRenderingWidget.h:52
double getAmbient()
Definition: VolumeRenderingWidget.cpp:282
virtual void specularLightSliderChanged(int)
Specular Light Value Editing.
Definition: VolumeRenderingWidget.cpp:532
virtual void saveColorMap()
Definition: VolumeRenderingWidget.cpp:406
void removeOpacityPoint(GradientOpacityWidget *point)
Definition: VolumeRenderingWidget.cpp:236
virtual void diffuseLightSpinBoxChanged(double)
Definition: VolumeRenderingWidget.cpp:524
void load(QString filename)
Definition: VolumeRenderingWidget.cpp:307
void updateUI(QString name, bool existVR)
update the UI using the given name (current image name) and its visibility existVR should be true if ...
Definition: VolumeRenderingWidget.cpp:87
void refresh()
emitted when the user clicked on the Refresh button
double getSpecular()
Definition: VolumeRenderingWidget.cpp:302
void removeColorPoint(ColorPointWidget *point)
Definition: VolumeRenderingWidget.cpp:127
virtual void resetColorMap()
Definition: VolumeRenderingWidget.cpp:499
virtual void ambientLightSpinBoxChanged(double)
Definition: VolumeRenderingWidget.cpp:510
void removeTransparencyPoint(TransparencyPointWidget *point)
Definition: VolumeRenderingWidget.cpp:182
void setSpecular(double specular)
Definition: VolumeRenderingWidget.cpp:297
virtual void refreshVolumeRendering()
When to change volume rendering.
Definition: VolumeRenderingWidget.cpp:108
bool visibility()
get the current visibility value
double getDiffuse()
Definition: VolumeRenderingWidget.cpp:292
~VolumeRenderingWidget() override
Definition: VolumeRenderingWidget.cpp:51
QMap< int, double > getTransparencyPoints()
Definition: VolumeRenderingWidget.cpp:212
virtual void diffuseLightSliderChanged(int)
Diffuse Light Value Editing.
Definition: VolumeRenderingWidget.cpp:518
virtual void addGradientOpacity()
Gradient Opacity.
Definition: VolumeRenderingWidget.cpp:223
void setDefaultTransparencies(QMap< int, double > defaultTransparencies)
Definition: VolumeRenderingWidget.cpp:189
QMap< int, double > getOpacityPoints()
Definition: VolumeRenderingWidget.cpp:266
QMap< int, QColor > getColorPoints()
Definition: VolumeRenderingWidget.cpp:158
virtual void ambientLightSliderChanged(int)
ambient Light Value Editing
Definition: VolumeRenderingWidget.cpp:504
void setDefaultColors(QMap< int, QColor > defaultColors)
Definition: VolumeRenderingWidget.cpp:134
void setDiffuse(double diffuse)
Definition: VolumeRenderingWidget.cpp:287
void setAmbient(double ambient)
Definition: VolumeRenderingWidget.cpp:277
virtual void loadColorMap()
Load / Save / Reset colormaps.
Definition: VolumeRenderingWidget.cpp:400
virtual void visibilityToggled(bool)
Definition: VolumeRenderingWidget.cpp:103
virtual void addColor()
Color.
Definition: VolumeRenderingWidget.cpp:114
VolumeRenderingWidget(VolumeRenderingAction *myAction, QWidget *parent=nullptr)
Default construtor.
Definition: VolumeRenderingWidget.cpp:45
virtual void addTransparency()
Transparency.
Definition: VolumeRenderingWidget.cpp:169
virtual void specularLightSpinBoxChanged(double)
Definition: VolumeRenderingWidget.cpp:538
void setDefaultOpacities(QMap< int, double > defaultOpacities)
Definition: VolumeRenderingWidget.cpp:243