OpenWalnut  1.5.0dev
WMDirectVolumeRendering.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut 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 for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WMDIRECTVOLUMERENDERING_H
26 #define WMDIRECTVOLUMERENDERING_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include <osg/Node>
32 #include <osg/Uniform>
33 
34 #include "core/dataHandler/WDataSetScalar.h"
35 #include "core/dataHandler/WDataSetVector.h"
36 #include "core/graphicsEngine/shaders/WGEShader.h"
37 #include "core/kernel/WModule.h"
38 #include "core/kernel/WModuleInputData.h"
39 #include "core/kernel/WModuleOutputData.h"
40 
41 /**
42  * This module is a basic volume renderer.
43  *
44  * \ingroup modules
45  */
47 {
48 public:
49  /**
50  * Default constructor.
51  */
53 
54  /**
55  * Destructor.
56  */
57  virtual ~WMDirectVolumeRendering();
58 
59  /**
60  * Gives back the name of this module.
61  * \return the module's name.
62  */
63  virtual const std::string getName() const;
64 
65  /**
66  * Gives back a description of this module.
67  * \return description to module.
68  */
69  virtual const std::string getDescription() const;
70 
71  /**
72  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
73  * should never be initialized or modified in some other way. A simple new instance is required.
74  *
75  * \return the prototype used to create every module in OpenWalnut.
76  */
77  virtual std::shared_ptr< WModule > factory() const;
78 
79  /**
80  * Get the icon for this module in XPM format.
81  * \return the icon.
82  */
83  virtual const char** getXPMIcon() const;
84 
85 protected:
86  /**
87  * Entry point after loading the module. Runs in separate thread.
88  */
89  virtual void moduleMain();
90 
91  /**
92  * Initialize the connectors this module is using.
93  */
94  virtual void connectors();
95 
96  /**
97  * Initialize the properties for this module.
98  */
99  virtual void properties();
100 
101  /**
102  * Initialize requirements for this module.
103  */
104  virtual void requirements();
105 
106 private:
107  /**
108  * The transfer function as an input data set
109  */
110  std::shared_ptr< WModuleInputData< WDataSetSingle > > m_transferFunction;
111 
112  /**
113  * An input connector used to get datasets from other modules. The connection management between connectors must not be handled by the module.
114  */
115  std::shared_ptr< WModuleInputData< WDataSetScalar > > m_input;
116 
117  /**
118  * The gradient field input
119  */
120  std::shared_ptr< WModuleInputData< WDataSetVector > > m_gradients;
121 
122  /**
123  * The number of samples to walk along the ray.
124  */
125  WPropInt m_samples;
126 
127  /**
128  * Types of local illumination supported.
129  */
131  {
132  None = 0,
133  Phong
134  };
135 
136  /**
137  * The available shading algorithms.
138  */
139  std::shared_ptr< WItemSelection > m_localIlluminationSelections;
140 
141  /**
142  * The actually selected shading algorithm.
143  */
144  WPropSelection m_localIlluminationAlgo;
145 
146  /**
147  * All properties for those nice improvement methods.
148  */
149  WPropGroup m_improvementGroup;
150 
151  /**
152  * If true, stochastic jittering is used for image quality improvement.
153  */
155 
156  /**
157  * If active, the opacity of the classified fragment gets scaled according to sample count to ensure relative opacities even if sampling
158  * number changes (m_samples)
159  */
161 
162  /**
163  * If active, Maximum intensity projection is used based on the alpha value of the points
164  */
166 
167  /**
168  * If active, color coding is done by depth projection mode where the intensity is taken from the alpha channel and the color from the color channel ( last part not implemented, yet )
169  */
171 
172  /**
173  * A condition used to notify about changes in several properties.
174  */
175  std::shared_ptr< WCondition > m_propCondition;
176 
177  /**
178  * the DVR shader.
179  */
180  osg::ref_ptr< WGEShader > m_shader;
181 
182  /**
183  * the main geometry node
184  */
185  osg::ref_ptr< osg::Node > cube;
186 };
187 
188 #endif // WMDIRECTVOLUMERENDERING_H
189 
This module is a basic volume renderer.
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
WMDirectVolumeRendering()
Default constructor.
std::shared_ptr< WModuleInputData< WDataSetScalar > > m_input
An input connector used to get datasets from other modules.
WPropBool m_depthProjectionEnabled
If active, color coding is done by depth projection mode where the intensity is taken from the alpha ...
WPropBool m_maximumIntensityProjectionEnabled
If active, Maximum intensity projection is used based on the alpha value of the points.
WPropBool m_opacityCorrectionEnabled
If active, the opacity of the classified fragment gets scaled according to sample count to ensure rel...
virtual const std::string getDescription() const
Gives back a description of this module.
std::shared_ptr< WItemSelection > m_localIlluminationSelections
The available shading algorithms.
WPropGroup m_improvementGroup
All properties for those nice improvement methods.
WPropInt m_samples
The number of samples to walk along the ray.
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
virtual void moduleMain()
Entry point after loading the module.
virtual ~WMDirectVolumeRendering()
Destructor.
osg::ref_ptr< osg::Node > cube
the main geometry node
WPropSelection m_localIlluminationAlgo
The actually selected shading algorithm.
std::shared_ptr< WModuleInputData< WDataSetVector > > m_gradients
The gradient field input.
LOCALILLUMINATION_ALGORITHMS
Types of local illumination supported.
osg::ref_ptr< WGEShader > m_shader
the DVR shader.
virtual void connectors()
Initialize the connectors this module is using.
std::shared_ptr< WModuleInputData< WDataSetSingle > > m_transferFunction
The transfer function as an input data set.
virtual const std::string getName() const
Gives back the name of this module.
WPropBool m_stochasticJitterEnabled
If true, stochastic jittering is used for image quality improvement.
virtual void properties()
Initialize the properties for this module.
virtual void requirements()
Initialize requirements for this module.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72