Xmipp  v3.23.11-Nereus
basis.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 _CORE_BASIS_HH
27 #define _CORE_BASIS_HH
28 
29 #include "blobs.h"
30 #include "splines.h"
31 #include "xmipp_image_over.h"
32 #include <core/xmipp_program.h>
33 
34 const int BLOB_SUBSAMPLING = 10;
35 const int PIXEL_SUBSAMPLING = 1;
36 const int SPLINE_SUBSAMPLING = 1;
37 
45 class Basis
46 {
47 public:
49  typedef enum {blobs, voxels, splines} tBasisFunction;
50 
52  tBasisFunction type;
53 
55  MultidimArray<double> *VolPSF; // If NULL then standard blob is used
56 
58  double Tm;
59 
61  struct blobtype blob;
62 
65 
69 
72 
75 
77  double sum_on_grid;
78 
81 
82 public:
84  Basis();
85 
87  void setDefault();
88 
90  String basisName() const;
91 
97  void read(int argc, char **argv);
98 
101  void read(const FileName &fn);
102 
105  static void defineParams(XmippProgram * program, const char* prefix=NULL, const char* comment=NULL);
106 
109  void readParams(XmippProgram * program);
110 
113  void produceSideInfo(const Grid &grid);
114 
116  friend std::ostream & operator << (std::ostream &out, const Basis &basis);
117 
119  void setSamplingRate(double _Tm);
120 
124  {
125  D = _D;
126  }
127 
131  double maxLength() const;
132 
138  void changeToVoxels(GridVolume &vol_basis, MultidimArray<double> *vol_voxels,
139  int Zdim, int Ydim, int Xdim, int threads = 1 ) const;
140 
145  void changeFromVoxels(const MultidimArray<double> &vol_voxels,
146  GridVolume &vol_basis, int grid_type, double grid_relative_size,
147  const MultidimArray<double> *vol_mask,
148  const Matrix2D<double> *D, double R,int threads=1) const;
149 
151  double valueAt(const Matrix1D<double> &r) const;
152 
154  double projectionAt(const Matrix1D<double> &u, const Matrix1D<double> &r)
155  const;
156 };
157 
162 void createZernike3DBasis(const MultidimArray<double> &Vin, MultidimArray<double> &Vbasis, int l1, int n, int l2, int m, int Rmax=-1);
164 #endif
void createZernike3DBasis(const MultidimArray< double > &Vin, MultidimArray< double > &Vbasis, int l1, int n, int l2, int m, int Rmax=-1)
Definition: basis.cpp:406
double projectionAt(const Matrix1D< double > &u, const Matrix1D< double > &r) const
Definition: basis.cpp:367
double grid_relative_size
Relative size for the grid.
Definition: basis.h:64
Basis()
Empty constructor. By default, blobs.
Definition: basis.cpp:30
void changeFromVoxels(const MultidimArray< double > &vol_voxels, GridVolume &vol_basis, int grid_type, double grid_relative_size, const MultidimArray< double > *vol_mask, const Matrix2D< double > *D, double R, int threads=1) const
Definition: basis.cpp:292
double sum_on_grid
Sum of the basis on the grid points.
Definition: basis.h:77
void read(int argc, char **argv)
struct blobtype blob
Blob parameters.
Definition: basis.h:61
tBasisFunction type
Basis function to use.
Definition: basis.h:52
Definition: grids.h:479
double maxLength() const
Definition: basis.cpp:242
ImageOver blobprint2
Square of the footprint.
Definition: basis.h:74
void setDefault()
Default values.
Definition: basis.cpp:36
Matrix2D< double > * D
Definition: basis.h:68
void changeToVoxels(GridVolume &vol_basis, MultidimArray< double > *vol_voxels, int Zdim, int Ydim, int Xdim, int threads=1) const
Definition: basis.cpp:261
MultidimArray< double > * VolPSF
Footprint is convolved with a volume PSF // At this moment only used with blobs.
Definition: basis.h:55
Definition: basis.h:45
double Tm
Sampling rate.
Definition: basis.h:58
String basisName() const
Basis name.
Definition: basis.cpp:50
Matrix1D< double > aux
Auxiliary vector for projections.
Definition: basis.h:80
double valueAt(const Matrix1D< double > &r) const
Definition: basis.cpp:332
int m
void produceSideInfo(const Grid &grid)
Definition: basis.cpp:162
void setD(Matrix2D< double > *_D)
Definition: basis.h:123
std::string String
Definition: xmipp_strings.h:34
static void defineParams(XmippProgram *program, const char *prefix=NULL, const char *comment=NULL)
Definition: basis.cpp:69
const int SPLINE_SUBSAMPLING
Definition: basis.h:36
doublereal * u
const int BLOB_SUBSAMPLING
Definition: basis.h:34
const int PIXEL_SUBSAMPLING
Definition: basis.h:35
void readParams(XmippProgram *program)
Definition: basis.cpp:100
tBasisFunction
Type of basis function.
Definition: basis.h:49
int * n
friend std::ostream & operator<<(std::ostream &out, const Basis &basis)
Show.
Definition: basis.cpp:223
ImageOver blobprint
Blob footprint.
Definition: basis.h:71
void setSamplingRate(double _Tm)
Definition: basis.cpp:153