OpenWalnut  1.5.0dev
WMProjectionsAsContext.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2013 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 WMPROJECTIONSASCONTEXT_H
26 #define WMPROJECTIONSASCONTEXT_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include <osg/Geode>
32 
33 #include "core/common/WItemSelection.h"
34 #include "core/common/WItemSelectionItem.h"
35 #include "core/common/WItemSelectionItemTyped.h"
36 #include "core/common/WItemSelector.h"
37 #include "core/common/WPropertyHelper.h"
38 #include "core/kernel/WModule.h"
39 #include "core/kernel/WModuleInputData.h"
40 #include "core/kernel/WModuleOutputData.h"
41 
42 enum PlaneType
43 {
44  NONE, MIP, COMPOSITING_F2B, COMPOSITING_B2F
45 };
46 
47 // forward declarations to reduce compile dependencies
48 template< class T > class WModuleInputData;
49 class WDataSetScalar;
51 class WGEShader;
52 
53 /**
54  * Computes contour lines (aka isolines) for the given data and render them on a 2D plane.
55  * \ingroup modules
56  */
58 {
59 public:
60  /**
61  * Creates the module for drawing contour lines.
62  */
64 
65  /**
66  * Destroys this module.
67  */
68  virtual ~WMProjectionsAsContext();
69 
70  /**
71  * Gives back the name of this module.
72  * \return the module's name.
73  */
74  virtual const std::string getName() const;
75 
76  /**
77  * Gives back a description of this module.
78  * \return description to module.
79  */
80  virtual const std::string getDescription() const;
81 
82  /**
83  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
84  * should never be initialized or modified in some other way. A simple new instance is required.
85  *
86  * \return the prototype used to create every module in OpenWalnut.
87  */
88  virtual std::shared_ptr< WModule > factory() const;
89 
90 protected:
91  /**
92  * Entry point after loading the module. Runs in separate thread.
93  */
94  virtual void moduleMain();
95 
96  /**
97  * Initialize the connectors this module is using.
98  */
99  virtual void connectors();
100 
101  /**
102  * Initialize the properties for this module.
103  */
104  virtual void properties();
105 
106  /**
107  * Initialize requirements for this module.
108  */
109  virtual void requirements();
110 
111  /**
112  * Geode holding the planes
113  */
114  osg::ref_ptr< osg::Geode > m_geode;
115 
116 private:
117  /**
118  * Input connector for scalar data.
119  */
120  std::shared_ptr< WModuleInputData< WDataSetScalar > > m_scalarIC;
121 
122  /**
123  * The transfer function as an input data set
124  */
125  std::shared_ptr< WModuleInputData< WDataSetSingle > > m_transferFunction;
126 
127  /**
128  * The OSG root node for this module. All other geodes or OSG nodes will be attached on this single node.
129  */
130  osg::ref_ptr< WGEManagedGroupNode > m_rootNode;
131 
132  /**
133  * Needed for recreating the geometry, incase when resolution changes.
134  */
135  std::shared_ptr< WCondition > m_propCondition;
136 
137  /**
138  * Typedef for plane orientation selection
139  */
141 
142  /**
143  * Plane orientation type selection.
144  */
145  std::shared_ptr< WItemSelection > m_possibleSelectionsUsingTypes;
146 
147  /**
148  * Plane orientation type.
149  */
151 
152  /**
153  * Plane orientation type.
154  */
156 
157  /**
158  * Plane orientation type.
159  */
161 
162  /**
163  * Plane orientation type.
164  */
166 
167  /**
168  * Plane orientation type.
169  */
171 
172  /**
173  * Plane orientation type.
174  */
176 
177  /**
178  * Threshold for early ray termination of DVR
179  */
181 
182  /**
183  * Info property.
184  */
185  WPropPosition m_maxCoordsPosition;
186 
187  /**
188  * Info property.
189  */
190  WPropPosition m_normalOut;
191 
192  /**
193  * Info property.
194  */
195  WPropInt m_planeTypes[6];
196 
197  /**
198  * Reference to shader object.
199  */
200  osg::ref_ptr< WGEShader > m_shader;
201 
202  /**
203  * The treated data set.
204  */
205  std::shared_ptr< WDataSetScalar > scalarData;
206 };
207 
208 #endif // WMPROJECTIONSASCONTEXT_H
This data set type contains scalars as values.
This class adds some convenience methods to WGEGroupNode.
Class encapsulating the OSG Program class for a more convenient way of adding and modifying shader.
Definition: WGEShader.h:48
A derivation of WItemSelection which can store a value of any type.
Computes contour lines (aka isolines) for the given data and render them on a 2D plane.
WPropSelection m_singleSelectionCoronalTop
Plane orientation type.
osg::ref_ptr< osg::Geode > m_geode
Geode holding the planes.
WPropSelection m_singleSelectionSagittalTop
Plane orientation type.
virtual ~WMProjectionsAsContext()
Destroys this module.
virtual void requirements()
Initialize requirements for this module.
std::shared_ptr< WCondition > m_propCondition
Needed for recreating the geometry, incase when resolution changes.
WPropSelection m_singleSelectionAxialTop
Plane orientation type.
WPropSelection m_singleSelectionAxialBottom
Plane orientation type.
WMProjectionsAsContext()
Creates the module for drawing contour lines.
WPropSelection m_singleSelectionSagittalBottom
Plane orientation type.
std::shared_ptr< WDataSetScalar > scalarData
The treated data set.
WItemSelectionItemTyped< PlaneType > MyItemType
Typedef for plane orientation selection.
std::shared_ptr< WItemSelection > m_possibleSelectionsUsingTypes
Plane orientation type selection.
virtual void moduleMain()
Entry point after loading the module.
WPropPosition m_normalOut
Info property.
osg::ref_ptr< WGEShader > m_shader
Reference to shader object.
virtual const std::string getDescription() const
Gives back a description of this module.
osg::ref_ptr< WGEManagedGroupNode > m_rootNode
The OSG root node for this module.
WPropSelection m_singleSelectionCoronalBottom
Plane orientation type.
std::shared_ptr< WModuleInputData< WDataSetSingle > > m_transferFunction
The transfer function as an input data set.
virtual void properties()
Initialize the properties for this module.
virtual void connectors()
Initialize the connectors this module is using.
std::shared_ptr< WModuleInputData< WDataSetScalar > > m_scalarIC
Input connector for scalar data.
WPropPosition m_maxCoordsPosition
Info property.
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...
WPropDouble m_earlyRayTerminationAlpha
Threshold for early ray termination of DVR.
virtual const std::string getName() const
Gives back the name of this module.
WPropInt m_planeTypes[6]
Info property.
Class offering an instantiate-able data connection between modules.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72