Xmipp
v3.23.11-Nereus
xmipp
libraries
reconstruction
angular_continuous_assign.h
Go to the documentation of this file.
1
/***************************************************************************
2
*
3
* Authors: Slavica Jonic slavica.jonic@epfl.ch (2004)
4
* Carlos Oscar coss@cnb.csic.es
5
*
6
* Biomedical Imaging Group, EPFL.
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21
* 02111-1307 USA
22
*
23
* All comments concerning this program package may be sent to the
24
* e-mail address 'xmipp@cnb.csic.es'
25
***************************************************************************/
26
27
#ifndef _PROG_ANGULAR_PREDICT_CONTINOUOS
28
#define _PROG_ANGULAR_PREDICT_CONTINUOUS
29
30
#include <
core/xmipp_program.h
>
31
#include <
core/xmipp_image.h
>
32
#include <
data/mask.h
>
33
#include <memory>
34
39
class
ProgAngularContinuousAssign
:
public
XmippMetadataProgram
40
{
41
public
:
43
FileName
fn_ref
;
45
double
gaussian_DFT_sigma
;
47
double
gaussian_Real_sigma
;
49
double
weight_zero_freq
;
51
int
max_no_iter
;
53
bool
quiet
;
55
double
max_shift
;
57
double
max_angular_change
;
58
public
:
59
// Real part of the Fourier transform
60
MultidimArray<double>
reDFTVolume
;
61
// Imaginary part of the Fourier transform
62
MultidimArray<double>
imDFTVolume
;
63
// Weighting mask in Fourier space
64
Mask
mask_Fourier
;
65
// Weighting mask in Real space
66
Mask
mask_Real
;
67
public
:
69
ProgAngularContinuousAssign
();
70
72
void
readParams
();
73
75
void
show
();
76
78
void
defineParams
();
79
82
void
preProcess
();
83
87
void
processImage
(
const
FileName
&fnImg,
const
FileName
&fnImgOut,
const
MDRow
&rowIn,
MDRow
&rowOut);
88
};
89
97
double
CSTSplineAssignment
(
98
MultidimArray<double>
&ReDFTVolume,
99
MultidimArray<double>
&ImDFTVolume,
100
MultidimArray<double>
&image,
101
MultidimArray<double>
&weight,
102
Matrix1D<double>
&pose_parameters,
103
int
max_no_iter
= 60
104
);
105
106
/* Data structure for Continuous Angular assignment.
107
All output vectors, matrices, volumes, ... must be previously
108
allocated by the caller. */
109
struct
cstregistrationStruct
110
{
111
/* Real part of the DFT of the volume.
112
The size must be given in the fields:
113
nx_ReDftVolume, ny_ReDftVolume and nz_ReDftVolume.of this structure.
114
*/
115
double
*
ReDftVolume
;
116
// X dimension of the input real part of the DFT volume
117
long
nx_ReDftVolume
;
118
// Y dimension of the input real part of the DFT volume
119
long
ny_ReDftVolume
;
120
// Z dimension of the input real part of the DFT volume
121
long
nz_ReDftVolume
;
122
123
/* Imaginary part of the DFT of the volume.
124
The size must be given in the fields:
125
nx_ImDftVolume, ny_ImDftVolume and nz_ImDftVolume.of this structure.
126
*/
127
double
*
ImDftVolume
;
128
// X dimension of the input imaginary part of the DFT volume
129
long
nx_ImDftVolume
;
130
// Y dimension of the input imaginary part of the DFT volume
131
long
ny_ImDftVolume
;
132
// Z dimension of the input imaginary part of the DFT volume
133
long
nz_ImDftVolume
;
134
135
/* Real part of the DFT of the image.
136
The size must be given in the fields:
137
nx_ReDftImage and ny_ReDftImage of this structure.
138
*/
139
double
*
ReDftImage
;
140
// X dimension of the input real part of the DFT image
141
long
nx_ReDftImage
;
142
// Y dimension of the input real part of the DFT image
143
long
ny_ReDftImage
;
144
145
/* Imaginary part of the DFT of the image.
146
The size must be given in the fields:
147
nx_ReDftImage and ny_ImDftImage.of this structure.
148
*/
149
double
*
ImDftImage
;
150
// X dimension of the input imaginary part of the DFT image
151
long
nx_ImDftImage
;
152
// Y dimension of the input imaginary part of the DFT image
153
long
ny_ImDftImage
;
154
155
/* 2D weighting function in the frequency domain.
156
Normally a gaussian. Its size is given by nx_Weight and ny_Weight
157
in this same structure. */
158
double
*
Weight
;
159
// X dimension of the weight in frequency
160
long
nx_Weight
;
161
// Y dimension of the weight in frequency
162
long
ny_Weight
;
163
164
/* Vector with the voxel size in physical units (A/pix) in each direction.
165
Its length is given by nx_VoxelSize. Normally it is 3. */
166
double
*
VoxelSize
;
167
// Length of the VoxelSize vector
168
long
nx_VoxelSize
;
169
170
/* Vector with the pixel size in physical units (A/pix) in each direction.
171
Its length is given by nx_PixelSize. Normally it is 2 */
172
double
*
PixelSize
;
173
// Length of the PixelSize vector
174
long
nx_PixelSize
;
175
176
/* Initial pose parameters.
177
Vector with the initial pose (rot,tilt,psi,X shift, Y shift).
178
Its length (5) must be set in nx_Parameters. */
179
double
*
Parameters
;
180
// Length of the initial pose parameters vector
181
long
nx_Parameters
;
182
183
/* Final pose parameters.
184
This is a matrix whose columns are the different pose parameters
185
after each iteration of the optimization. Column 0 is the pose at time 0,
186
column 1 is the pose at time 1, ... The order in the column is
187
(rot,tilt,psi,shift x,shift y). The size of the matrix is given by
188
nx_OutputParameters and ny_OutputParameters. */
189
double
*
OutputParameters
;
190
// X dimension of the outputParameters matrix
191
long
nx_OutputParameters
;
192
// Y dimension of the outputParameters matrix
193
long
ny_OutputParameters
;
194
195
/* Vector with the cost function at each iteration.
196
Its size is nx_Cost */
197
double
*
Cost
;
198
// Size of the vector Cost
199
long
nx_Cost
;
200
201
/* Vector with the time consumed at each iteration.
202
Its size is nx_TimePerIter */
203
double
*
TimePerIter
;
204
// Size of TimePerIter
205
long
nx_TimePerIter
;
206
207
/* Number of iterations performed. */
208
long
*
NumberIterPerformed
;
209
/* Number of successful iterations */
210
long
*
NumberSuccPerformed
;
211
/* Number of failed iterations. */
212
long
*
NumberFailPerformed
;
213
214
/* Vector with the number of the failed iterations.
215
Its size should be the maximum number of iterations. Normally
216
all values are 0s except at those iterations where it failed.
217
*/
218
double
*
Failures
;
219
// Size of the Failures vector
220
long
nx_Failures
;
221
222
/* Interpolated section of the Fourier volume.
223
It is a two slice volume. The first slice is the real part and
224
the second slice the imaginary part. No */
225
double
*
dftProj
;
226
227
// X dimension of the interpolated section
228
long
nx_dftProj
;
229
// Y dimension of the interpolated section
230
long
ny_dftProj
;
231
// Z dimension of the interpolated section (should be 2)
232
long
nz_dftProj
;
233
234
/* Scaling factor for changing the parameter lambda in the LM optimizer.
235
If a success/failure occurs, lambda is changed by this factor. */
236
double
ScaleLambda
;
237
/* Initial lambda. */
238
double
LambdaInitial
;
239
/* Maximum number of iterations allowed. */
240
long
MaxNoIter
;
241
/* Maximum number of failures allowed. */
242
long
MaxNoFailure
;
243
/* Maximum number of successes allowed. */
244
long
SatisfNoSuccess
;
245
/* Project or Refine.
246
If this variable is 0, the routine refines the angles.
247
If it is 1, it simply interpolates the central section slice,
248
with the initial pose parameters. */
249
long
MakeDesiredProj
;
250
/* Tolerance in the angle to accept a certain solution.
251
If the angular parameters change less than this value,
252
the optimizer will stop. */
253
double
ToleranceAngle
;
254
/* Tolerance in the shift to accept a certain solution.
255
If the shift parameters change less than this value,
256
the optimizer will stop. */
257
double
ToleranceShift
;
258
};
260
#endif
cstregistrationStruct::nx_Parameters
long nx_Parameters
Definition:
angular_continuous_assign.h:181
ProgAngularContinuousAssign::fn_ref
FileName fn_ref
Definition:
angular_continuous_assign.h:43
cstregistrationStruct::ToleranceShift
double ToleranceShift
Definition:
angular_continuous_assign.h:257
cstregistrationStruct::nx_ImDftImage
long nx_ImDftImage
Definition:
angular_continuous_assign.h:151
cstregistrationStruct::ny_ImDftImage
long ny_ImDftImage
Definition:
angular_continuous_assign.h:153
ProgAngularContinuousAssign::processImage
void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
Definition:
angular_continuous_assign.cpp:191
MultidimArray< double >
cstregistrationStruct::NumberSuccPerformed
long * NumberSuccPerformed
Definition:
angular_continuous_assign.h:210
ProgAngularContinuousAssign
Definition:
angular_continuous_assign.h:39
ProgAngularContinuousAssign::quiet
bool quiet
Definition:
angular_continuous_assign.h:53
cstregistrationStruct::nx_TimePerIter
long nx_TimePerIter
Definition:
angular_continuous_assign.h:205
cstregistrationStruct::nx_Weight
long nx_Weight
Definition:
angular_continuous_assign.h:160
Mask
Definition:
mask.h:360
cstregistrationStruct::ReDftVolume
double * ReDftVolume
Definition:
angular_continuous_assign.h:115
mask.h
cstregistrationStruct::PixelSize
double * PixelSize
Definition:
angular_continuous_assign.h:172
cstregistrationStruct::ToleranceAngle
double ToleranceAngle
Definition:
angular_continuous_assign.h:253
cstregistrationStruct::ImDftVolume
double * ImDftVolume
Definition:
angular_continuous_assign.h:127
ProgAngularContinuousAssign::defineParams
void defineParams()
Define parameters.
Definition:
angular_continuous_assign.cpp:86
cstregistrationStruct::nx_PixelSize
long nx_PixelSize
Definition:
angular_continuous_assign.h:174
ProgAngularContinuousAssign::max_angular_change
double max_angular_change
Definition:
angular_continuous_assign.h:57
cstregistrationStruct::nx_Cost
long nx_Cost
Definition:
angular_continuous_assign.h:199
CSTSplineAssignment
double CSTSplineAssignment(MultidimArray< double > &ReDFTVolume, MultidimArray< double > &ImDFTVolume, MultidimArray< double > &image, MultidimArray< double > &weight, Matrix1D< double > &pose_parameters, int max_no_iter=60)
Definition:
angular_continuous_assign.cpp:256
ProgAngularContinuousAssign::max_shift
double max_shift
Definition:
angular_continuous_assign.h:55
FileName
Definition:
xmipp_filename.h:65
cstregistrationStruct::Cost
double * Cost
Definition:
angular_continuous_assign.h:197
cstregistrationStruct::nx_ReDftImage
long nx_ReDftImage
Definition:
angular_continuous_assign.h:141
ProgAngularContinuousAssign::imDFTVolume
MultidimArray< double > imDFTVolume
Definition:
angular_continuous_assign.h:62
cstregistrationStruct::nx_VoxelSize
long nx_VoxelSize
Definition:
angular_continuous_assign.h:168
cstregistrationStruct::nx_ImDftVolume
long nx_ImDftVolume
Definition:
angular_continuous_assign.h:129
cstregistrationStruct::ReDftImage
double * ReDftImage
Definition:
angular_continuous_assign.h:139
xmipp_image.h
cstregistrationStruct::Parameters
double * Parameters
Definition:
angular_continuous_assign.h:179
ProgAngularContinuousAssign::preProcess
void preProcess()
Definition:
angular_continuous_assign.cpp:134
cstregistrationStruct::ScaleLambda
double ScaleLambda
Definition:
angular_continuous_assign.h:236
cstregistrationStruct::nx_dftProj
long nx_dftProj
Definition:
angular_continuous_assign.h:228
cstregistrationStruct::Failures
double * Failures
Definition:
angular_continuous_assign.h:218
cstregistrationStruct::MaxNoFailure
long MaxNoFailure
Definition:
angular_continuous_assign.h:242
cstregistrationStruct::LambdaInitial
double LambdaInitial
Definition:
angular_continuous_assign.h:238
ProgAngularContinuousAssign::readParams
void readParams()
Read argument from command line.
Definition:
angular_continuous_assign.cpp:57
xmipp_program.h
cstregistrationStruct::nx_ReDftVolume
long nx_ReDftVolume
Definition:
angular_continuous_assign.h:117
cstregistrationStruct::MakeDesiredProj
long MakeDesiredProj
Definition:
angular_continuous_assign.h:249
cstregistrationStruct::Weight
double * Weight
Definition:
angular_continuous_assign.h:158
cstregistrationStruct::ny_ReDftImage
long ny_ReDftImage
Definition:
angular_continuous_assign.h:143
cstregistrationStruct::nz_dftProj
long nz_dftProj
Definition:
angular_continuous_assign.h:232
cstregistrationStruct::ny_dftProj
long ny_dftProj
Definition:
angular_continuous_assign.h:230
ProgAngularContinuousAssign::reDFTVolume
MultidimArray< double > reDFTVolume
Definition:
angular_continuous_assign.h:60
cstregistrationStruct::TimePerIter
double * TimePerIter
Definition:
angular_continuous_assign.h:203
cstregistrationStruct::ImDftImage
double * ImDftImage
Definition:
angular_continuous_assign.h:149
cstregistrationStruct::NumberIterPerformed
long * NumberIterPerformed
Definition:
angular_continuous_assign.h:208
cstregistrationStruct::SatisfNoSuccess
long SatisfNoSuccess
Definition:
angular_continuous_assign.h:244
cstregistrationStruct::ny_ImDftVolume
long ny_ImDftVolume
Definition:
angular_continuous_assign.h:131
cstregistrationStruct::nx_Failures
long nx_Failures
Definition:
angular_continuous_assign.h:220
ProgAngularContinuousAssign::gaussian_DFT_sigma
double gaussian_DFT_sigma
Definition:
angular_continuous_assign.h:45
cstregistrationStruct::nz_ImDftVolume
long nz_ImDftVolume
Definition:
angular_continuous_assign.h:133
cstregistrationStruct::ny_Weight
long ny_Weight
Definition:
angular_continuous_assign.h:162
cstregistrationStruct::OutputParameters
double * OutputParameters
Definition:
angular_continuous_assign.h:189
ProgAngularContinuousAssign::mask_Real
Mask mask_Real
Definition:
angular_continuous_assign.h:66
XmippMetadataProgram
Definition:
xmipp_metadata_program.h:44
cstregistrationStruct::dftProj
double * dftProj
Definition:
angular_continuous_assign.h:225
Matrix1D< double >
cstregistrationStruct::nz_ReDftVolume
long nz_ReDftVolume
Definition:
angular_continuous_assign.h:121
cstregistrationStruct::VoxelSize
double * VoxelSize
Definition:
angular_continuous_assign.h:166
ProgAngularContinuousAssign::ProgAngularContinuousAssign
ProgAngularContinuousAssign()
Empty constructor.
Definition:
angular_continuous_assign.cpp:51
cstregistrationStruct::nx_OutputParameters
long nx_OutputParameters
Definition:
angular_continuous_assign.h:191
ProgAngularContinuousAssign::gaussian_Real_sigma
double gaussian_Real_sigma
Definition:
angular_continuous_assign.h:47
ProgAngularContinuousAssign::mask_Fourier
Mask mask_Fourier
Definition:
angular_continuous_assign.h:64
cstregistrationStruct
Definition:
angular_continuous_assign.h:109
cstregistrationStruct::MaxNoIter
long MaxNoIter
Definition:
angular_continuous_assign.h:240
MDRow
Definition:
metadata_row_base.h:53
cstregistrationStruct::ny_OutputParameters
long ny_OutputParameters
Definition:
angular_continuous_assign.h:193
ProgAngularContinuousAssign::weight_zero_freq
double weight_zero_freq
Definition:
angular_continuous_assign.h:49
ProgAngularContinuousAssign::show
void show()
Show.
Definition:
angular_continuous_assign.cpp:70
ProgAngularContinuousAssign::max_no_iter
int max_no_iter
Definition:
angular_continuous_assign.h:51
cstregistrationStruct::ny_ReDftVolume
long ny_ReDftVolume
Definition:
angular_continuous_assign.h:119
cstregistrationStruct::NumberFailPerformed
long * NumberFailPerformed
Definition:
angular_continuous_assign.h:212
Generated by
1.8.13