OpenWalnut  1.5.0dev
WMNavigationSlices.cpp
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009-2020 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 #include <algorithm>
26 #include <memory>
27 #include <string>
28 
29 #include <osg/LineWidth>
30 #include <osg/MatrixTransform>
31 #include <osg/Vec3>
32 
33 #include "WMNavigationSlices.h"
34 #include "WMNavigationSlices.xpm"
35 #include "core/common/WPropertyHelper.h"
36 #include "core/common/math/WMath.h"
37 #include "core/graphicsEngine/WGEColormapping.h"
38 #include "core/graphicsEngine/WGEGeodeUtils.h"
39 #include "core/graphicsEngine/WGEUtils.h"
40 #include "core/graphicsEngine/WGraphicsEngine.h"
41 #include "core/graphicsEngine/WPickHandler.h"
42 #include "core/graphicsEngine/callbacks/WGELinearTranslationCallback.h"
43 #include "core/graphicsEngine/callbacks/WGENodeMaskCallback.h"
44 #include "core/graphicsEngine/callbacks/WGEPropertyUniformCallback.h"
45 #include "core/graphicsEngine/callbacks/WGEShaderAnimationCallback.h"
46 #include "core/graphicsEngine/shaders/WGEPropertyUniform.h"
47 #include "core/graphicsEngine/shaders/WGEShader.h"
48 #include "core/graphicsEngine/shaders/WGEShaderDefineOptions.h"
49 #include "core/graphicsEngine/shaders/WGEShaderPropertyDefineOptions.h"
50 #include "core/kernel/WKernel.h"
51 #include "core/kernel/WSelectionManager.h"
52 
53 // This line is needed by the module loader to actually find your module. You need to add this to your module too. Do NOT add a ";" here.
54 W_LOADABLE_MODULE( WMNavigationSlices )
55 
57  WModule()
58 {
59 }
60 
62 {
63  // Cleanup!
64 }
65 
66 std::shared_ptr< WModule > WMNavigationSlices::factory() const
67 {
68  return std::shared_ptr< WModule >( new WMNavigationSlices() );
69 }
70 
71 const char** WMNavigationSlices::getXPMIcon() const
72 {
73  return WMNavigationSlices_xpm;
74 }
75 
76 const std::string WMNavigationSlices::getName() const
77 {
78  return "Navigation Slices";
79 }
80 
81 const std::string WMNavigationSlices::getDescription() const
82 {
83  return "This module provides slices, orthogonally oriented in the OpenWalnut coordinate system. They allow the fast and easy exploration of "
84  "three-dimensional datasets.";
85 }
86 
88 {
89  // call WModule's initialization
91 }
92 
94 {
95  m_noTransparency = m_properties->addProperty( "No transparency", "If checked, transparency is not used. This will show the complete slices.",
96  false );
97 
98  m_sliceGroup = m_properties->addPropertyGroup( "Slices", "Slice Options." );
99 
100  // enable slices
101  // Flags denoting whether the glyphs should be shown on the specific slice
102  m_showonX = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropSagittalShow() );
103  m_showonY = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropCoronalShow() );
104  m_showonZ = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropAxialShow() );
105 
106  // The slice positions.
107  m_xPos = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropSagittalPos() );
108  m_yPos = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropCoronalPos() );
109  m_zPos = m_sliceGroup->addProperty( WKernel::getRunningKernel()->getSelectionManager()->getPropAxialPos() );
110 
111  // call WModule's initialization
113 }
114 
116 {
117  // remove the old slices
118  m_output->clear();
119  m_axialOutput->clear();
120  m_sagittalOutput->clear();
121  m_coronalOutput->clear();
122 
123  ///////////////////////////////////////////////////////////////////////////////////////////////
124  // Property Setup
125  ///////////////////////////////////////////////////////////////////////////////////////////////
126 
127  // no colormaps -> no slices
128  bool empty = !WGEColormapping::instance()->size();
129  if( empty )
130  {
131  // hide the slider properties.
132  m_xPos->setHidden();
133  m_yPos->setHidden();
134  m_zPos->setHidden();
135  return;
136  }
137 
138  // grab the current bounding box
139  WBoundingBox bb = WGEColormapping::instance()->getBoundingBox();
140  WVector3d minV = bb.getMin();
141  WVector3d maxV = bb.getMax();
142  WVector3d sizes = ( maxV - minV );
143  WVector3d midBB = minV + ( sizes * 0.5 );
144 
145  // update the properties
146  m_xPos->setMin( minV[0] );
147  m_xPos->setMax( maxV[0] );
148  m_yPos->setMin( minV[1] );
149  m_yPos->setMax( maxV[1] );
150  m_zPos->setMin( minV[2] );
151  m_zPos->setMax( maxV[2] );
152  // un-hide the slider properties.
153  m_xPos->setHidden( false );
154  m_yPos->setHidden( false );
155  m_zPos->setHidden( false );
156 
157  // always update slice positions if they happen to be outside the bounding box (i.e. after shrinking the box)
158  m_xPos->setRecommendedValue( midBB[0] );
159  m_yPos->setRecommendedValue( midBB[1] );
160  m_zPos->setRecommendedValue( midBB[2] );
161 
162  ///////////////////////////////////////////////////////////////////////////////////////////////
163  // Navigation View Setup
164  ///////////////////////////////////////////////////////////////////////////////////////////////
165 
166  double maxSizeInv = 1.0 / std::max( sizes[0], std::max( sizes[1], sizes[2] ) );
167  m_axialOutput->setMatrix(
168  osg::Matrixd::translate( -midBB[0], -midBB[1], -midBB[2] ) *
169  osg::Matrixd::scale( maxSizeInv, maxSizeInv, maxSizeInv ) *
170  osg::Matrixd::translate( 0.0, 0.0, -0.5 )
171  );
172 
173  m_coronalOutput->setMatrix(
174  osg::Matrixd::translate( -midBB[0], -midBB[1], -midBB[2] ) *
175  osg::Matrixd::scale( maxSizeInv, maxSizeInv, maxSizeInv ) *
176  osg::Matrixd::rotate( -0.5 * pi(), 1.0, 0.0 , 0.0 ) *
177  osg::Matrixd::translate( 0.0, 0.0, -0.5 )
178  );
179 
180  m_sagittalOutput->setMatrix(
181  osg::Matrixd::translate( -midBB[0], -midBB[1], -midBB[2] ) *
182  osg::Matrixd::scale( maxSizeInv, maxSizeInv, maxSizeInv ) *
183  osg::Matrixd::rotate( -0.5 * pi(), 1.0, 0.0 , 0.0 ) *
184  osg::Matrixd::rotate( 0.5 * pi(), 0.0, 1.0 , 0.0 ) *
185  osg::Matrixd::translate( 0.0, 0.0, -0.5 )
186  );
187 
188  ///////////////////////////////////////////////////////////////////////////////////////////////
189  // Slice Setup
190  ///////////////////////////////////////////////////////////////////////////////////////////////
191 
192  // create a new geode containing the slices
193 
194  // X Slice
195  osg::ref_ptr< osg::Node > xSlice = wge::genFinitePlane( minV, osg::Vec3( 0.0, sizes[1], 0.0 ),
196  osg::Vec3( 0.0, 0.0, sizes[2] ) );
197  xSlice->setName( "Sagittal Slice" );
198  osg::Uniform* xSliceUniform = new osg::Uniform( "u_WorldTransform", osg::Matrixf::identity() );
199  xSlice->getOrCreateStateSet()->addUniform( xSliceUniform );
200 
201  // Y Slice
202  osg::ref_ptr< osg::Node > ySlice = wge::genFinitePlane( minV, osg::Vec3( sizes[0], 0.0, 0.0 ),
203  osg::Vec3( 0.0, 0.0, sizes[2] ) );
204  ySlice->setName( "Coronal Slice" );
205  osg::Uniform* ySliceUniform = new osg::Uniform( "u_WorldTransform", osg::Matrixf::identity() );
206  ySlice->getOrCreateStateSet()->addUniform( ySliceUniform );
207 
208  // Z Slice
209  osg::ref_ptr< osg::Node > zSlice = wge::genFinitePlane( minV, osg::Vec3( sizes[0], 0.0, 0.0 ),
210  osg::Vec3( 0.0, sizes[1], 0.0 ) );
211  zSlice->setName( "Axial Slice" );
212  osg::Uniform* zSliceUniform = new osg::Uniform( "u_WorldTransform", osg::Matrixf::identity() );
213  zSlice->getOrCreateStateSet()->addUniform( zSliceUniform );
214 
215  // disable culling.
216  // NOTE: Somehow, this is ignore by OSG. If you know why: tell Sebastian Eichelbaum please
217  xSlice->setCullingActive( false );
218  ySlice->setCullingActive( false );
219  zSlice->setCullingActive( false );
220 
221  // Each slice is child of an transformation node
222  // These nodes are for the main view
223  // Seperate nodes are important to allow hiding of slices in the main view while keeping those in nav views
224  osg::ref_ptr< osg::MatrixTransform > matMainViewX = new osg::MatrixTransform();
225  matMainViewX->addChild( xSlice );
226  osg::ref_ptr< osg::MatrixTransform > matMainViewY = new osg::MatrixTransform();
227  matMainViewY->addChild( ySlice );
228  osg::ref_ptr< osg::MatrixTransform > matMainViewZ = new osg::MatrixTransform();
229  matMainViewZ->addChild( zSlice );
230 
231  // Each slice is child of an transformation node
232  // These nodes are for the navigation views
233  // Seperate nodes are important to allow hiding of slice in the main view while keeping those in nav views
234  osg::ref_ptr< osg::MatrixTransform > matNavViewX = new osg::MatrixTransform();
235  matNavViewX->addChild( xSlice );
236  osg::ref_ptr< osg::MatrixTransform > matNavViewY = new osg::MatrixTransform();
237  matNavViewY->addChild( ySlice );
238  osg::ref_ptr< osg::MatrixTransform > matNavViewZ = new osg::MatrixTransform();
239  matNavViewZ->addChild( zSlice );
240 
241  ///////////////////////////////////////////////////////////////////////////////////////////////
242  // Callback Setup
243  ///////////////////////////////////////////////////////////////////////////////////////////////
244 
245  // Control transformation node by properties. We use an additional uniform here to provide the shader the transformation matrix used to
246  // translate the slice.
247  matMainViewX->addUpdateCallback( new WGELinearTranslationCallback< WPropDouble >( osg::Vec3( 1.0, 0.0, 0.0 ), m_xPos, xSliceUniform ) );
248  matMainViewY->addUpdateCallback( new WGELinearTranslationCallback< WPropDouble >( osg::Vec3( 0.0, 1.0, 0.0 ), m_yPos, ySliceUniform ) );
249  matMainViewZ->addUpdateCallback( new WGELinearTranslationCallback< WPropDouble >( osg::Vec3( 0.0, 0.0, 1.0 ), m_zPos, zSliceUniform ) );
250  matNavViewX->addUpdateCallback( new WGELinearTranslationCallback< WPropDouble >( osg::Vec3( 1.0, 0.0, 0.0 ), m_xPos, xSliceUniform ) );
251  matNavViewY->addUpdateCallback( new WGELinearTranslationCallback< WPropDouble >( osg::Vec3( 0.0, 1.0, 0.0 ), m_yPos, ySliceUniform ) );
252  matNavViewZ->addUpdateCallback( new WGELinearTranslationCallback< WPropDouble >( osg::Vec3( 0.0, 0.0, 1.0 ), m_zPos, zSliceUniform ) );
253 
254  // set callbacks for en-/disabling the nodes
255  matMainViewX->addUpdateCallback( new WGENodeMaskCallback( m_showonX ) );
256  matMainViewY->addUpdateCallback( new WGENodeMaskCallback( m_showonY ) );
257  matMainViewZ->addUpdateCallback( new WGENodeMaskCallback( m_showonZ ) );
258 
259  // set the pick callbacks for each slice
261  m_ySlicePicker = PickCallback::SPtr( new PickCallback( ySlice, m_yPos, true ) );
263 
264  // transparency property
265  osg::ref_ptr< osg::Uniform > transparencyUniform = new osg::Uniform( "u_noTransparency", false );
266  transparencyUniform->setUpdateCallback( new WGEPropertyUniformCallback< WPropBool >( m_noTransparency ) );
267 
268  ///////////////////////////////////////////////////////////////////////////////////////////////
269  // Done
270  ///////////////////////////////////////////////////////////////////////////////////////////////
271 
272  osg::ref_ptr< osg::StateSet > state = m_output->getOrCreateStateSet();
273  state->setRenderingHint( osg::StateSet::TRANSPARENT_BIN );
274 
275  // we want some nice animations: add timer
276  osg::ref_ptr< osg::Uniform > animationUniform = new osg::Uniform( "u_timer", 0 );
277  state->addUniform( animationUniform );
278  animationUniform->setUpdateCallback( new WGEShaderAnimationCallback() );
279 
280  // transparency property
281  state->addUniform( transparencyUniform );
282  m_axialOutput->getOrCreateStateSet()->addUniform( transparencyUniform );
283  m_sagittalOutput->getOrCreateStateSet()->addUniform( transparencyUniform );
284  m_coronalOutput->getOrCreateStateSet()->addUniform( transparencyUniform );
285 
286  // add the transformation nodes to the output group
287  m_output->insert( matMainViewX );
288  m_output->insert( matMainViewY );
289  m_output->insert( matMainViewZ );
290 
291  // add proxy
292  m_output->insert( wge::generateCullProxy( bb ) );
293 
294  m_output->dirtyBound();
295 
296  m_axialOutput->insert( matNavViewZ );
297  m_sagittalOutput->insert( matNavViewX );
298  m_coronalOutput->insert( matNavViewY );
299 }
300 
301 WMNavigationSlices::PickCallback::PickCallback( osg::ref_ptr< osg::Node > node, WPropDouble property, bool negateDirection ):
302  m_node( node ),
303  m_property( property ),
304  m_pickUniform( new osg::Uniform( "u_picked", 0.0f ) ),
305  m_dir( negateDirection ? -1.0 : 1.0 )
306 {
307  std::shared_ptr< WGraphicsEngine > ge = WGraphicsEngine::getGraphicsEngine();
308  std::shared_ptr< WGEViewer > viewer = ge->getViewerByName( "Main View" );
309  m_camera = viewer->getCamera();
310  m_pickConnection = viewer->getPickHandler()->getPickSignal()->connect( boost::bind( &WMNavigationSlices::PickCallback::pick,
311  this,
312  boost::placeholders::_1 ) );
313  node->getOrCreateStateSet()->addUniform( m_pickUniform );
314 }
315 
317 {
318  if( pickInfo.getName() == m_node->getName() )
319  {
320  WVector3d normal = pickInfo.getPickNormal();
321  WVector2d newPixelPos = pickInfo.getPickPixel();
322  // dragging was initialized earlier
323  if( m_isPicked )
324  {
325  osg::Vec3 startPosScreen( m_oldPixelPosition[ 0 ], m_oldPixelPosition[ 1 ], 0.0 );
326  osg::Vec3 endPosScreen( newPixelPos[ 0 ], newPixelPos[ 1 ], 0.0 );
327 
328  osg::Vec3 startPosWorld = wge::unprojectFromScreen( startPosScreen, m_camera );
329  osg::Vec3 endPosWorld = wge::unprojectFromScreen( endPosScreen, m_camera );
330 
331  osg::Vec3 moveDirWorld = endPosWorld - startPosWorld;
332  float diff = moveDirWorld * static_cast< osg::Vec3 >( normal );
333 
334  m_property->set( m_property->get() + m_dir * diff );
335  }
336  // this might have initialized dragging. Keep track of old position
337  m_oldPixelPosition = newPixelPos;
338  m_isPicked = true;
339  m_pickUniform->set( 1.0f );
340  }
341  else // someone else got picked.
342  {
343  m_isPicked = false;
344  m_pickUniform->set( 0.0f );
345  }
346 }
347 
349 {
350  // get notified about data changes
351  m_moduleState.setResetable( true, true );
352 
353  // done.
354  ready();
355 
356  /////////////////////////////////////////////////////////////////////////////////////////////////////////
357  // Slices Setup
358  /////////////////////////////////////////////////////////////////////////////////////////////////////////
359 
360  // create the root node for all the geometry
361  m_output = osg::ref_ptr< WGEManagedGroupNode > ( new WGEManagedGroupNode( m_active ) );
362 
363  // create the roots for the nav-views
364  m_sagittalOutput = osg::ref_ptr< WGEGroupNode > ( new WGEGroupNode() );
365  m_coronalOutput = osg::ref_ptr< WGEGroupNode > ( new WGEGroupNode() );
366  m_axialOutput = osg::ref_ptr< WGEGroupNode > ( new WGEGroupNode() );
367 
368  WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->insert( m_output );
369 
370  // add for side-views
371  std::shared_ptr< WGEViewer > viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Axial View" );
372  if( viewer )
373  {
374  viewer->getScene()->insert( m_axialOutput );
375  }
376  viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Coronal View" );
377  if( viewer )
378  {
379  viewer->getScene()->insert( m_coronalOutput );
380  }
381  viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Sagittal View" );
382  if( viewer )
383  {
384  viewer->getScene()->insert( m_sagittalOutput );
385  }
386 
387  // disable the pick-coloring for the side views
388  m_axialOutput->getOrCreateStateSet()->addUniform( new osg::Uniform( "u_pickColorEnabled", 0.0f ) );
389  m_sagittalOutput->getOrCreateStateSet()->addUniform( new osg::Uniform( "u_pickColorEnabled", 0.0f ) );
390  m_coronalOutput->getOrCreateStateSet()->addUniform( new osg::Uniform( "u_pickColorEnabled", 0.0f ) );
391  m_output->getOrCreateStateSet()->addUniform( new osg::Uniform( "u_pickColorEnabled", 1.0f ) );
392 
393  m_output->getOrCreateStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON );
394  m_axialOutput->getOrCreateStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON );
395  m_sagittalOutput->getOrCreateStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON );
396  m_coronalOutput->getOrCreateStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON );
397 
398  // apply colormapping to all the nodes
399  osg::ref_ptr< WGEShader > shader = new WGEShader( "WMNavigationSlices", m_localPath );
401  nodes.push_back( m_output );
402  nodes.push_back( m_axialOutput );
403  nodes.push_back( m_sagittalOutput );
404  nodes.push_back( m_coronalOutput );
405  WGEColormapping::apply( nodes, shader ); // this automatically applies the shader
406 
407  /////////////////////////////////////////////////////////////////////////////////////////////////////////
408  // Main loop
409  /////////////////////////////////////////////////////////////////////////////////////////////////////////
410 
411  // we need to be informed if the bounding box of the volume containing all the data changes.
412  m_moduleState.add( WGEColormapping::instance()->getChangeCondition() );
413 
414  // main loop
415  while( !m_shutdownFlag() )
416  {
417  // woke up since the module is requested to finish?
418  if( m_shutdownFlag() )
419  {
420  break;
421  }
422 
423  // create the slices. This loop is only entered if WGEColormapper was fired or shutdown.
424  initOSG();
425 
426  // Thats it. Nothing more to do. Slide movement and colormapping is done by the pick handler and WGEColormapper
427  debugLog() << "Waiting ...";
429  }
430 
431  // clean up
432  m_xSlicePicker.reset();
433  m_ySlicePicker.reset();
434  m_zSlicePicker.reset();
435 
436  m_xPos->setHidden();
437  m_yPos->setHidden();
438  m_zPos->setHidden();
439 
440  WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->remove( m_output );
441 
442  viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Axial View" );
443  if( viewer )
444  {
445  viewer->getScene()->remove( m_axialOutput );
446  }
447  viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Coronal View" );
448  if( viewer )
449  {
450  viewer->getScene()->remove( m_coronalOutput );
451  }
452  viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "Sagittal View" );
453  if( viewer )
454  {
455  viewer->getScene()->remove( m_sagittalOutput );
456  }
457 }
const vec_type & getMax() const
Gives the back upper right aka maximum corner.
Definition: WBoundingBox.h:308
const vec_type & getMin() const
Gives the front lower left aka minimum corner.
Definition: WBoundingBox.h:302
virtual void wait() const
Wait for the condition.
void setResetable(bool resetable=true, bool autoReset=true)
Sets the resetable flag.
virtual void add(std::shared_ptr< WCondition > condition)
Adds another condition to the set of conditions to wait for.
static void apply(osg::ref_ptr< osg::Node > node, WMatrix4d preTransform=WMatrix4d::identity(), osg::ref_ptr< WGEShader > shader=osg::ref_ptr< WGEShader >(), size_t startTexUnit=0)
Apply the colormapping to the specified node.
static std::shared_ptr< WGEColormapping > instance()
Returns instance of the module factory to use to create modules.
std::vector< osg::ref_ptr< osg::Node > > NodeList
a bunch of nodes.
Class to wrap around the osg Group node and providing a thread safe add/removal mechanism.
Definition: WGEGroupNode.h:48
This class is an OSG Callback which allows simple linear translation of a matrix transform node along...
This class adds some convenience methods to WGEGroupNode.
This callback is useful to en-/disable nodes using the node mask based on properties.
This class is an OSG Callback which allows uniforms to be controlled by properties.
This is a uniform callback setting the uniform to the current time in milliseconds,...
Class encapsulating the OSG Program class for a more convenient way of adding and modifying shader.
Definition: WGEShader.h:48
static std::shared_ptr< WGraphicsEngine > getGraphicsEngine()
Returns instance of the graphics engine.
static WKernel * getRunningKernel()
Returns pointer to the currently running kernel.
Definition: WKernel.cpp:117
std::shared_ptr< WGraphicsEngine > getGraphicsEngine() const
Returns pointer to currently running instance of graphics engine.
Definition: WKernel.cpp:122
std::shared_ptr< PickCallback > SPtr
For the lazy guys.
void pick(WPickInfo pickInfo)
Pick event handler.
osg::ref_ptr< WGECamera > m_camera
The camera under which the node is placed.
boost::signals2::scoped_connection m_pickConnection
The pick connection for the pick() event handler.
PickCallback(osg::ref_ptr< osg::Node > node, WPropDouble property, bool negateDirection=false)
The callback, controlling.
osg::ref_ptr< osg::Uniform > m_pickUniform
This uniform is used to inform the shader about current pick-state.
This module provides simple slices that can be color-mapped.
void initOSG()
Initializes the needed geodes, transformations and vertex arrays.
WPropBool m_showonZ
indicates whether the vector should be shown on slice Z
WPropDouble m_xPos
x position of the slice
WPropBool m_showonX
indicates whether the vector should be shown on slice X
osg::ref_ptr< WGEGroupNode > m_axialOutput
The geode with the slice only for the nav widgets.
virtual void moduleMain()
Entry point after loading the module.
virtual const std::string getDescription() const
Gives back a description of this module.
WMNavigationSlices()
Default constructor.
WPropBool m_noTransparency
if true, the whole slices are shown.
WPropDouble m_zPos
z position of the slice
PickCallback::SPtr m_xSlicePicker
X-Slice pick callback.
osg::ref_ptr< WGEGroupNode > m_sagittalOutput
The geode with the slice only for the nav widgets.
WPropDouble m_yPos
y position of the slice
osg::ref_ptr< WGEManagedGroupNode > m_output
The Geode containing all the slices and the mesh.
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...
PickCallback::SPtr m_zSlicePicker
Z-Slice pick callback.
virtual void connectors()
Initialize the connectors this module is using.
WPropGroup m_sliceGroup
the group contains several slice properties
virtual ~WMNavigationSlices()
Destructor.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
PickCallback::SPtr m_ySlicePicker
Y-Slice pick callback.
WPropBool m_showonY
indicates whether the vector should be shown on slice Y
virtual const std::string getName() const
Gives back the name of this module.
osg::ref_ptr< WGEGroupNode > m_coronalOutput
The geode with the slice only for the nav widgets.
virtual void properties()
Initialize the properties for this module.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72
boost::filesystem::path m_localPath
The path where the module binary resides in.
Definition: WModule.h:734
virtual void properties()
Initialize properties in this function.
Definition: WModule.cpp:212
wlog::WStreamedLogger debugLog() const
Logger instance for comfortable debug logging.
Definition: WModule.cpp:575
std::shared_ptr< WProperties > m_properties
The property object for the module.
Definition: WModule.h:640
void ready()
Call this whenever your module is ready and can react on property changes.
Definition: WModule.cpp:505
WConditionSet m_moduleState
The internal state of the module.
Definition: WModule.h:703
WPropBool m_active
True whenever the module should be active.
Definition: WModule.h:723
virtual void connectors()
Initialize connectors in this function.
Definition: WModule.cpp:208
Encapsulates info for pick action.
Definition: WPickInfo.h:42
WVector2d getPickPixel() const
Returns the picked pixel coordinates in screen-space.
Definition: WPickInfo.h:275
WVector3d getPickNormal() const
Get normal at position where object was hit.
Definition: WPickInfo.h:258
std::string getName() const
Get name of picked object.
Definition: WPickInfo.h:243
WBoolFlag m_shutdownFlag
Condition getting fired whenever the thread should quit.
osg::ref_ptr< osg::Node > generateCullProxy(const WBoundingBox &bbox)
Generate a proxy cube, which ensures OSG does proper near-far plane calculation and culling.
Definition: WGEUtils.cpp:236
osg::Vec3 unprojectFromScreen(const osg::Vec3 screen, osg::ref_ptr< WGECamera > camera)
Converts screen coordinates into Camera coordinates.
Definition: WGEUtils.cpp:52
osg::ref_ptr< osg::Geode > genFinitePlane(double xSize, double ySize, const WPlane &p, const WColor &color=WColor(0.0, 0.7, 0.7, 1.0), bool border=false)
Generates a geode out of a Plane with a fixed size in direction of the vectors which span that plane.