Xmipp  v3.23.11-Nereus
splines.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Carlos Oscar S. Sorzano (coss@cnb.csic.es)
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 _SPLINES_HH
27 #define _SPLINES_HH
28 
29 #include <core/bilib/kernel.h>
30 
31 #include "grids.h"
32 
33 
34 /* ========================================================================= */
35 /* SPLINES */
36 /* ========================================================================= */
40 // Spline value ------------------------------------------------------------
44 inline double spatial_Bspline03(const Matrix1D<double> &r)
45 {
46  if (-2 <= XX(r) && XX(r) < 2 &&
47  -2 <= YY(r) && YY(r) < 2 &&
48  -2 <= ZZ(r) && ZZ(r) < 2)
49  return Bspline03(XX(r))*Bspline03(YY(r))*Bspline03(ZZ(r));
50  else return 0.0;
51 }
52 
53 const int BSPLINE03_SUBSAMPLING = 2000;
55 double Bspline03LUT(double x);
56 
60 inline double spatial_Bspline03LUT(const Matrix1D<double> &r)
61 {
62  if (-2 <= XX(r) && XX(r) < 2 &&
63  -2 <= YY(r) && YY(r) < 2 &&
64  -2 <= ZZ(r) && ZZ(r) < 2)
65  return Bspline03LUT(XX(r))*Bspline03LUT(YY(r))*Bspline03LUT(ZZ(r));
66  else return 0.0;
67 }
68 
75 double sum_spatial_Bspline03_Grid(const Grid &grid);
76 
77 // Spline projection -------------------------------------------------------
82 
90 void spatial_Bspline032voxels(const GridVolume &vol_splines,
91  MultidimArray<double> *vol_voxels,
92  int Zdim = 0, int Ydim = 0, int Xdim = 0);
94 #endif
double spatial_Bspline03LUT(const Matrix1D< double > &r)
Definition: splines.h:60
double spatial_Bspline03(const Matrix1D< double > &r)
Definition: splines.h:44
Definition: grids.h:479
doublereal * x
#define XX(v)
Definition: matrix1d.h:85
double Bspline03(double Argument)
#define YY(v)
Definition: matrix1d.h:93
const int BSPLINE03_SUBSAMPLING
Definition: splines.h:53
void spatial_Bspline032voxels(const GridVolume &vol_splines, MultidimArray< double > *vol_voxels, int Zdim=0, int Ydim=0, int Xdim=0)
Definition: splines.cpp:386
double sum_spatial_Bspline03_Grid(const Grid &grid)
Definition: splines.cpp:72
doublereal * u
double spatial_Bspline03_proj(const Matrix1D< double > &r, const Matrix1D< double > &u)
Definition: splines.cpp:103
double Bspline03LUT(double x)
Definition: splines.cpp:30
#define ZZ(v)
Definition: matrix1d.h:101