OpenWalnut  1.5.0dev
WCreateColorArraysThread.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 WCREATECOLORARRAYSTHREAD_H
26 #define WCREATECOLORARRAYSTHREAD_H
27 
28 #include <memory>
29 #include <vector>
30 
31 #include "../common/WThreadedRunner.h"
32 
33 /**
34  * Thread for computing directional color coding of fibers.
35  */
37 {
38 public:
39  /**
40  * default constructor
41  *
42  * \param left start position of the first line to comput colors for
43  * \param right last line for which the color is computed
44  * \param vertices vertices of all lines
45  * \param lineLengths line length in vertex array
46  * \param globalColors where to write global coloring
47  * \param localColors where to write local coloring
48  * \param tangents
49  */
50  WCreateColorArraysThread( int left, int right, std::shared_ptr< std::vector< float > >vertices,
51  std::shared_ptr< std::vector< size_t > > lineLengths,
52  std::shared_ptr< std::vector< float > > globalColors,
53  std::shared_ptr< std::vector< float > > localColors,
54  std::shared_ptr< std::vector< float > > tangents );
55 
56  /**
57  * destructor
58  */
59  virtual ~WCreateColorArraysThread();
60 
61  /**
62  * entry for the run command
63  */
64  virtual void threadMain();
65 
66  /**
67  * Return the value of the finished flag.
68  *
69  * \return true if finished
70  */
71  inline bool isFinished();
72 
73 protected:
74 private:
75  bool m_myThreadFinished; //!< Has the thread finished?
76 
77  int m_left; //!< left boundary
78 
79  int m_right; //!< right boundary
80 
81  /**
82  * Point vector for all fibers
83  */
84  std::shared_ptr< const std::vector< float > > m_vertices;
85 
86  /**
87  * Point vector for tangents at each vertex, used for fake tubes
88  */
89  std::shared_ptr< std::vector< float > > m_tangents;
90 
91  /**
92  * Storing the global color value of the fibers for each point.
93  */
94  std::shared_ptr< std::vector< float > > m_globalColors;
95 
96  /**
97  * Storing the local color value of the fibers for each point.
98  * \note it is mutable to allow getLocalColors creating it on demand.
99  */
100  std::shared_ptr< std::vector< float > > m_localColors;
101 
102  /**
103  * Line vector that contains the number of vertices for each line
104  */
105  std::shared_ptr< const std::vector< size_t > > m_lineLengths;
106 };
107 
108 #endif // WCREATECOLORARRAYSTHREAD_H
Thread for computing directional color coding of fibers.
std::shared_ptr< const std::vector< float > > m_vertices
Point vector for all fibers.
virtual void threadMain()
entry for the run command
bool m_myThreadFinished
Has the thread finished?
std::shared_ptr< std::vector< float > > m_tangents
Point vector for tangents at each vertex, used for fake tubes.
std::shared_ptr< std::vector< float > > m_globalColors
Storing the global color value of the fibers for each point.
WCreateColorArraysThread(int left, int right, std::shared_ptr< std::vector< float > >vertices, std::shared_ptr< std::vector< size_t > > lineLengths, std::shared_ptr< std::vector< float > > globalColors, std::shared_ptr< std::vector< float > > localColors, std::shared_ptr< std::vector< float > > tangents)
default constructor
std::shared_ptr< const std::vector< size_t > > m_lineLengths
Line vector that contains the number of vertices for each line.
std::shared_ptr< std::vector< float > > m_localColors
Storing the local color value of the fibers for each point.
bool isFinished()
Return the value of the finished flag.
virtual ~WCreateColorArraysThread()
destructor
Base class for all classes needing to be executed in a separate thread.