OpenWalnut  1.5.0dev
WMFiberSelection.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 WMFIBERSELECTION_H
26 #define WMFIBERSELECTION_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include <osg/Geode>
32 
33 #include "core/dataHandler/WDataSetFibers.h"
34 #include "core/dataHandler/datastructures/WFiberCluster.h"
35 #include "core/kernel/WModule.h"
36 #include "core/kernel/WModuleInputData.h"
37 #include "core/kernel/WModuleOutputData.h"
38 
39 /**
40  * This module handles selection of fibers based on two volumes of interest. It can filter out ALL fibers which do not go through both VOI.
41  * \ingroup modules
42  */
44 {
45 public:
46  /**
47  * Default constructor.
48  */
50 
51  /**
52  * Destructor.
53  */
54  virtual ~WMFiberSelection();
55 
56  /**
57  * Gives back the name of this module.
58  * \return the module's name.
59  */
60  virtual const std::string getName() const;
61 
62  /**
63  * Gives back a description of this module.
64  * \return description to module.
65  */
66  virtual const std::string getDescription() const;
67 
68  /**
69  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
70  * should never be initialized or modified in some other way. A simple new instance is required.
71  *
72  * \return the prototype used to create every module in OpenWalnut.
73  */
74  virtual std::shared_ptr< WModule > factory() const;
75 
76  /**
77  * Get the icon for this module in XPM format.
78  * \return The icon.
79  */
80  virtual const char** getXPMIcon() const;
81 
82 protected:
83  /**
84  * Entry point after loading the module. Runs in separate thread.
85  */
86  virtual void moduleMain();
87 
88  /**
89  * Initialize the connectors this module is using.
90  */
91  virtual void connectors();
92 
93  /**
94  * Initialize the properties for this module.
95  */
96  virtual void properties();
97 
98  /**
99  * Callback for m_active. Overwrite this in your modules to handle m_active changes separately.
100  */
101  virtual void activate();
102 
103 private:
104  //////////////////////////////////////////////////////////////////////////////////////////////
105  // Input Data
106  //////////////////////////////////////////////////////////////////////////////////////////////
107 
108  /**
109  * The first VOI
110  */
111  std::shared_ptr< WModuleInputData< WDataSetSingle > > m_voi1Input;
112 
113  /**
114  * The second VOI.
115  */
116  std::shared_ptr< WModuleInputData< WDataSetSingle > > m_voi2Input;
117 
118  /**
119  * The fiber dataset which is going to be filtered.
120  */
121  std::shared_ptr< WModuleInputData< WDataSetFibers > > m_fiberInput;
122 
123  /**
124  * The output connector used to provide the calculated data to other modules.
125  */
126  std::shared_ptr< WModuleOutputData< WDataSetFibers > > m_fiberOutput;
127 
128  /**
129  * The cluster dataset created from m_fiberOutput.
130  */
131  std::shared_ptr< WModuleOutputData< WFiberCluster > > m_clusterOutput;
132 
133  /**
134  * A condition used to notify about changes in several properties.
135  */
136  std::shared_ptr< WCondition > m_propCondition;
137 
138  /**
139  * The fiber dataset (from m_fiberInput).
140  */
141  std::shared_ptr< WDataSetFibers > m_fibers;
142 
143  /**
144  * The VOI1 dataset (from m_voi1Input).
145  */
146  std::shared_ptr< WDataSetSingle > m_voi1;
147 
148  /**
149  * The VOI2 dataset (from m_voi2Input).
150  */
151  std::shared_ptr< WDataSetSingle > m_voi2;
152 
153  //////////////////////////////////////////////////////////////////////////////////////////////
154  // Properties
155  //////////////////////////////////////////////////////////////////////////////////////////////
156 
157  /**
158  * VOI1 threshold.
159  */
160  WPropDouble m_voi1Threshold;
161 
162  /**
163  * VOI2 threshold.
164  */
165  WPropDouble m_voi2Threshold;
166 
167  /**
168  * Cut the fibers when they are outside the VOI?
169  */
170  WPropBool m_cutFibers;
171 
172  /**
173  * Should the fibers be cut to avoid having them inside the VOI
174  */
176 };
177 
178 #endif // WMFIBERSELECTION_H
179 
This module handles selection of fibers based on two volumes of interest.
virtual const std::string getDescription() const
Gives back a description of this module.
std::shared_ptr< WDataSetSingle > m_voi2
The VOI2 dataset (from m_voi2Input).
WPropDouble m_voi1Threshold
VOI1 threshold.
std::shared_ptr< WModuleOutputData< WFiberCluster > > m_clusterOutput
The cluster dataset created from m_fiberOutput.
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
virtual ~WMFiberSelection()
Destructor.
std::shared_ptr< WModuleInputData< WDataSetFibers > > m_fiberInput
The fiber dataset which is going to be filtered.
WPropBool m_cutFibers
Cut the fibers when they are outside the VOI?
WPropDouble m_voi2Threshold
VOI2 threshold.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
std::shared_ptr< WModuleInputData< WDataSetSingle > > m_voi1Input
The first VOI.
virtual const std::string getName() const
Gives back the name of this module.
virtual void connectors()
Initialize the connectors this module is using.
virtual void activate()
Callback for m_active.
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< WDataSetFibers > m_fibers
The fiber dataset (from m_fiberInput).
std::shared_ptr< WModuleOutputData< WDataSetFibers > > m_fiberOutput
The output connector used to provide the calculated data to other modules.
std::shared_ptr< WModuleInputData< WDataSetSingle > > m_voi2Input
The second VOI.
virtual void properties()
Initialize the properties for this module.
std::shared_ptr< WDataSetSingle > m_voi1
The VOI1 dataset (from m_voi1Input).
WPropBool m_preferShortestPath
Should the fibers be cut to avoid having them inside the VOI.
virtual void moduleMain()
Entry point after loading the module.
WMFiberSelection()
Default constructor.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72