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