OpenWalnut  1.5.0dev
WMFiberTransform.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 WMFIBERTRANSFORM_H
26 #define WMFIBERTRANSFORM_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include "core/kernel/WModule.h"
32 #include "core/kernel/WModuleInputData.h"
33 #include "core/kernel/WModuleOutputData.h"
34 
35 /**
36  * Forward declaration of WDataSetFibers.
37  */
38 class WDataSetFibers;
39 
40 /**
41  * Transforms a fiber dataset
42  * \ingroup modules
43  */
44 class WMFiberTransform : public WModule
45 {
46 public:
47  /**
48  * Constructor
49  */
51 
52  /**
53  * Destructor
54  */
55  virtual ~WMFiberTransform();
56 
57  /**
58  * Gives back the name of this module.
59  * \return the module's name.
60  */
61  virtual const std::string getName() const;
62 
63  /**
64  * Gives back a description of this module.
65  * \return description to module.
66  */
67  virtual const std::string getDescription() const;
68 
69  /**
70  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
71  * should never be initialized or modified in some other way. A simple new instance is required.
72  *
73  * \return the prototype used to create every module in OpenWalnut.
74  */
75  virtual std::shared_ptr< WModule > factory() const;
76 
77  /**
78  * Get the icon for this module in XPM format.
79  * \return The icon.
80  */
81  virtual const char** getXPMIcon() const;
82 
83 protected:
84  /**
85  * Entry point after loading the module. Runs in separate thread.
86  */
87  virtual void moduleMain();
88 
89  /**
90  * Initialize the connectors this module is using.
91  */
92  virtual void connectors();
93 
94  /**
95  * Initialize the properties for this module.
96  */
97  virtual void properties();
98 
99 private:
100  std::shared_ptr< WModuleInputData< WDataSetFibers > > m_fiberInput; //!< Input connector for a fiber dataset.
101  std::shared_ptr< WDataSetFibers > m_rawDataset; //!< Pointer to the fiber data set in WDataSetFibers format
102  std::shared_ptr< WModuleOutputData< WDataSetFibers > > m_output; //!< Output connector for the culled fibers
103 
104  std::shared_ptr< WCondition > m_recompute; //!< A condition which indicates complete recomputation
105 
106  WPropBool m_save; //!< If true, transformed fibers are saved to a file
107  WPropFilename m_savePath; //!< Path where transformed fibers should be stored
108  WPropTrigger m_run; //!< Indicates if the algorithm should start
109 
110  WPropPosition m_translationProp; //!< Translation part of the transformation.
111  WPropPosition m_matrix0Prop; //!< Row 0 of matrix part of the transformation.
112  WPropPosition m_matrix1Prop; //!< Row 1 of matrix part of the transformation.
113  WPropPosition m_matrix2Prop; //!< Row 2 of matrix part of the transformation.
114  WPropPosition m_matrix3Prop; //!< Row 3 of matrix part of the transformation.
115 
116  /**
117  * ReTransforms the scene.
118  */
119  void update();
120 
121  /**
122  * Generates the file name for saving the transformed fibers.
123  *
124  * \param dataFileName The file name from which the data is loaded so only the extension will change
125  * \return Path in which to store the transformed fibers.
126  */
127  boost::filesystem::path saveFileName( std::string dataFileName ) const;
128 };
129 
130 #endif // WMFIBERTRANSFORM_H
Represents a simple set of WFibers.
Transforms a fiber dataset.
virtual ~WMFiberTransform()
Destructor.
std::shared_ptr< WDataSetFibers > m_rawDataset
Pointer to the fiber data set in WDataSetFibers format.
WPropTrigger m_run
Indicates if the algorithm should start.
WPropFilename m_savePath
Path where transformed fibers should be stored.
virtual const std::string getName() const
Gives back the name of this module.
virtual void connectors()
Initialize the connectors this module is using.
virtual const std::string getDescription() const
Gives back a description of this module.
WPropPosition m_matrix0Prop
Row 0 of matrix part of the transformation.
virtual void properties()
Initialize the properties for this module.
WMFiberTransform()
Constructor.
WPropPosition m_translationProp
Translation part of the transformation.
WPropPosition m_matrix2Prop
Row 2 of matrix part of the transformation.
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< WModuleInputData< WDataSetFibers > > m_fiberInput
Input connector for a fiber dataset.
virtual void moduleMain()
Entry point after loading the module.
void update()
ReTransforms the scene.
std::shared_ptr< WModuleOutputData< WDataSetFibers > > m_output
Output connector for the culled fibers.
WPropPosition m_matrix1Prop
Row 1 of matrix part of the transformation.
WPropBool m_save
If true, transformed fibers are saved to a file.
std::shared_ptr< WCondition > m_recompute
A condition which indicates complete recomputation.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
boost::filesystem::path saveFileName(std::string dataFileName) const
Generates the file name for saving the transformed fibers.
WPropPosition m_matrix3Prop
Row 3 of matrix part of the transformation.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72