OpenWalnut  1.5.0dev
WMEffectiveConnectivityCluster.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 WMEFFECTIVECONNECTIVITYCLUSTER_H
26 #define WMEFFECTIVECONNECTIVITYCLUSTER_H
27 
28 #include <map>
29 #include <memory>
30 #include <string>
31 #include <vector>
32 
33 #include <osg/Node>
34 
35 #include "core/common/math/linearAlgebra/WPosition.h"
36 #include "core/dataHandler/WDataSetFibers.h"
37 #include "core/dataHandler/WDataSetScalar.h"
38 #include "core/graphicsEngine/WGEGroupNode.h"
39 #include "core/kernel/WModule.h"
40 #include "core/kernel/WModuleContainer.h"
41 #include "core/kernel/WModuleInputForwardData.h"
42 #include "core/kernel/WModuleOutputForwardData.h"
43 
44 /**
45  * This module is able to visualize connectome data in the context of MRI data. It uses the module container class to allow the
46  * module to be composed from other modules.
47  * \ingroup modules
48  */
50 {
51 public:
52  /**
53  * Standard constructor.
54  */
56 
57  /**
58  * Destructor.
59  */
61 
62  /**
63  * Gives back the name of this module.
64  * \return the module's name.
65  */
66  virtual const std::string getName() const;
67 
68  /**
69  * Gives back a description of this module.
70  * \return description of module.
71  */
72  virtual const std::string getDescription() const;
73 
74  /**
75  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
76  * should never be initialized or modified in some other way. A simple new instance is required.
77  *
78  * \return the prototype used to create every module in OpenWalnut.
79  */
80  virtual std::shared_ptr< WModule > factory() const;
81 
82  /**
83  * Get the icon for this module in XPM format.
84  * \return the icon.
85  */
86  virtual const char** getXPMIcon() const;
87 
88 protected:
89  /**
90  * Entry point after loading the module. Runs in separate thread.
91  */
92  virtual void moduleMain();
93 
94  /**
95  * Initialize the connectors this module is using.
96  */
97  virtual void connectors();
98 
99  /**
100  * Initialize the properties for this module.
101  */
102  virtual void properties();
103 
104  /**
105  * Callback for m_active. Overwrite this in your modules to handle m_active changes separately.
106  */
107  virtual void activate();
108 
109  /**
110  * This method is called whenever the data on the fiberSelection module output changes.
111  *
112  * \param input this is the input receiving the change, in this case, the voxelizer
113  * \param output this is the sender, the fiberSelection module.
114  *
115  */
116  void fiberDataChange( std::shared_ptr< WModuleConnector > input, std::shared_ptr< WModuleConnector > output );
117 
118 private:
119  /**
120  * The fiber dataset used.
121  */
122  std::shared_ptr< WModuleInputForwardData< WDataSetFibers > > m_fiberInput;
123 
124  /**
125  * The volume of interest 1.
126  */
127  std::shared_ptr< WModuleInputForwardData< WDataSetSingle > > m_VOI1;
128 
129  /**
130  * The volume of interest 2.
131  */
132  std::shared_ptr< WModuleInputForwardData< WDataSetSingle > > m_VOI2;
133 
134  /**
135  * The parameter dataset used.
136  */
137  std::shared_ptr< WModuleOutputForwardData< WDataSetScalar > > m_paramOutput;
138 
139  /**
140  * The voxelized fibers used.
141  */
142  std::shared_ptr< WModuleOutputForwardData< WDataSetScalar > > m_voxelOutput;
143 
144  /**
145  * The fibers used.
146  */
147  std::shared_ptr< WModuleOutputForwardData< WDataSetFibers > > m_fiberOutput;
148 
149 
150  std::shared_ptr< WModule > m_fiberSelection; //!< The fiber selection module.
151  std::shared_ptr< WModule > m_voxelizer; //!< The voxelizer module.
152  std::shared_ptr< WModule > m_gauss; //!< The Gauss filter which filters the voxelized fibers.
153  std::shared_ptr< WModule > m_animation; //!< The final animation.
154 
155  /**
156  * The position of the first label showing m_voi1Name
157  */
159 
160  /**
161  * The position of the second label showing m_voi2Name
162  */
164 
165  /////////////////////////////////////////////////////////////////////
166  // The Properties
167  /////////////////////////////////////////////////////////////////////
168 
169  /**
170  * The name of the first region of interest
171  */
172  WPropString m_voi1Name;
173 
174  /**
175  * The name of the first region of interest
176  */
177  WPropString m_voi2Name;
178 
179  /**
180  * Size of the label font.
181  */
183 
184  /**
185  * True if the labels should be drawn.
186  */
188 
189  /**
190  * A condition used to notify about changes in several properties.
191  */
192  std::shared_ptr< WCondition > m_propCondition;
193 
194  /////////////////////////////////////////////////////////////////////
195  // OSG Stuff
196  /////////////////////////////////////////////////////////////////////
197 
198  /**
199  * The root node used for this modules graphics. For OSG nodes, always use osg::ref_ptr to ensure proper resource management.
200  */
201  osg::ref_ptr< WGEGroupNode > m_rootNode;
202 };
203 
204 #endif // WMEFFECTIVECONNECTIVITYCLUSTER_H
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.
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.
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.
This only is a 3d double vector.