Xmipp
v3.23.11-Nereus
xmipp
libraries
data
xmipp_polynomials.h
Go to the documentation of this file.
1
/***************************************************************************
2
* Authors: Javier Vargas (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 CORE_POLYNOMIALS_H_
27
#define CORE_POLYNOMIALS_H_
28
29
//#include <core/multidim_array.h>
30
#include "
core/matrix1d.h
"
31
32
template
<
typename
T>
33
class
MultidimArray
;
34
38
// This class performs all the work related with Polynomials. This is a base class
39
class
Polynomials
40
{
41
42
#define COEFFICIENTS(poly) (poly.fittedCoeffs)
43
44
public :
45
// Destructor
46
virtual
~Polynomials
() {}
47
48
//Fitted coefficients
49
Matrix1D<double>
fittedCoeffs
;
50
51
public
:
52
// fitting a surface given by member im using the polynomials
53
virtual
void
fit
(
const
Matrix1D<int>
& coef,
MultidimArray<double>
& im,
const
MultidimArray<double>
&weight,
54
const
MultidimArray<bool>
& ROI,
int
verbose=0)=0;
55
56
protected
:
57
// Create the polynomials
58
virtual
void
create
(
const
Matrix1D<int>
& coef)=0;
59
60
private
:
61
62
};
63
64
//The class PolyZernikes heritage from Polynomials
65
//We follow the Zernike implementation explained in: Efficient Cartesian representation of Zernike polynomials in computer memory
66
//SPIE Vol. 3190 pp. 382
67
class
PolyZernikes
:
public
Polynomials
68
{
69
70
private
:
71
std::vector<Matrix2D<int> > fMatV;
72
73
public
:
74
//Create not really the polynomials, This function creates a set of coefficient matrix that are efficient
75
// to be stored in memory that give us the analytical expression of the polynomials
76
//NOTE: take a look to:
77
//"Efficient Cartesian representation of Zernike polynomials in computer memory
78
//SPIE Vol. 3190 pp. 382 to get more details about the implementation"
79
void
create
(
const
Matrix1D<int>
& coef);
80
//This function obtains the Zernike coefficients from the matrix 1D coeff. This array is formed by zeros and ones.
81
// If the value of one element of coef is
82
void
fit
(
const
Matrix1D<int>
& coef,
MultidimArray<double>
& im,
const
MultidimArray<double>
&weight,
83
const
MultidimArray<bool>
& ROI,
int
verbose=0);
84
//Gives the zernike polynomio of index zerIndex that it is stored in im
85
void
zernikePols(
const
Matrix1D<int>
coef,
MultidimArray<double>
& im,
const
MultidimArray<bool>
& ROI,
int
verbose=0);
86
};
87
88
#endif
/* POLYNOMIALS_H_ */
MultidimArray
Definition:
common_lines.h:35
Polynomials
Definition:
xmipp_polynomials.h:39
Polynomials::create
virtual void create(const Matrix1D< int > &coef)=0
Polynomials::fittedCoeffs
Matrix1D< double > fittedCoeffs
Definition:
xmipp_polynomials.h:49
matrix1d.h
Polynomials::fit
virtual void fit(const Matrix1D< int > &coef, MultidimArray< double > &im, const MultidimArray< double > &weight, const MultidimArray< bool > &ROI, int verbose=0)=0
Polynomials::~Polynomials
virtual ~Polynomials()
Definition:
xmipp_polynomials.h:46
Matrix1D< double >
PolyZernikes
Definition:
xmipp_polynomials.h:67
Generated by
1.8.13