OpenWalnut  1.5.0dev
WMFiberTranslator.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 WMFIBERTRANSLATOR_H
26 #define WMFIBERTRANSLATOR_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include "core/dataHandler/WDataSetFibers.h"
32 #include "core/kernel/WModule.h"
33 #include "core/kernel/WModuleOutputData.h"
34 
35 /**
36  * Creates a fiber dataset from various data sources.
37  *
38  * \ingroup modules
39  */
40 class WMFiberTranslator : public WModule
41 {
42 public:
43  /**
44  * Constructor.
45  */
47 
48  /**
49  * Destructor.
50  */
51  virtual ~WMFiberTranslator();
52 
53  /**
54  * Gives back the name of this module.
55  * \return the module's name.
56  */
57  virtual const std::string getName() const;
58 
59  /**
60  * Gives back a description of this module.
61  * \return description to module.
62  */
63  virtual const std::string getDescription() const;
64 
65  /**
66  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
67  * should never be initialized or modified in some other way. A simple new instance is required.
68  *
69  * \return the prototype used to create every module in OpenWalnut.
70  */
71  virtual std::shared_ptr< WModule > factory() const;
72 
73  /**
74  * Get the icon for this module in XPM format.
75  * \return The icon.
76  */
77  virtual const char** getXPMIcon() const;
78 
79 protected:
80  /**
81  * Entry point after loading the module. Runs in separate thread.
82  */
83  virtual void moduleMain();
84 
85  /**
86  * Initialize the connectors this module is using.
87  */
88  virtual void connectors();
89 
90  /**
91  * Initialize the properties for this module.
92  */
93  virtual void properties();
94 
95  /**
96  * Initialize requirements for this module.
97  */
98  virtual void requirements();
99 
100 private:
101  /**
102  * Merge the fibers in the given directory.
103  *
104  * \param dir The chosen directory.
105  * \return The fiber dataset.
106  */
107  std::shared_ptr< WDataSetFibers > mergeFibers( boost::filesystem::path dir );
108 
109  /**
110  * Merge the fibers from given directory.
111  *
112  * \param dir The chosen directory.
113  * \return The fiber dataset.
114  */
115  std::shared_ptr< WDataSetFibers > mergeFibersNrrd( boost::filesystem::path dir );
116 
117  /**
118  * Load fibers from an ExploreDTI .txt file.
119  *
120  * \param file The chosen txt file.
121  * \return The fiber dataset.
122  */
123  std::shared_ptr< WDataSetFibers > loadExploreDTIFibers( boost::filesystem::path file );
124 
125  //! The output connector.
126  std::shared_ptr< WModuleOutputData< WDataSetFibers > > m_output;
127 
128  //! A property for choosing the directory that contains the fiber text files.
129  WPropFilename m_propInputDirectory;
130 
131  //! A property for choosing a file that contains the fiber coordinates.
132  WPropFilename m_propInputFile;
133 
134  //! A condition for property updates.
135  std::shared_ptr< WCondition > m_propCondition;
136 };
137 
138 #endif // WMFIBERTRANSLATOR_H
Creates a fiber dataset from various data sources.
std::shared_ptr< WDataSetFibers > mergeFibers(boost::filesystem::path dir)
Merge the fibers in the given directory.
virtual const std::string getName() const
Gives back the name of this module.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
virtual void moduleMain()
Entry point after loading the module.
std::shared_ptr< WCondition > m_propCondition
A condition for property updates.
std::shared_ptr< WModuleOutputData< WDataSetFibers > > m_output
The output connector.
WPropFilename m_propInputFile
A property for choosing a file that contains the fiber coordinates.
virtual void properties()
Initialize the properties for this module.
WMFiberTranslator()
Constructor.
virtual const std::string getDescription() const
Gives back a description of this module.
WPropFilename m_propInputDirectory
A property for choosing the directory that contains the fiber text files.
virtual ~WMFiberTranslator()
Destructor.
virtual void connectors()
Initialize the connectors this module is using.
virtual void requirements()
Initialize requirements for this module.
std::shared_ptr< WDataSetFibers > loadExploreDTIFibers(boost::filesystem::path file)
Load fibers from an ExploreDTI .txt file.
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 > mergeFibersNrrd(boost::filesystem::path dir)
Merge the fibers from given directory.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72