33 #include <osg/Geometry>
34 #include <osg/LightModel>
35 #include <osg/PolygonMode>
36 #include <osg/StateAttribute>
37 #include <osg/StateSet>
38 #include <osgDB/WriteFile>
39 #include <osgText/FadeText>
40 #include <osgText/Text>
42 #include "WMEffectiveConnectivityCluster.h"
43 #include "WMEffectiveConnectivityCluster.xpm"
44 #include "core/common/WProgress.h"
45 #include "core/dataHandler/WGridRegular3D.h"
46 #include "core/dataHandler/WSubject.h"
47 #include "core/dataHandler/datastructures/WFiberCluster.h"
48 #include "core/graphicsEngine/WGEUtils.h"
49 #include "core/graphicsEngine/WGraphicsEngine.h"
50 #include "core/graphicsEngine/widgets/labeling/WGEBorderLayout.h"
51 #include "core/graphicsEngine/widgets/labeling/WGELabel.h"
52 #include "core/kernel/WKernel.h"
53 #include "core/kernel/WModuleFactory.h"
54 #include "core/kernel/WModuleOutputData.h"
60 WModuleContainer( "Effective Connectivity Cluster", "This module is able to visualize effective connectivity cluster." ),
61 m_labelActive( false ),
83 return WMEffectiveConnectivityCluster_xpm;
97 std::shared_ptr< WModuleConnector > output )
109 std::shared_ptr< WModuleOutputData < WFiberCluster > > o = std::static_pointer_cast< WModuleOutputData< WFiberCluster > >( output );
112 errorLog() <<
"New data is not a WFiberCluster? That should not happen!";
116 std::shared_ptr< WFiberCluster > fibs = o->getData();
117 std::shared_ptr< WFiber > lline = fibs->getLongestLine();
145 props->getProperty(
"VOI1 threshold" )->toPropDouble()->set( 50.0 );
146 props->getProperty(
"VOI2 threshold" )->toPropDouble()->set( 50.0 );
147 props->getProperty(
"Cut fibers" )->toPropBool()->set(
true );
148 m_properties->addProperty( props->getProperty(
"Cut fibers" ) );
149 props->getProperty(
"Prefer shortest path" )->toPropBool()->set(
false );
150 m_properties->addProperty( props->getProperty(
"Prefer shortest path" ) );
153 m_fiberSelection->getOutputConnector(
"cluster" )->subscribeSignal( DATA_CHANGED,
172 props->getProperty(
"Center line" )->toPropBool()->set(
false );
173 props->getProperty(
"active" )->toPropBool()->set(
false );
174 props->getProperty(
"Fiber tracts" )->toPropBool()->set(
false );
175 props->getProperty(
"Display voxels" )->toPropBool()->set(
false );
176 props->getProperty(
"Lighting" )->toPropBool()->set(
false );
179 props->getProperty(
"Voxels per unit" )->toPropInt()->set( 2 );
182 props->getProperty(
"Parameterization" )->toPropSelection()->set( props->getProperty(
"Parameterization"
183 )->toPropSelection()->get().newSelector( idx ) );
185 m_properties->addProperty( props->getProperty(
"Voxels per unit" ) );
201 props =
m_gauss->getProperties();
202 props->getProperty(
"Iterations" )->toPropInt()->set( 2 );
221 props->getProperty(
"Isovalue" )->toPropInt()->set( 32 );
222 m_properties->addProperty( props->getProperty(
"Isovalue" ) );
223 props->getProperty(
"Step count" )->toPropInt()->set( 500 );
224 m_properties->addProperty( props->getProperty(
"Step count" ) );
225 props->getProperty(
"Iso color" )->toPropColor()->set( WColor( 0.0, 0.5, 1.0, 1.0 ) );
226 m_properties->addProperty( props->getProperty(
"Iso color" ) );
227 props->getProperty(
"Opacity %" )->toPropInt()->set( 100 );
228 m_properties->addProperty( props->getProperty(
"Opacity %" ) );
229 m_properties->addProperty( props->getProperty(
"Saturation %" ) );
230 m_properties->addProperty( props->getProperty(
"Beam1 size" ) );
231 m_properties->addProperty( props->getProperty(
"Beam2 size" ) );
232 m_properties->addProperty( props->getProperty(
"Beam1 speed" ) );
233 m_properties->addProperty( props->getProperty(
"Beam2 speed" ) );
234 m_properties->addProperty( props->getProperty(
"Parameter scale" ) );
245 m_gauss->getInputConnector(
"in" )->connect(
m_voxelizer->getOutputConnector(
"voxelOutput" ) );
248 m_animation->getInputConnector(
"in" )->connect(
m_gauss->getOutputConnector(
"out" ) );
249 m_animation->getInputConnector(
"traces" )->connect(
m_voxelizer->getOutputConnector(
"parameterizationOutput" ) );
295 lastLabelActiveState =
true;
302 osg::ref_ptr< WGELabel > label1 =
new WGELabel();
303 label1->setText( voi1 );
306 layouter->addLayoutable( label1 );
311 osg::ref_ptr< WGELabel > label2 =
new WGELabel();
312 label2->setText( voi2 );
315 layouter->addLayoutable( label2 );
340 m_VOI1 = std::shared_ptr< WModuleInputForwardData< WDataSetSingle > >(
342 "VOI1",
"The first volume of interest." )
349 m_VOI2 = std::shared_ptr< WModuleInputForwardData< WDataSetSingle > >(
351 "VOI2",
"The second volume of interest." )
358 m_fiberInput = std::shared_ptr< WModuleInputForwardData< WDataSetFibers > >(
360 "fibers",
"The fiber dataset used to find connection path." )
368 m_paramOutput = std::shared_ptr< WModuleOutputForwardData< WDataSetScalar > >(
370 "paramOut",
"The voxelized fiber parameterization field." )
375 m_voxelOutput = std::shared_ptr< WModuleOutputForwardData< WDataSetScalar > >(
377 "voxelsOut",
"The voxelized fibers." )
382 m_fiberOutput = std::shared_ptr< WModuleOutputForwardData< WDataSetFibers > >(
384 "fibersOut",
"The voxelized fibers." )
407 m_animation->getProperties()->getProperty(
"active" )->toPropBool()->set(
m_active->get() );
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.
Class to encapsulate boost::condition_variable_any.
This class contains a label layout for positioning labels at the side of the screen.
Class to wrap around the osg Group node and providing a thread safe add/removal mechanism.
std::vector< size_t > IndexList
The type used for storing index lists.
static WKernel * getRunningKernel()
Returns pointer to the currently running kernel.
std::shared_ptr< WGraphicsEngine > getGraphicsEngine() const
Returns pointer to currently running instance of graphics engine.
This module is able to visualize connectome data in the context of MRI data.
WPosition m_labelPos2
The position of the second label showing m_voi2Name.
void fiberDataChange(std::shared_ptr< WModuleConnector > input, std::shared_ptr< WModuleConnector > output)
This method is called whenever the data on the fiberSelection module output changes.
virtual void moduleMain()
Entry point after loading the module.
WPropString m_voi2Name
The name of the first region of interest.
WPropString m_voi1Name
The name of the first region of interest.
std::shared_ptr< WModuleOutputForwardData< WDataSetScalar > > m_voxelOutput
The voxelized fibers used.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
virtual void properties()
Initialize the properties for this module.
bool m_labelActive
True if the labels should be drawn.
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
std::shared_ptr< WModuleOutputForwardData< WDataSetScalar > > m_paramOutput
The parameter dataset used.
virtual const std::string getDescription() const
Gives back a description of this module.
WMEffectiveConnectivityCluster()
Standard constructor.
WPropInt m_labelCharacterSize
Size of the label font.
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< WModule > m_voxelizer
The voxelizer module.
virtual void activate()
Callback for m_active.
std::shared_ptr< WModuleInputForwardData< WDataSetSingle > > m_VOI1
The volume of interest 1.
std::shared_ptr< WModule > m_fiberSelection
The fiber selection module.
WPosition m_labelPos1
The position of the first label showing m_voi1Name.
virtual const std::string getName() const
Gives back the name of this module.
virtual void connectors()
Initialize the connectors this module is using.
std::shared_ptr< WModule > m_animation
The final animation.
std::shared_ptr< WModule > m_gauss
The Gauss filter which filters the voxelized fibers.
~WMEffectiveConnectivityCluster()
Destructor.
std::shared_ptr< WModuleInputForwardData< WDataSetFibers > > m_fiberInput
The fiber dataset used.
osg::ref_ptr< WGEGroupNode > m_rootNode
The root node used for this modules graphics.
std::shared_ptr< WModuleInputForwardData< WDataSetSingle > > m_VOI2
The volume of interest 2.
std::shared_ptr< WModuleOutputForwardData< WDataSetFibers > > m_fiberOutput
The fibers used.
Class able to contain other modules.
virtual const std::string getName() const
Gives back the name of this module.
virtual const std::string getDescription() const
Gives back a description of this module.
virtual void stop()
Stops all modules inside this container.
virtual void add(std::shared_ptr< WModule > module, bool run=true)
Add a module to this container and start it.
static SPtr getModuleFactory()
Returns instance of the module factory to use to create modules.
virtual void properties()
Initialize properties in this function.
void removeConnectors()
Removes all connectors properly.
void addConnector(std::shared_ptr< WModuleInputConnector > con)
Adds the specified connector to the list of inputs.
std::shared_ptr< WProperties > m_properties
The property object for the module.
void ready()
Call this whenever your module is ready and can react on property changes.
WConditionSet m_moduleState
The internal state of the module.
wlog::WStreamedLogger errorLog() const
Logger instance for comfortable error logging.
WPropBool m_active
True whenever the module should be active.
virtual void connectors()
Initialize connectors in this function.
WBoolFlag m_shutdownFlag
Condition getting fired whenever the thread should quit.