Xmipp  v3.23.11-Nereus
spherical_harmonics.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Authors: AUTHOR_NAME (jvargas@cnb.csic.es)
3  *
4  *
5  * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20  * 02111-1307 USA
21  *
22  * All comments concerning this program package may be sent to the
23  * e-mail address 'xmipp@cnb.csic.es'
24  ***************************************************************************/
25 
26 #ifndef SPHERICAL_HARMONICS_H_
27 #define SPHERICAL_HARMONICS_H_
28 
30 
31 #include <core/multidim_array.h>
32 #include <core/matrix2d.h>
33 //#include "../../../kk/gsl-1.16/gsl/gsl_sf_gegenbauer.h"
34 
35 # define pi 3.14159265358979323846 /* pi */
36 # define sampling 100;
37 
38 #endif /* SPHERICAL_HARMONICS_H_ */
39 
43 //Spherical harmonics (SH) as defined by Guan Koay in "A signal transformational
44 //framework for breaking the noise floor and its applications in MRI".
45 //he obtained Spherical harmonics are real and orthonormal. Theta is zenith angle and varphi is azimuthal angle, as defined in
46 // physics space
48 {
49 private:
50 
51  bool save;
52 
53 public:
54 
55  void shPols(int degree, MultidimArray<double> & im, int verbose=0);
56 
57  inline double shPols(int degree, int m, double theta,double varphi);
58 
59 private:
60 
61 
62  //We store it as double because there is a lot of division between factorials in the
63  // SH implementation
64  inline double factorial(size_t n)
65  {
66  double f=1;
67 
68  for (size_t var = 1; var <= n; var++)
69  f *= var;
70 
71  return f;
72  }
73 
74 public:
75 
76  PolySphericalHarmonics(bool doSave=false)
77  {
78  save = doSave;
79  }
80 
81 };
83 
84 
85 
void shPols(int degree, MultidimArray< double > &im, int verbose=0)
PolySphericalHarmonics(bool doSave=false)
double theta
double * f
int m
int * n