OpenWalnut  1.5.0dev
WTractData.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 WTRACTDATA_H
26 #define WTRACTDATA_H
27 
28 #include <memory>
29 #include <vector>
30 
31 
32 /**
33  * Stores the data of deterministic fiber tractograms. Derived or optional data as tangents, FA,
34  * etc. are not saved in here, and never will be! Just the polylines.
35  */
37 {
38 public:
39  /**
40  * Constructs a new WTractData.
41  * \param pointComponents x, y, and z components of each position of each tract
42  * \param startIndices For each tract the index of the first x component in pointComponents.
43  */
44  WTractData( std::shared_ptr< std::vector< float > > pointComponents, std::shared_ptr< std::vector< size_t > > startIndices );
45 
46  /**
47  * \return Number of tracts.
48  */
49  size_t numTracts() const;
50 
51 protected:
52 private:
53  /**
54  * Stores the all components of all vertices of all tracts. First x, y and finally z component
55  * are arranged in this manner: \f$[x_0, y_0, z_0, ..., x_{m_0}, y_{m_0}, z_{m_0}, ... , ..., x_{m_k},
56  * y_{m_k}, z_{m_k}]\f$ where there are \f$k\f$ many tracts where the i'th tract has \f$m_i\f$
57  * vertices, but \f$3m_i\f$ compontents. In other words: m_points.size() / 3 == number of
58  * vertices.
59  *
60  * \note the reason for beeing restricted to float is, that graphic boards and also the tracking
61  * algorithms which produce those tracks are just using floats.
62  */
63  std::shared_ptr< std::vector< float > > m_pointComponents;
64 
65  /**
66  * Stores for every tract the index number where it starts in the \ref m_pointComponents array.
67  * This means the index of each tracts first component \f$x_0\f$.
68  *
69  * \note the reason for using \c size_t instead of \c unsigned \c int is that more tracts with
70  * more points are in sight.
71  */
72  std::shared_ptr< std::vector< size_t > > m_startIndices;
73 };
74 
75 inline size_t WTractData::numTracts() const
76 {
77  if( m_startIndices )
78  {
79  return m_startIndices->size();
80  }
81  return 0;
82 }
83 
84 #endif // WTRACTDATA_H
Stores the data of deterministic fiber tractograms.
Definition: WTractData.h:37
std::shared_ptr< std::vector< float > > m_pointComponents
Stores the all components of all vertices of all tracts.
Definition: WTractData.h:63
size_t numTracts() const
Definition: WTractData.h:75
std::shared_ptr< std::vector< size_t > > m_startIndices
Stores for every tract the index number where it starts in the m_pointComponents array.
Definition: WTractData.h:72
WTractData(std::shared_ptr< std::vector< float > > pointComponents, std::shared_ptr< std::vector< size_t > > startIndices)
Constructs a new WTractData.
Definition: WTractData.cpp:31