OpenWalnut  1.5.0dev
WMDistanceMap.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 WMDISTANCEMAP_H
26 #define WMDISTANCEMAP_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include "core/dataHandler/WDataSetScalar.h"
32 #include "core/kernel/WModule.h"
33 #include "core/kernel/WModuleInputData.h"
34 #include "core/kernel/WModuleOutputData.h"
35 
36 /**
37  * Computes a distance map from an anatomy dataset.
38  * \ingroup modules
39  */
40 class WMDistanceMap : public WModule
41 {
42 /**
43  * Only UnitTests may be friends.
44  */
45 friend class WMDistanceMapTest;
46 
47 public:
48  /**
49  * Standard constructor.
50  */
51  WMDistanceMap();
52 
53  /**
54  * Destructor.
55  */
57 
58  /**
59  * Gives back the name of this module.
60  * \return the module's name.
61  */
62  virtual const std::string getName() const;
63 
64  /**
65  * Gives back a description of this module.
66  * \return description of module.
67  */
68  virtual const std::string getDescription() const;
69 
70  /**
71  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
72  * should never be initialized or modified in some other way. A simple new instance is required.
73  *
74  * \return the prototype used to create every module in OpenWalnut.
75  */
76  virtual std::shared_ptr< WModule > factory() const;
77 
78  /**
79  * Get the icon for this module in XPM format.
80  * \return The icon.
81  */
82  virtual const char** getXPMIcon() const;
83 
84 
85 protected:
86  /**
87  * Entry point after loading the module. Runs in separate thread.
88  */
89  virtual void moduleMain();
90 
91  /**
92  * Initialize the connectors this module is using.
93  */
94  virtual void connectors();
95 
96  /**
97  * Initialize the properties for this module.
98  */
99  virtual void properties();
100 
101 private:
102  std::shared_ptr< WModuleInputData< WDataSetScalar > > m_input; //!< Input connector required by this module.
103 
104  /**
105  * Source dataset.
106  */
107  std::shared_ptr< WDataSetScalar > m_dataSet;
108 
109  /**
110  * Connector to provide the distance map to other modules.
111  */
112  std::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output;
113 
114  /**
115  * Target dataset.
116  */
117  std::shared_ptr< WDataSetScalar > m_distanceMapDataSet;
118 
119  /**
120  * Function to create a distance map from Anatomy data set.
121  * Take from FiberNavigator.
122  * \param dataSet the data set that is used to compute the distance field.
123  * The distance is computed to the boundary between foreground an background
124  *
125  * \return the distance map values
126  */
127  std::shared_ptr< WValueSet< float > > createOffset( std::shared_ptr< const WDataSetScalar > dataSet );
128 
129  /**
130  * Gauss function.
131  *
132  * \param x position of evaluation
133  * \param sigma standard deviation
134  *
135  * \return Gauss value for given parameters
136  */
137  double xxgauss( double x, double sigma );
138 };
139 
140 #endif // WMDISTANCEMAP_H
Computes a distance map from an anatomy dataset.
Definition: WMDistanceMap.h:41
std::shared_ptr< WDataSetScalar > m_dataSet
Source dataset.
virtual const std::string getDescription() const
Gives back a description of this module.
std::shared_ptr< WDataSetScalar > m_distanceMapDataSet
Target dataset.
std::shared_ptr< WModuleInputData< WDataSetScalar > > m_input
Input connector required by this module.
virtual void moduleMain()
Entry point after loading the module.
std::shared_ptr< WValueSet< float > > createOffset(std::shared_ptr< const WDataSetScalar > dataSet)
Function to create a distance map from Anatomy data set.
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...
double xxgauss(double x, double sigma)
Gauss function.
virtual const std::string getName() const
Gives back the name of this module.
virtual void connectors()
Initialize the connectors this module is using.
WMDistanceMap()
Standard constructor.
virtual void properties()
Initialize the properties for this module.
std::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output
Connector to provide the distance map to other modules.
friend class WMDistanceMapTest
Only UnitTests may be friends.
Definition: WMDistanceMap.h:45
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
~WMDistanceMap()
Destructor.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72