Xmipp  v3.23.11-Nereus
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 
40 {
41 public:
53  bool quiet;
55  double max_shift;
58 public:
59  // Real part of the Fourier transform
61  // Imaginary part of the Fourier transform
63  // Weighting mask in Fourier space
65  // Weighting mask in Real space
67 public:
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. */
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
118  // Y dimension of the input real part of the DFT volume
120  // Z dimension of the input real part of the DFT volume
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
130  // Y dimension of the input imaginary part of the DFT volume
132  // Z dimension of the input imaginary part of the DFT volume
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
142  // Y dimension of the input real part of the DFT image
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
152  // Y dimension of the input imaginary part of the DFT image
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
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
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
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. */
190  // X dimension of the outputParameters matrix
192  // Y dimension of the outputParameters matrix
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
206 
207  /* Number of iterations performed. */
209  /* Number of successful iterations */
211  /* Number of failed iterations. */
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
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
229  // Y dimension of the interpolated section
231  // Z dimension of the interpolated section (should be 2)
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. */
239  /* Maximum number of iterations allowed. */
240  long MaxNoIter;
241  /* Maximum number of failures allowed. */
243  /* Maximum number of successes allowed. */
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. */
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. */
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. */
258 };
260 #endif
void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
Definition: mask.h:360
void defineParams()
Define parameters.
double CSTSplineAssignment(MultidimArray< double > &ReDFTVolume, MultidimArray< double > &ImDFTVolume, MultidimArray< double > &image, MultidimArray< double > &weight, Matrix1D< double > &pose_parameters, int max_no_iter=60)
MultidimArray< double > imDFTVolume
void readParams()
Read argument from command line.
MultidimArray< double > reDFTVolume
ProgAngularContinuousAssign()
Empty constructor.