OpenWalnut 1.2.5
|
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 WDATASETSPHERICALHARMONICS_H 00026 #define WDATASETSPHERICALHARMONICS_H 00027 00028 #include <string> 00029 #include <vector> 00030 00031 #include "../common/math/WSymmetricSphericalHarmonic.h" 00032 00033 #include "WValueSet.h" 00034 00035 #include "WDataSetSingle.h" 00036 #include "WExportDataHandler.h" 00037 00038 /** 00039 * This data set type contains spherical harmonic coefficients as values. The index scheme is like in the Descoteaux paper "Regularized, Fast, and Robust Analytical Q-Ball Imaging". 00040 * \ingroup dataHandler 00041 */ 00042 class OWDATAHANDLER_EXPORT WDataSetSphericalHarmonics : public WDataSetSingle // NOLINT 00043 { 00044 public: 00045 00046 /** 00047 * Constructs an instance out of an appropriate value set and a grid. 00048 * 00049 * \param newValueSet the value set with the spherical harmonics coefficients to use 00050 * \param newGrid the grid which maps world space to the value set 00051 */ 00052 WDataSetSphericalHarmonics( boost::shared_ptr< WValueSetBase > newValueSet, 00053 boost::shared_ptr< WGrid > newGrid ); 00054 00055 /** 00056 * Construct an empty and unusable instance. This is needed for the prototype mechanism. 00057 */ 00058 WDataSetSphericalHarmonics(); 00059 00060 /** 00061 * Destroys this DataSet instance 00062 */ 00063 virtual ~WDataSetSphericalHarmonics(); 00064 00065 /** 00066 * Creates a copy (clone) of this instance but allows to change the valueset. Unlike copy construction, this is a very useful function if you 00067 * want to keep the dynamic type of your dataset even if you just have a WDataSetSingle. 00068 * 00069 * \param newValueSet the new valueset. 00070 * 00071 * \return the clone 00072 */ 00073 virtual WDataSetSingle::SPtr clone( boost::shared_ptr< WValueSetBase > newValueSet ) const; 00074 00075 /** 00076 * Creates a copy (clone) of this instance but allows to change the grid. Unlike copy construction, this is a very useful function if you 00077 * want to keep the dynamic type of your dataset even if you just have a WDataSetSingle. 00078 * 00079 * \param newGrid the new grid. 00080 * 00081 * \return the clone 00082 */ 00083 virtual WDataSetSingle::SPtr clone( boost::shared_ptr< WGrid > newGrid ) const; 00084 00085 /** 00086 * Creates a copy (clone) of this instance. Unlike copy construction, this is a very useful function if you 00087 * want to keep the dynamic type of your dataset even if you just have a WDataSetSingle. 00088 * 00089 * \return the clone 00090 */ 00091 virtual WDataSetSingle::SPtr clone() const; 00092 00093 /** 00094 * Returns a prototype instantiated with the true type of the deriving class. 00095 * 00096 * \return the prototype. 00097 */ 00098 static boost::shared_ptr< WPrototyped > getPrototype(); 00099 00100 /** 00101 * Interpolates the field of spherical harmonics at the given position 00102 * 00103 * \param pos position to interpolate 00104 * \param success if the position was inside the grid 00105 * 00106 * \return Interpolated spherical harmonic. 00107 */ 00108 WSymmetricSphericalHarmonic interpolate( const WPosition &pos, bool *success ) const; 00109 00110 /** 00111 * Get the spherical harmonic on the given position in value set. 00112 * 00113 * \param index the position where to get the spherical harmonic from 00114 * 00115 * \return the spherical harmonic 00116 */ 00117 WSymmetricSphericalHarmonic getSphericalHarmonicAt( size_t index ) const; 00118 00119 /** 00120 * Gets the name of this prototype. 00121 * 00122 * \return the name. 00123 */ 00124 virtual const std::string getName() const; 00125 00126 /** 00127 * Gets the description for this prototype. 00128 * 00129 * \return the description 00130 */ 00131 virtual const std::string getDescription() const; 00132 00133 /** 00134 * Determines whether this dataset can be used as a texture. 00135 * 00136 * \return true if usable as texture. 00137 */ 00138 virtual bool isTexture() const; 00139 00140 protected: 00141 00142 /** 00143 * The prototype as singleton. 00144 */ 00145 static boost::shared_ptr< WPrototyped > m_prototype; 00146 00147 private: 00148 /** 00149 * The regular 3d grid of the data set. 00150 */ 00151 boost::shared_ptr< WGridRegular3D > m_gridRegular3D; 00152 00153 /** 00154 * The valueset of the data set 00155 */ 00156 boost::shared_ptr< WValueSetBase > m_valueSet; 00157 }; 00158 00159 #endif // WDATASETSPHERICALHARMONICS_H