OpenWalnut  1.4.0
WTractData.h
00001 //---------------------------------------------------------------------------
00002 //
00003 // Project: OpenWalnut ( http://www.openwalnut.org )
00004 //
00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
00006 // For more information see http://www.openwalnut.org/copying
00007 //
00008 // This file is part of OpenWalnut.
00009 //
00010 // OpenWalnut is free software: you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as published by
00012 // the Free Software Foundation, either version 3 of the License, or
00013 // (at your option) any later version.
00014 //
00015 // OpenWalnut is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 // GNU Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public License
00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
00022 //
00023 //---------------------------------------------------------------------------
00024 
00025 #ifndef WTRACTDATA_H
00026 #define WTRACTDATA_H
00027 
00028 #include <vector>
00029 
00030 #include <boost/shared_ptr.hpp>
00031 
00032 /**
00033  * Stores the data of deterministic fiber tractograms. Derived or optional data as tangents, FA,
00034  * etc. are not saved in here, and never will be! Just the polylines.
00035  */
00036 class WTractData
00037 {
00038 public:
00039     /**
00040      * Constructs a new WTractData.
00041      * \param pointComponents x, y, and z components of each position of each tract
00042      * \param startIndices For each tract the index of the first x component in pointComponents.
00043      */
00044     WTractData( boost::shared_ptr< std::vector< float > > pointComponents, boost::shared_ptr< std::vector< size_t > > startIndices );
00045 
00046     /**
00047      * \return Number of tracts.
00048      */
00049     size_t numTracts() const;
00050 
00051 protected:
00052 private:
00053     /**
00054      * Stores the all components of all vertices of all tracts. First x, y and finally z component
00055      * are arranged in this manner: \f$[x_0, y_0, z_0, ..., x_{m_0}, y_{m_0}, z_{m_0}, ... , ..., x_{m_k},
00056      * 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$
00057      * vertices, but \f$3m_i\f$ compontents. In other words: m_points.size() / 3 == number of
00058      * vertices.
00059      *
00060      * \note the reason for beeing restricted to float is, that graphic boards and also the tracking
00061      * algorithms which produce those tracks are just using floats.
00062      */
00063     boost::shared_ptr< std::vector< float > > m_pointComponents;
00064 
00065     /**
00066      * Stores for every tract the index number where it starts in the \ref m_pointComponents array.
00067      * This means the index of each tracts first component \f$x_0\f$.
00068      *
00069      * \note the reason for using \c size_t instead of \c unsigned \c int is that more tracts with
00070      * more points are in sight.
00071      */
00072     boost::shared_ptr< std::vector< size_t > > m_startIndices;
00073 };
00074 
00075 inline size_t WTractData::numTracts() const
00076 {
00077     if( m_startIndices )
00078     {
00079         return m_startIndices->size();
00080     }
00081     return 0;
00082 }
00083 
00084 #endif  // WTRACTDATA_H