OpenWalnut  1.5.0dev
WMDataCreatorVector.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 WMDATACREATORVECTOR_H
26 #define WMDATACREATORVECTOR_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include "WDataSetSingleCreatorInterface.h"
32 #include "core/common/WObjectNDIP.h"
33 #include "core/common/WStrategyHelper.h"
34 #include "core/dataHandler/WDataHandlerEnums.h"
35 #include "core/dataHandler/WDataSetVector.h"
36 #include "core/dataHandler/WValueSetBase.h"
37 #include "core/kernel/WModule.h"
38 #include "core/kernel/WModuleOutputData.h"
39 
40 /**
41  * Module which utilizes the strategy pattern to provide a multitude of dataset creation algorithms for vector data.
42  *
43  * \ingroup modules
44  */
46 {
47 public:
48  /**
49  * Standard constructor.
50  */
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  * Define the interface which is injected into an WObjectNDIP.
86  */
88  {
89  public:
90  /**
91  * Create the dataset. This needs to be implemented by all the creators you write.
92  *
93  * \param progress the progress instance you should increment each time you fill the value for one voxel.
94  * \param grid the grid on which the value set has to be build
95  * \param type the value type in the value set
96  *
97  * \return the value set for the given grid
98  */
99  virtual WValueSetBase::SPtr operator()( WProgress::SPtr progress, WGridRegular3D::ConstSPtr grid, dataType type = W_DT_FLOAT ) = 0;
100 
101  /**
102  * Destructor
103  */
105  {
106  }
107  };
108 
109 protected:
110  /**
111  * Entry point after loading the module. Runs in separate thread.
112  */
113  virtual void moduleMain();
114 
115  /**
116  * Initialize the connectors this module is using.
117  */
118  virtual void connectors();
119 
120  /**
121  * Initialize the properties for this module.
122  */
123  virtual void properties();
124 
125 private:
126  /**
127  * A condition used to notify about changes in several properties.
128  */
129  std::shared_ptr< WCondition > m_propCondition;
130 
131  std::shared_ptr< WModuleOutputData< WDataSetVector > > m_output; //!< The only output of this module.
132 
133 
134  WPropInt m_nbVoxelsX; //!< number of voxels in x direction
135  WPropInt m_nbVoxelsY; //!< number of voxels in y direction
136  WPropInt m_nbVoxelsZ; //!< number of voxels in z direction
137 
138  WPropPosition m_origin; //!< where to put the origin
139  WPropPosition m_size; //!< where to put the origin
140 
141  WPropSelection m_valueType; //!< the datatype of the valueset
142 
144 };
145 
146 #endif // WMDATACREATORVECTOR_H
std::shared_ptr< const WGridRegular3DTemplate > ConstSPtr
Convenience typedef for a std::shared_ptr< const WGridRegular3DTemplate >.
Define the interface which is injected into an WObjectNDIP.
virtual WValueSetBase::SPtr operator()(WProgress::SPtr progress, WGridRegular3D::ConstSPtr grid, dataType type=W_DT_FLOAT)=0
Create the dataset.
Module which utilizes the strategy pattern to provide a multitude of dataset creation algorithms for ...
WMDataCreatorVector()
Standard constructor.
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
~WMDataCreatorVector()
Destructor.
virtual void connectors()
Initialize the connectors this module is using.
WPropInt m_nbVoxelsX
number of voxels in x direction
virtual void properties()
Initialize the properties for this module.
WPropPosition m_size
where to put the origin
WPropInt m_nbVoxelsY
number of voxels in y direction
virtual const std::string getDescription() const
Gives back a description of this module.
std::shared_ptr< WModuleOutputData< WDataSetVector > > m_output
The only output of this module.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
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...
virtual const std::string getName() const
Gives back the name of this module.
WStrategyHelper< WObjectNDIP< WDataSetSingleCreatorInterface > > m_strategy
the strategy currently active.
virtual void moduleMain()
Entry point after loading the module.
WPropInt m_nbVoxelsZ
number of voxels in z direction
WPropSelection m_valueType
the datatype of the valueset
WPropPosition m_origin
where to put the origin
Class representing a single module of OpenWalnut.
Definition: WModule.h:72
std::shared_ptr< WProgress > SPtr
Shared pointer on a WProgress.
Definition: WProgress.h:48
This class allows for an easy strategy pattern-based switching between properties and strategy instan...
std::shared_ptr< WValueSetBase > SPtr
Shared pointer to an instance of this class.
Definition: WValueSetBase.h:65
dataType
Data types and number values taken from the nifti1.h, at this point it's unknown if it makes sense to...