OpenWalnut
1.4.0
|
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 WDATASETFIBERVECTOR_H 00026 #define WDATASETFIBERVECTOR_H 00027 00028 #include <string> 00029 #include <vector> 00030 00031 #include <boost/shared_ptr.hpp> 00032 00033 #include "../common/datastructures/WFiber.h" 00034 #include "WDataSet.h" 00035 #include "WDataSetFibers.h" 00036 00037 00038 /** 00039 * Represents a simple set of WFibers. 00040 */ 00041 class WDataSetFiberVector : public WMixinVector< WFiber >, public WDataSet // NOLINT 00042 { 00043 public: 00044 /** 00045 * Short hand for a boost::shared_ptr on such classes. 00046 */ 00047 typedef boost::shared_ptr< WDataSetFiberVector > SPtr; 00048 00049 /** 00050 * Default constructor for creating an empty fiber vector. 00051 */ 00052 WDataSetFiberVector(); 00053 00054 /** 00055 * Constructs a new set of WFibers 00056 * 00057 * \param fibs Fiber vector to store in this data set 00058 */ 00059 explicit WDataSetFiberVector( boost::shared_ptr< std::vector< WFiber > > fibs ); 00060 00061 /** 00062 * Convert a WDataSetFibers into a fiber vector dataset. 00063 * 00064 * \param fiberDS Dataset which has to be converted 00065 */ 00066 explicit WDataSetFiberVector( boost::shared_ptr< const WDataSetFibers > fiberDS ); 00067 00068 /** 00069 * Copy constructor for fibers 00070 * 00071 * \param other Instance to copy from 00072 */ 00073 // defined since rule of three 00074 WDataSetFiberVector( const WDataSetFiberVector& other ); // NOLINT since cxxtest need it as unexcplicit! 00075 00076 /** 00077 * Destructs WDataSetFiberVector instances 00078 */ 00079 virtual ~WDataSetFiberVector(); // defined since rule of three 00080 00081 /** 00082 * Operator for assigning instances of WDataSetFiberVector 00083 * 00084 * \param other Instance which should replace this 00085 * 00086 * \return Reference for further usage of the outcome of the assigment 00087 */ 00088 WDataSetFiberVector& operator=( const WDataSetFiberVector& other ); // defined since rule of three 00089 00090 /** 00091 * Sort fibers descending on their length and update 00092 */ 00093 void sortDescLength(); 00094 00095 /** 00096 * Generates new WDataSetFiberVector out of the used fibers from this dataset. 00097 * 00098 * \param unused If the i'th postion of this vector is true, then this fiber is considered as used. 00099 * 00100 * \return A reference to the new generate WDataSetFiberVector 00101 */ 00102 boost::shared_ptr< WDataSetFiberVector > generateDataSetOutOfUsedFibers( const std::vector< bool > &unused ) const; 00103 00104 /** 00105 * Determines whether this dataset can be used as a texture. 00106 * 00107 * \return true if usable as texture. 00108 */ 00109 virtual bool isTexture() const; 00110 00111 /** 00112 * Gets the name of this prototype. 00113 * 00114 * \return the name. 00115 */ 00116 virtual const std::string getName() const; 00117 00118 /** 00119 * Gets the description for this prototype. 00120 * 00121 * \return the description 00122 */ 00123 virtual const std::string getDescription() const; 00124 00125 /** 00126 * Returns a prototype instantiated with the true type of the deriving class. 00127 * 00128 * \return the prototype. 00129 */ 00130 static boost::shared_ptr< WPrototyped > getPrototype(); 00131 00132 /** 00133 * Convert this dataset into WDataSetFibers format for other purposes if needed. (e.g. display) 00134 * 00135 * \return Reference to the dataset in WDataSetFibers format 00136 */ 00137 boost::shared_ptr< WDataSetFibers > toWDataSetFibers() const; 00138 00139 protected: 00140 /** 00141 * The prototype as singleton. 00142 */ 00143 static boost::shared_ptr< WPrototyped > m_prototype; 00144 }; 00145 00146 boost::shared_ptr< WFiber > centerLine( boost::shared_ptr< const WDataSetFibers > tracts ); 00147 00148 boost::shared_ptr< WFiber > longestLine( boost::shared_ptr< const WDataSetFibers > tracts ); 00149 00150 boost::shared_ptr< WFiber > centerLine( boost::shared_ptr< const WDataSetFiberVector > tracts ); 00151 00152 boost::shared_ptr< WFiber > longestLine( boost::shared_ptr< const WDataSetFiberVector > tracts ); 00153 00154 #endif // WDATASETFIBERVECTOR_H