OpenWalnut  1.5.0dev
WMImageSpaceTensorLIC.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 WMIMAGESPACETENSORLIC_H
26 #define WMIMAGESPACETENSORLIC_H
27 
28 #include <memory>
29 #include <string>
30 #include <vector>
31 
32 #include "core/dataHandler/WDataSetVector.h"
33 #include "core/graphicsEngine/WGEManagedGroupNode.h"
34 #include "core/graphicsEngine/WTriangleMesh.h"
35 #include "core/kernel/WModule.h"
36 #include "core/kernel/WModuleInputData.h"
37 
38 /**
39  * This module takes a second order symmetric tensor dataset and uses it to apply an image space based (fast) fabric-like LIC to an arbitrary
40  * surface. The surface can be specified as tri mesh or, if not specified, slices.
41  *
42  * \ingroup modules
43  */
45 {
46 public:
47  /**
48  * Default constructor.
49  */
51 
52  /**
53  * Destructor.
54  */
55  virtual ~WMImageSpaceTensorLIC();
56 
57  /**
58  * Gives back the name of this module.
59  * \return the module's name.
60  */
61  virtual const std::string getName() const;
62 
63  /**
64  * Gives back a description of this module.
65  * \return description to module.
66  */
67  virtual const std::string getDescription() const;
68 
69  /**
70  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
71  * should never be initialized or modified in some other way. A simple new instance is required.
72  *
73  * \return the prototype used to create every module in OpenWalnut.
74  */
75  virtual std::shared_ptr< WModule > factory() const;
76 
77 protected:
78  /**
79  * Entry point after loading the module. Runs in separate thread.
80  */
81  virtual void moduleMain();
82 
83  /**
84  * Initialize the connectors this module is using.
85  */
86  virtual void connectors();
87 
88  /**
89  * Initialize the properties for this module.
90  */
91  virtual void properties();
92 
93 private:
94  /**
95  * Initializes the needed geodes, transformations and vertex arrays. This needs to be done once for each new dataset.
96  *
97  * \param grid the grid to places the slices in
98  * \param mesh the mesh to use if not NULL and m_useSlices is false
99  */
100  void initOSG( std::shared_ptr< WGridRegular3D > grid, std::shared_ptr< WTriangleMesh > mesh );
101 
102  /**
103  * The input connector containing the DTI field whose derived field is used for LIC.
104  */
105  std::shared_ptr< WModuleInputData< WDataSetVector > > m_evec1In;
106 
107  /**
108  * The input connector containing the DTI field whose derived field is used for LIC.
109  */
110  std::shared_ptr< WModuleInputData< WDataSetVector > > m_evec2In;
111 
112  /**
113  * The input connector containing the DTI field whose derived field is used for LIC.
114  */
115  std::shared_ptr< WModuleInputData< WDataSetVector > > m_evalsIn;
116 
117  /**
118  * The input containing the surface on which the LIC should be applied on
119  */
120  std::shared_ptr< WModuleInputData< WTriangleMesh > > m_meshIn;
121 
122  /**
123  * A property allowing the user to select whether the slices or the mesh should be used
124  */
125  WPropSelection m_geometrySelection;
126 
127  /**
128  * A list of items that can be selected using m_geometrySelection.
129  */
130  std::shared_ptr< WItemSelection > m_geometrySelections;
131 
132  /**
133  * A condition used to notify about changes in several properties.
134  */
135  std::shared_ptr< WCondition > m_propCondition;
136 
137  /**
138  * The Geode containing all the slices and the mesh
139  */
140  osg::ref_ptr< WGEGroupNode > m_output;
141 
142  /**
143  * Scene root node.
144  */
145  osg::ref_ptr< WGEManagedGroupNode > m_root;
146 
147  WPropGroup m_sliceGroup; //!< the group contains several slice properties
148 
149  WPropGroup m_geometryGroup; //!< the group contains several input geometry parameters
150 
151  WPropGroup m_licGroup; //!< the group contains several LIC properties
152 
153  WPropBool m_useSlices; //!< indicates whether the vector should be shown on slices or input geometry
154 
155  WPropInt m_xPos; //!< x position of the slice
156 
157  WPropInt m_yPos; //!< y position of the slice
158 
159  WPropInt m_zPos; //!< z position of the slice
160 
161  WPropBool m_showonX; //!< indicates whether the vector should be shown on slice X
162 
163  WPropBool m_showonY; //!< indicates whether the vector should be shown on slice Y
164 
165  WPropBool m_showonZ; //!< indicates whether the vector should be shown on slice Z
166 
167  WPropBool m_showHUD; //!< indicates whether to show the texture HUD
168 
169  WPropBool m_useEdges; //!< indicates whether to show the edges
170 
171  WPropColor m_useEdgesColor; //!< indicated whether the edges (if enabled) should be black or white or green or red or ....
172 
173  WPropDouble m_useEdgesStep; //!< define the steepness of the step function used to blend in the edge color.
174 
175  WPropBool m_useLight; //!< indicates whether to use Phong
176 
177  WPropDouble m_lightIntensity; //!< light intensity
178 
179  WPropInt m_numIters; //!< the number of iterations done per frame
180 
181  WPropDouble m_cmapRatio; //!< the ratio between colormap and LIC
182 
183  WPropDouble m_projectionAngleThreshold; //!< the angle threshold between surface and vector before clipping the vector.
184 
185  /**
186  * The group for more advanced LIC features
187  */
188  WPropGroup m_advancedLicGroup;
189 
190  /**
191  * The resolution scaling for the noise
192  */
193  WPropDouble m_noiseRes;
194 
195  /**
196  * Clipp according to FA.
197  */
198  WPropDouble m_faClip;
199 };
200 
201 #endif // WMIMAGESPACETENSORLIC_H
202 
This module takes a second order symmetric tensor dataset and uses it to apply an image space based (...
WPropBool m_useLight
indicates whether to use Phong
virtual void connectors()
Initialize the connectors this module is using.
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
WPropDouble m_lightIntensity
light intensity
WPropDouble m_cmapRatio
the ratio between colormap and LIC
WPropGroup m_geometryGroup
the group contains several input geometry parameters
WMImageSpaceTensorLIC()
Default constructor.
WPropSelection m_geometrySelection
A property allowing the user to select whether the slices or the mesh should be used.
WPropDouble m_faClip
Clipp according to FA.
WPropInt m_yPos
y position of the slice
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...
WPropBool m_showonX
indicates whether the vector should be shown on slice X
virtual void moduleMain()
Entry point after loading the module.
WPropInt m_xPos
x position of the slice
std::shared_ptr< WModuleInputData< WDataSetVector > > m_evec2In
The input connector containing the DTI field whose derived field is used for LIC.
WPropBool m_showonZ
indicates whether the vector should be shown on slice Z
void initOSG(std::shared_ptr< WGridRegular3D > grid, std::shared_ptr< WTriangleMesh > mesh)
Initializes the needed geodes, transformations and vertex arrays.
WPropDouble m_useEdgesStep
define the steepness of the step function used to blend in the edge color.
std::shared_ptr< WItemSelection > m_geometrySelections
A list of items that can be selected using m_geometrySelection.
WPropGroup m_advancedLicGroup
The group for more advanced LIC features.
virtual ~WMImageSpaceTensorLIC()
Destructor.
WPropDouble m_noiseRes
The resolution scaling for the noise.
std::shared_ptr< WModuleInputData< WDataSetVector > > m_evalsIn
The input connector containing the DTI field whose derived field is used for LIC.
virtual const std::string getDescription() const
Gives back a description of this module.
osg::ref_ptr< WGEGroupNode > m_output
The Geode containing all the slices and the mesh.
osg::ref_ptr< WGEManagedGroupNode > m_root
Scene root node.
std::shared_ptr< WModuleInputData< WDataSetVector > > m_evec1In
The input connector containing the DTI field whose derived field is used for LIC.
WPropInt m_numIters
the number of iterations done per frame
WPropBool m_useSlices
indicates whether the vector should be shown on slices or input geometry
WPropBool m_showonY
indicates whether the vector should be shown on slice Y
WPropBool m_useEdges
indicates whether to show the edges
WPropColor m_useEdgesColor
indicated whether the edges (if enabled) should be black or white or green or red or ....
virtual const std::string getName() const
Gives back the name of this module.
std::shared_ptr< WModuleInputData< WTriangleMesh > > m_meshIn
The input containing the surface on which the LIC should be applied on.
WPropGroup m_sliceGroup
the group contains several slice properties
WPropDouble m_projectionAngleThreshold
the angle threshold between surface and vector before clipping the vector.
WPropBool m_showHUD
indicates whether to show the texture HUD
WPropInt m_zPos
z position of the slice
WPropGroup m_licGroup
the group contains several LIC properties
virtual void properties()
Initialize the properties for this module.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72