Xmipp
v3.23.11-Nereus
xmipp
libraries
reconstruction
art_zernike3d.h
Go to the documentation of this file.
1
/***************************************************************************
2
*
3
* Authors: David Herreros Calero dherreros@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
27
#ifndef _PROG_ART_ZERNIKE3D
28
#define _PROG_ART_ZERNIKE3D
29
30
#include <
core/xmipp_metadata_program.h
>
31
#include <
core/matrix1d.h
>
32
#include <
core/xmipp_image.h
>
33
#include <
data/fourier_filter.h
>
34
#include <
data/fourier_projection.h
>
35
#include <
core/xmipp_error.h
>
36
37
39
class
ProgArtZernike3D
:
public
XmippMetadataProgram
40
{
41
public
:
43
FileName
fnVolR
;
45
FileName
fnVolO
;
47
FileName
fnOutDir
;
49
int
L1
,
L2
;
51
Matrix1D<int>
vL1
,
vN
,
vL2
,
vM
;
53
double
Ts
;
55
int
RmaxDef
;
56
// Phase Flipped
57
bool
phaseFlipped
;
58
// Ignore CTF
59
bool
ignoreCTF
;
60
// Regularization ART
61
float
lambda
;
62
// Save each # iter
63
int
save_iter
;
64
// Correct CTF
65
bool
useCTF
;
66
// Apply Zernike
67
bool
useZernike
;
68
// Flag for enable/disabled image
69
int
flagEnabled
;
70
71
public
:
73
bool
resume
;
74
// Number of ART iterations
75
int
niter
;
76
// Sort last N projections
77
int
sort_last_N
;
78
// 2D and 3D masks in real space
79
MultidimArray<int>
mask2D
;
80
// Volume size
81
int
Xdim
;
82
// Input image
83
Image<float>
V
,
Vrefined
,
Ifilteredp
;
84
// INput image
85
Image<double>
I
;
86
// Spherical mask
87
MultidimArray<int>
Vmask
;
88
// Theoretical projection
89
Image<float>
P
;
90
// Weight Image
91
Image<float>
W
;
92
// Difference Image
93
Image<float>
Idiff
;
94
// Transformation matrix
95
Matrix2D<float>
A
;
96
// Original angles
97
float
rot
,
tilt
,
psi
;
98
// Original shift
99
float
shiftX
,
shiftY
;
100
// Original flip
101
bool
flip
;
102
// CTF Check
103
bool
hasCTF
;
104
// Original defocus
105
float
defocusU
,
defocusV
,
defocusAngle
;
106
// CTF
107
CTFDescription
ctf
;
108
// CTF filter
109
FourierFilter
FilterCTF
;
110
// Vector Size
111
int
vecSize
;
112
// Vector containing the degree of the spherical harmonics
113
Matrix1D<float>
clnm
;
114
// Show optimization
115
bool
showOptimization
;
116
// Row ids ordered in a orthogonal fashion
117
MultidimArray<size_t>
ordered_list
;
118
// Save iter counter
119
int
current_save_iter
;
120
// Image counter
121
int
num_images
;
122
// Current ART iteration
123
int
current_iter
;
124
// Volume dimensions
125
int
initX
,
endX
,
initY
,
endY
,
initZ
,
endZ
;
126
public
:
128
ProgArtZernike3D
();
129
131
void
readParams
();
132
134
void
show
();
135
137
void
defineParams
();
138
141
void
preProcess
();
142
146
void
processImage
(
const
FileName
&fnImg,
const
FileName
&fnImgOut,
const
MDRow
&rowIn,
MDRow
&rowOut);
147
149
void
numCoefficients
(
int
l1,
int
l2);
150
152
void
fillVectorTerms
(
int
l1,
int
l2);
153
155
void
deformVol
(
MultidimArray<float>
&mP,
MultidimArray<float>
&mW,
156
const
MultidimArray<float>
&mV,
157
float
rot,
float
tilt,
float
psi);
158
159
private
:
160
enum class
Direction { Forward, Backward };
161
162
// ART algorithm
163
template
<Direction DIRECTION>
164
void
artModel();
165
166
// Apply Zernike codeformation
167
template
<
bool
USESZERNIKE, Direction DIRECTION>
168
void
zernikeModel();
169
170
// Interpolation weights + interpolation in 3D
171
template
<
bool
INTERPOLATE>
172
float
weightsInterpolation3D(
float
x
,
float
y
,
float
z
, std::array<float, 8> &
w
);
173
174
// Remove overdeformation from coefficients
175
void
removeOverdeformation();
176
177
virtual
void
finishProcessing();
178
179
virtual
void
run();
180
181
// Sort images in an orthogonal fashion
182
void
sortOrthogonal();
183
184
};
186
#endif
ProgArtZernike3D::useCTF
bool useCTF
Definition:
art_zernike3d.h:65
ProgArtZernike3D
Definition:
art_zernike3d.h:39
ProgArtZernike3D::flip
bool flip
Definition:
art_zernike3d.h:101
ProgArtZernike3D::show
void show()
Show.
Definition:
art_zernike3d.cpp:66
ProgArtZernike3D::P
Image< float > P
Definition:
art_zernike3d.h:89
MultidimArray< int >
ProgArtZernike3D::endX
int endX
Definition:
art_zernike3d.h:125
ProgArtZernike3D::defineParams
void defineParams()
Define parameters.
Definition:
art_zernike3d.cpp:88
ProgArtZernike3D::mask2D
MultidimArray< int > mask2D
Definition:
art_zernike3d.h:79
xmipp_metadata_program.h
ProgArtZernike3D::readParams
void readParams()
Read argument from command line.
Definition:
art_zernike3d.cpp:44
ProgArtZernike3D::niter
int niter
Definition:
art_zernike3d.h:75
ProgArtZernike3D::defocusAngle
float defocusAngle
Definition:
art_zernike3d.h:105
y
static double * y
Definition:
numerical_recipes.cpp:8487
ProgArtZernike3D::vN
Matrix1D< int > vN
Definition:
art_zernike3d.h:51
ProgArtZernike3D::endY
int endY
Definition:
art_zernike3d.h:125
ProgArtZernike3D::tilt
float tilt
Definition:
art_zernike3d.h:97
ProgArtZernike3D::endZ
int endZ
Definition:
art_zernike3d.h:125
w
doublereal * w
Definition:
numerical_recipes.cpp:2477
ProgArtZernike3D::initZ
int initZ
Definition:
art_zernike3d.h:125
ProgArtZernike3D::showOptimization
bool showOptimization
Definition:
art_zernike3d.h:115
ProgArtZernike3D::I
Image< double > I
Definition:
art_zernike3d.h:85
ProgArtZernike3D::preProcess
void preProcess()
Definition:
art_zernike3d.cpp:117
FileName
Definition:
xmipp_filename.h:65
ProgArtZernike3D::num_images
int num_images
Definition:
art_zernike3d.h:121
x
doublereal * x
Definition:
numerical_recipes.cpp:2230
ProgArtZernike3D::fnOutDir
FileName fnOutDir
Output directory.
Definition:
art_zernike3d.h:47
ProgArtZernike3D::defocusV
float defocusV
Definition:
art_zernike3d.h:105
ProgArtZernike3D::ordered_list
MultidimArray< size_t > ordered_list
Definition:
art_zernike3d.h:117
ProgArtZernike3D::psi
float psi
Definition:
art_zernike3d.h:97
ProgArtZernike3D::Idiff
Image< float > Idiff
Definition:
art_zernike3d.h:93
ProgArtZernike3D::ignoreCTF
bool ignoreCTF
Definition:
art_zernike3d.h:59
ProgArtZernike3D::RmaxDef
int RmaxDef
Definition:
art_zernike3d.h:55
Matrix2D< float >
ProgArtZernike3D::vL2
Matrix1D< int > vL2
Definition:
art_zernike3d.h:51
xmipp_image.h
ProgArtZernike3D::FilterCTF
FourierFilter FilterCTF
Definition:
art_zernike3d.h:109
ProgArtZernike3D::initX
int initX
Definition:
art_zernike3d.h:125
ProgArtZernike3D::Ts
double Ts
Definition:
art_zernike3d.h:53
ProgArtZernike3D::vM
Matrix1D< int > vM
Definition:
art_zernike3d.h:51
ProgArtZernike3D::hasCTF
bool hasCTF
Definition:
art_zernike3d.h:103
ProgArtZernike3D::Xdim
int Xdim
Definition:
art_zernike3d.h:81
ProgArtZernike3D::Vmask
MultidimArray< int > Vmask
Definition:
art_zernike3d.h:87
fourier_filter.h
ProgArtZernike3D::lambda
float lambda
Definition:
art_zernike3d.h:61
ProgArtZernike3D::ProgArtZernike3D
ProgArtZernike3D()
Empty constructor.
Definition:
art_zernike3d.cpp:35
matrix1d.h
ProgArtZernike3D::processImage
void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
Definition:
art_zernike3d.cpp:196
ProgArtZernike3D::clnm
Matrix1D< float > clnm
Definition:
art_zernike3d.h:113
ProgArtZernike3D::phaseFlipped
bool phaseFlipped
Definition:
art_zernike3d.h:57
CTFDescription
Definition:
ctf.h:782
z
double z
Definition:
numerical_recipes.cpp:8490
ProgArtZernike3D::ctf
CTFDescription ctf
Definition:
art_zernike3d.h:107
ProgArtZernike3D::rot
float rot
Definition:
art_zernike3d.h:97
ProgArtZernike3D::W
Image< float > W
Definition:
art_zernike3d.h:91
ProgArtZernike3D::V
Image< float > V
Definition:
art_zernike3d.h:83
ProgArtZernike3D::sort_last_N
int sort_last_N
Definition:
art_zernike3d.h:77
ProgArtZernike3D::Vrefined
Image< float > Vrefined
Definition:
art_zernike3d.h:83
ProgArtZernike3D::save_iter
int save_iter
Definition:
art_zernike3d.h:63
ProgArtZernike3D::shiftY
float shiftY
Definition:
art_zernike3d.h:99
fourier_projection.h
ProgArtZernike3D::A
Matrix2D< float > A
Definition:
art_zernike3d.h:95
ProgArtZernike3D::flagEnabled
int flagEnabled
Definition:
art_zernike3d.h:69
ProgArtZernike3D::Ifilteredp
Image< float > Ifilteredp
Definition:
art_zernike3d.h:83
ProgArtZernike3D::current_iter
int current_iter
Definition:
art_zernike3d.h:123
ProgArtZernike3D::fnVolO
FileName fnVolO
Definition:
art_zernike3d.h:45
ProgArtZernike3D::defocusU
float defocusU
Definition:
art_zernike3d.h:105
XmippMetadataProgram
Definition:
xmipp_metadata_program.h:44
Matrix1D< int >
Image< float >
ProgArtZernike3D::useZernike
bool useZernike
Definition:
art_zernike3d.h:67
ProgArtZernike3D::fnVolR
FileName fnVolR
Definition:
art_zernike3d.h:43
FourierFilter
Definition:
fourier_filter.h:69
ProgArtZernike3D::shiftX
float shiftX
Definition:
art_zernike3d.h:99
ProgArtZernike3D::initY
int initY
Definition:
art_zernike3d.h:125
MDRow
Definition:
metadata_row_base.h:53
xmipp_error.h
ProgArtZernike3D::L2
int L2
Definition:
art_zernike3d.h:49
ProgArtZernike3D::vL1
Matrix1D< int > vL1
Definition:
art_zernike3d.h:51
ProgArtZernike3D::numCoefficients
void numCoefficients(int l1, int l2)
Length of coefficients vector.
Definition:
art_zernike3d.cpp:247
ProgArtZernike3D::L1
int L1
Definition:
art_zernike3d.h:49
ProgArtZernike3D::vecSize
int vecSize
Definition:
art_zernike3d.h:111
ProgArtZernike3D::fillVectorTerms
void fillVectorTerms(int l1, int l2)
Zernike and SPH coefficients allocation.
Definition:
art_zernike3d.cpp:263
ProgArtZernike3D::deformVol
void deformVol(MultidimArray< float > &mP, MultidimArray< float > &mW, const MultidimArray< float > &mV, float rot, float tilt, float psi)
Deform a volumen using Zernike-Spherical harmonic basis.
ProgArtZernike3D::resume
bool resume
Definition:
art_zernike3d.h:73
ProgArtZernike3D::current_save_iter
int current_save_iter
Definition:
art_zernike3d.h:119
Generated by
1.8.13