Computer Assited Medical Intervention Tool Kit  version 4.1
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-2018 Univ. Grenoble Alpes, 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 VOLUMERENDERINGWIDGET_H
28 #define VOLUMERENDERINGWIDGET_H
29 // - CamiTK stuff
30 #include <ImageComponent.h>
31 
32 // - Qt stuff
33 #include <QWidget>
34 #include <QString>
35 
36 // - Local Stuff
37 #include "ColorPointWidget.h"
38 #include "GradientOpacityWidget.h"
40 
41 #include "ui_VolumeRenderingWidget.h"
42 
44 
55 class VolumeRenderingWidget : public QWidget {
56  Q_OBJECT
57 
58 public:
60  VolumeRenderingWidget(VolumeRenderingAction* dad, QWidget* parent = nullptr);
61 
63 
64  // ----------- Destructor
65  ~VolumeRenderingWidget() override;
66 
67  // ----------- Transparency
69 
70  void setDefaultTransparencies(QMap<int, double> defaultTransparencies);
71 
72  void addTransparency(int grayLevel, double transparency);
73 
74  QMap<int, double> getTransparencyPoints();
75 
76  // ----------- Colors
78 
79  void setDefaultColors(QMap<int, QColor> defaultColors);
80 
81  void addColor(int grayLevel, QColor color);
82 
83  QMap<int, QColor> getColorPoints();
84 
85  // ----------- Gradient Opacity
87 
88  void setDefaultOpacities(QMap<int, double> defaultOpacities);
89 
90  void addGradientOpacity(int grayLevel, double opacity);
91 
92  QMap<int, double> getOpacityPoints();
93 
94  // ----------- Lights
95  void setAmbiant(double ambiant);
96  double getAmbiant();
97 
98  void setDiffuse(double diffuse);
99  double getDiffuse();
100 
101  void setSpecular(double specular);
102  double getSpecular();
103 
104  void load(QString filename);
105 
106 
107 
108 public slots:
110  virtual void load();
111  virtual void save();
113  virtual void refreshVolumeRendering();
115  virtual void addTransparency();
117  virtual void addColor();
119  virtual void addGradientOpacity();
121  virtual void ambiantLightSliderChanged(int);
122  virtual void ambiantLightSpinBoxChanged(double);
124  virtual void diffuseLightSliderChanged(int);
125  virtual void diffuseLightSpinBoxChanged(double);
127  virtual void specularLightSliderChanged(int);
128  virtual void specularLightSpinBoxChanged(double);
129 
130 private:
131  Ui_VolumeRenderingWidget ui;
132  QList<ColorPointWidget*> colorPoints;
133  QList<GradientOpacityWidget*> gradientOpacities;
134  QList<TransparencyPointWidget*> transparencies;
137 
138 };
139 
140 #endif
Ui_VolumeRenderingWidget ui
Definition: VolumeRenderingWidget.h:131
virtual void diffuseLightSpinBoxChanged(double)
Definition: VolumeRenderingWidget.cpp:500
This widget handle specifically the gradient opacity in the output image.
Definition: GradientOpacityWidget.h:44
double getAmbiant()
Definition: VolumeRenderingWidget.cpp:260
virtual void addColor()
Color.
Definition: VolumeRenderingWidget.cpp:92
This widget handle specifically the transparency in the output image.
Definition: TransparencyPointWidget.h:49
virtual void addTransparency()
Transparency.
Definition: VolumeRenderingWidget.cpp:146
void setDefaultOpacities(QMap< int, double > defaultOpacities)
Definition: VolumeRenderingWidget.cpp:220
void removeOpacityPoint(GradientOpacityWidget *point)
Definition: VolumeRenderingWidget.cpp:213
QMap< int, double > getOpacityPoints()
Definition: VolumeRenderingWidget.cpp:240
virtual void ambiantLightSpinBoxChanged(double)
Definition: VolumeRenderingWidget.cpp:486
QMap< int, double > getTransparencyPoints()
Definition: VolumeRenderingWidget.cpp:186
void removeTransparencyPoint(TransparencyPointWidget *point)
Definition: VolumeRenderingWidget.cpp:159
This widget handle specifically the color of each voxel (R, G, B) in the output rendered image...
Definition: ColorPointWidget.h:44
QList< ColorPointWidget * > colorPoints
Definition: VolumeRenderingWidget.h:132
virtual void specularLightSliderChanged(int)
Specular Light Value Editing.
Definition: VolumeRenderingWidget.cpp:508
void removeColorPoint(ColorPointWidget *point)
Definition: VolumeRenderingWidget.cpp:105
virtual void specularLightSpinBoxChanged(double)
Definition: VolumeRenderingWidget.cpp:514
virtual void ambiantLightSliderChanged(int)
Ambiant Light Value Editing.
Definition: VolumeRenderingWidget.cpp:480
virtual void addGradientOpacity()
Gradient Opacity.
Definition: VolumeRenderingWidget.cpp:200
void setAmbiant(double ambiant)
Definition: VolumeRenderingWidget.cpp:255
The manager of the Image Volume data.
Definition: ImageComponent.h:73
This action perform a volume rendering.
Definition: VolumeRenderingAction.h:44
camitk::ImageComponent * myImage
Definition: VolumeRenderingWidget.h:135
void setDiffuse(double diffuse)
Definition: VolumeRenderingWidget.cpp:265
virtual void refreshVolumeRendering()
When to change volume rendering.
Definition: VolumeRenderingWidget.cpp:471
The widget allows the user to select the desired parameter for the transfer function.
Definition: VolumeRenderingWidget.h:55
VolumeRenderingWidget(VolumeRenderingAction *dad, QWidget *parent=nullptr)
Default construtor.
Definition: VolumeRenderingWidget.cpp:45
~VolumeRenderingWidget() override
Definition: VolumeRenderingWidget.cpp:52
void setSpecular(double specular)
Definition: VolumeRenderingWidget.cpp:275
QList< GradientOpacityWidget * > gradientOpacities
Definition: VolumeRenderingWidget.h:133
double getSpecular()
Definition: VolumeRenderingWidget.cpp:280
double getDiffuse()
Definition: VolumeRenderingWidget.cpp:270
virtual void save()
Definition: VolumeRenderingWidget.cpp:380
void updateImage(camitk::ImageComponent *comp)
Definition: VolumeRenderingWidget.cpp:81
void setDefaultColors(QMap< int, QColor > defaultColors)
Definition: VolumeRenderingWidget.cpp:112
QList< TransparencyPointWidget * > transparencies
Definition: VolumeRenderingWidget.h:134
virtual void load()
Load / Save mpas.
Definition: VolumeRenderingWidget.cpp:374
virtual void diffuseLightSliderChanged(int)
Diffuse Light Value Editing.
Definition: VolumeRenderingWidget.cpp:494
VolumeRenderingAction * dad
Definition: VolumeRenderingWidget.h:136
void setDefaultTransparencies(QMap< int, double > defaultTransparencies)
Definition: VolumeRenderingWidget.cpp:166
QMap< int, QColor > getColorPoints()
Definition: VolumeRenderingWidget.cpp:132