OpenWalnut  1.5.0dev
WMPickingDVREvaluation.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2017 OpenWalnut Community
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 WMPICKINGDVREVALUATION_H
26 #define WMPICKINGDVREVALUATION_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include <osg/Geode>
32 
33 #include "core/kernel/WModule.h"
34 #include "core/kernel/WModuleInputData.h"
35 
36 // forward declarations to reduce compile dependencies
37 class WDataSetScalar;
38 
39 /**
40  * Someone should add some documentation here.
41  * Probably the best person would be the module's
42  * creator, i.e. "wiebel".
43  *
44  * This is only an empty template for a new module. For
45  * an example module containing many interesting concepts
46  * and extensive documentation have a look at "src/modules/template"
47  *
48  * \ingroup modules
49  */
51 {
52 public:
53  /**
54  * A simple constructor
55  */
57 
58  /**
59  * A simple destructor
60  */
61  virtual ~WMPickingDVREvaluation();
62 
63  /**
64  * Gives back the name of this module.
65  * \return the module's name.
66  */
67  virtual const std::string getName() const;
68 
69  /**
70  * Gives back a description of this module.
71  * \return description to module.
72  */
73  virtual const std::string getDescription() const;
74 
75  /**
76  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
77  * should never be initialized or modified in some other way. A simple new instance is required.
78  *
79  * \return the prototype used to create every module in OpenWalnut.
80  */
81  virtual std::shared_ptr< WModule > factory() const;
82 
83 protected:
84  /**
85  * Entry point after loading the module. Runs in separate thread.
86  */
87  virtual void moduleMain();
88 
89  /**
90  * Initialize the connectors this module is using.
91  */
92  virtual void connectors();
93 
94  /**
95  * Initialize the properties for this module.
96  */
97  virtual void properties();
98 
99  /**
100  * Initialize requirements for this module.
101  */
102  virtual void requirements();
103 
104 
105 private:
106  /**
107  * Needed for recreating the geometry, incase when resolution changes.
108  */
109  std::shared_ptr< WCondition > m_propCondition;
110 
111  /**
112  * The viewing and thus projection direction.
113  */
114  WPropPosition m_viewDirection;
115 
116  /**
117  * Number of samples along the ray
118  */
119  WPropInt m_sampleSteps;
120 
121  /**
122  * Number of samples for evaluating Delta_vi
123  */
124  WPropInt m_samplesEval;
125 
126  /**
127  * Current picking method
128  */
129  WPropSelection m_pickingCriteriaCur;
130 
131  /**
132  * Possible criteria
133  */
134  std::shared_ptr< WItemSelection > m_pickingCriteriaList;
135 
136  /**
137  * Current importance function
138  */
139  WPropSelection m_importanceFunctionCur;
140 
141  /**
142  * Possible importance functions
143  */
144  std::shared_ptr< WItemSelection > m_impFuncList;
145 
146  /**
147  * Input connector for scalar data.
148  */
149  std::shared_ptr< WModuleInputData< WDataSetScalar > > m_scalarData;
150 
151  /**
152  * The transfer function as an input data set
153  */
154  std::shared_ptr< WModuleInputData< WDataSetSingle > > m_transferFunction;
155 
156  WBoundingBox m_bbox; //!< Bounding box of the treated data set.
157  std::shared_ptr< WDataSetScalar > m_scalarDataSet; //!< Input data as WDataSetScalar.
158  std::shared_ptr< WDataSetSingle > m_transferFunctionData; //!< Transfer function as WDataSetSingle.
159 
160  /**
161  * Get position where a given ray intersects a given axis-aligned bounding box.
162  * \param bbox The given bounding box
163  * \param origin Starting point of the ray
164  * \param dir Direction of the ray
165  *
166  * \result Intersection position. (0,0,0) if no intersection.
167  */
168  WPosition intersectBoundingBoxWithRay( const WBoundingBox& bbox, const WPosition& origin, const WVector3d& dir );
169 
170  /**
171  * Importance function
172  * \param pos Location in space.
173  *
174  * \return Importance at \p pos
175  */
176  double importance( WPosition pos );
177 
178  /**
179  * interaction Map of directness model. Here: DVR.
180  * \param startPos Location in space where interaction takes place.
181  * \param viewDir Viewing direction, i.e. direction interaction.
182  *
183  * \return Result of mapping \p startPos
184  */
185  WPosition interactionMapping( const WPosition& startPos, const WVector3d& viewDir );
186 
187  /**
188  * viusalization mapping of directness model. Here: Picking.
189  * \param pos Location of data point in space.
190  * \param viewDir Viewing direction, i.e. direction of projection.
191  *
192  * \return Result of mapping \p pos
193  */
194  WPosition visualizationMapping( const WPosition& pos, const WVector3d& viewDir );
195 };
196 
197 #endif // WMPICKINGDVREVALUATION_H
This data set type contains scalars as values.
Someone should add some documentation here.
std::shared_ptr< WModuleInputData< WDataSetSingle > > m_transferFunction
The transfer function as an input data set.
virtual void moduleMain()
Entry point after loading the module.
std::shared_ptr< WItemSelection > m_pickingCriteriaList
Possible criteria.
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...
std::shared_ptr< WDataSetScalar > m_scalarDataSet
Input data as WDataSetScalar.
virtual void requirements()
Initialize requirements for this module.
std::shared_ptr< WModuleInputData< WDataSetScalar > > m_scalarData
Input connector for scalar data.
virtual void connectors()
Initialize the connectors this module is using.
virtual const std::string getName() const
Gives back the name of this module.
WPropInt m_sampleSteps
Number of samples along the ray.
WMPickingDVREvaluation()
A simple constructor.
WPosition visualizationMapping(const WPosition &pos, const WVector3d &viewDir)
viusalization mapping of directness model.
WPosition interactionMapping(const WPosition &startPos, const WVector3d &viewDir)
interaction Map of directness model.
WPosition intersectBoundingBoxWithRay(const WBoundingBox &bbox, const WPosition &origin, const WVector3d &dir)
Get position where a given ray intersects a given axis-aligned bounding box.
WPropSelection m_importanceFunctionCur
Current importance function.
virtual void properties()
Initialize the properties for this module.
WPropInt m_samplesEval
Number of samples for evaluating Delta_vi.
std::shared_ptr< WDataSetSingle > m_transferFunctionData
Transfer function as WDataSetSingle.
virtual ~WMPickingDVREvaluation()
A simple destructor.
virtual const std::string getDescription() const
Gives back a description of this module.
double importance(WPosition pos)
Importance function.
WPropPosition m_viewDirection
The viewing and thus projection direction.
WPropSelection m_pickingCriteriaCur
Current picking method.
WBoundingBox m_bbox
Bounding box of the treated data set.
std::shared_ptr< WItemSelection > m_impFuncList
Possible importance functions.
std::shared_ptr< WCondition > m_propCondition
Needed for recreating the geometry, incase when resolution changes.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72
This only is a 3d double vector.