Xmipp  v3.23.11-Nereus
ctf_sort_psds.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Carlos Oscar S. Sorzano (coss@cnb.csic.es)
4  * Slavica Jonic (slavica.jonic@impmc.jussieu.fr)
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19  * 02111-1307 USA
20  *
21  * All comments concerning this program package may be sent to the
22  * e-mail address 'xmipp@cnb.csic.es'
23  ***************************************************************************/
24 
25 #include "ctf_sort_psds.h"
26 #include "data/ctf.h"
27 #include "ctf_enhance_psd.h"
28 #include "core/transformations.h"
29 #include "core/histogram.h"
30 #include "core/xmipp_image.h"
32 
33 /* Constructor ------------------------------------------------------------- */
35 {
36  produces_an_output=true;
38  keep_input_columns=true;
39 }
40 
42 {
43  addParamsLine(" [--label+ <image_label=micrograph>] : Label to be used to read/write images.");
44 }
45 
46 /* Read parameters --------------------------------------------------------- */
48 {
50  filter_w1 = getDoubleParam("-f1");
51  filter_w2 = getDoubleParam("-f2");
52  decay_width = getDoubleParam("-decay");
53  mask_w1 = getDoubleParam("-m1");
54  mask_w2 = getDoubleParam("-m2");
55  // COSS downsampling = getDoubleParam("--downsampling");
56 }
57 
58 /* Usage ------------------------------------------------------------------- */
60 {
62  addUsageLine("Evaluate the CTFs and PSDs of a set of micrographs.");
63  addUsageLine("This process is strongly coupled to the output produced by the preprocessing micrographs step of the Xmipp protocols. ");
64  addUsageLine("For each input PSD, the program writes its enhanced version since it is used in the computation of some of the criteria.");
65  addUsageLine("+The different criteria for evaluating the PSDs are:");
66  addUsageLine("+ ");
67  addUsageLine("+$ *Damping*: this is the envelope value at the border of the PSD. Micrographs ");
68  addUsageLine("+with a high envelope value at border are either wrongly estimated strongly undersampled.");
69  addUsageLine("+ ");
70  addUsageLine("+$ *First zero average*: this is average in Angstroms of the first zero. ");
71  addUsageLine("+Normally, this value should be between 4x and 10x the sampling rate in Angstroms.");
72  addUsageLine("+ ");
73  addUsageLine("+$ *Maximum frequency*: this is the resolution (in Angstroms) at which the envelope drops below 1% of the maximum envelope");
74  addUsageLine("+ ");
75  addUsageLine("+$ *First zero disagreement*: if the CTF has been estimated by two different methods ");
76  addUsageLine("+(normally Xmipp and Ctffind), then this criterion measures the average disagreement ");
77  addUsageLine("+in Angstroms between the first zero in the two estimates. Low disagreements are ");
78  addUsageLine("+indicative of correct fit.");
79  addUsageLine("+ ");
80  addUsageLine("+$ *First zero ratio*: this measures the astigmatism of the CTF by computing the ratio ");
81  addUsageLine("+between the largest and smallest axes of the first zero ellipse. Ratios close to 1 ");
82  addUsageLine("+indicate no astigmatism.");
83  addUsageLine("+ ");
84  addUsageLine("+$ *Ratio between the standard deviation at 1st zero and 1st minimum*: the variance in the experimental PSD along the");
85  addUsageLine("+first zero and the first CTF minimum should be approximately equal (ratio=1).");
86  addUsageLine("+ ");
87  addUsageLine("+$ *CTF margin*: ratio between the average difference in the experimental PSD between the 1st Thon");
88  addUsageLine("+ring and its previous zero, and the variance of the experimental PSD along the first zero");
89  addUsageLine("+first zero and the first CTF minimum should be approximately equal (ratio=1).");
90  addUsageLine("+ ");
91  addUsageLine("+$ *Fitting score*: the CTF is computed by fitting a theoretical model to the experimentally observed PSD. ");
92  addUsageLine("+This criterion is the fitting score. Smaller scores correspond to better fits.");
93  addUsageLine("+ ");
94  addUsageLine("+$ *Fitting correlation between zeros 1 and 3*: the region between the first and third zeroes ");
95  addUsageLine("+is particularly important since it is where the Thon rings are most visible. ");
96  addUsageLine("+This criterion reports the correlation between the experimental and theoretical PSDs ");
97  addUsageLine("+within this region. High correlations indicate good fits.");
98  addUsageLine("+ ");
99  addUsageLine("+$ *Non-astigmatic validity*: if we consider the CTF cosine part in the direction U and V ");
100  addUsageLine("+and add both as if they were waves, this criterion shows the frequency (in Angstroms) at which ");
101  addUsageLine("+both waves would interfere completely destructively. Beyond this frequency, it cannot be assumed that ");
102  addUsageLine("+a non-astigmatic CTF correction can manage an astigmatic CTF");
103  addUsageLine("+ ");
104  addUsageLine("+$ *PSD correlation at 90 degrees*: The PSD of non-astigmatic micrographs correlate well ");
105  addUsageLine("+with itself after rotating the micrograph 90 degrees. This is so because non-astigmatic ");
106  addUsageLine("+PSDs are circularly symmetrical, while astigmatic micrographs are elliptically symmetrical.");
107  addUsageLine("+High correlation when rotating 90 degrees is an indicator of non-astigmatism.");
108  addUsageLine("+This criterion is computed on the enhanced PSD. See [[ctf_enhance_psd_v3][ctf_enhance_psd]].");
109  addUsageLine("+ ");
110  addUsageLine("+$ *PSD radial integral*: this criterion reports the integral of the radially symmetrized PSD.");
111  addUsageLine("+This criterion can highlight differences among the background noises of micrographs. ");
112  addUsageLine("+This criterion is computed on the enhanced PSD. See [[ctf_enhance_psd_v3][ctf_enhance_psd]].");
113  addUsageLine("+ ");
114  addUsageLine("+$ *PSD variance*: the PSD is estimated by averaging different PSD local estimates in small regions of the micrograph. ");
115  addUsageLine("+This criterion measures the variance of the different PSD local estimates. Untilted micrographs ");
116  addUsageLine("+have equal defoci all over the micrograph, and therefore, the variance is due only to noise. ");
117  addUsageLine("+However, tilted micrographs have an increased PSD variance since different regions of the micrograph ");
118  addUsageLine("+have different defoci. Low variance of the PSD are indicative of non-tilted micrographs");
119  addUsageLine("+ ");
120  addUsageLine("+$ *PSD Principal Component 1 Variance*: when considering the local PSDs previously defined as vectors ");
121  addUsageLine("+in a multidimensional space, we can compute the variance of their projection onto the first principal component axis. ");
122  addUsageLine("+Low variance of this projection is indicative of a uniformity of local PSDs, i.e., this is another measure ");
123  addUsageLine("+of the presence of tilt in the micrograph.");
124  addUsageLine("+ ");
125  addUsageLine("+$ *PSD !PCA Runs test*: when computing the projections onto the first principal component, as discussed in the previous criterion, ");
126  addUsageLine("+one might expect that the sign of the projection is random for untilted micrographs. Micrographs with a marked ");
127  addUsageLine("+non-random pattern of projections are indicative of tilted micrographs. The larger the value of this criterion, the less random the pattern is.");
128  addParamsLine("==+ Enhancement filter parameters");
129  addParamsLine(" [-f1 <freq_low=0.02>] : Low freq. for band pass filtration, max 0.5");
130  addParamsLine(" [-f2 <freq_high=0.2>] : High freq. for band pass filtration, max 0.5");
131  addParamsLine(" [-decay <freq_decay=0.02>] : Decay for the transition bands");
132  addParamsLine(" [-m1 <mfreq_low=0.01>] : Low freq. for mask, max 0.5");
133  addParamsLine(" [-m2 <mfreq_high=0.45>] : High freq. for mask, max 0.5");
134  // COSS addParamsLine(" [--downsampling <K=1>] : Downsampling factor used");
135 }
136 
137 /* Show -------------------------------------------------------------------- */
139 {
140  if (verbose==0)
141  return;
143  std::cout
144  << "Filter w1: " << filter_w1 << std::endl
145  << "Filter w2: " << filter_w2 << std::endl
146  << "Filter decay: " << decay_width << std::endl
147  << "Mask w1: " << mask_w1 << std::endl
148  << "Mask w2: " << mask_w2 << std::endl ;
149  // COSS << "Downsampling: " << downsampling << std::endl;
150 }
151 
152 /* Compute Correlation ----------------------------------------------------- */
153 void ProgPSDSort::processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
154 {
155  CTFDescription CTF1, CTF2;
156  PSDEvaluation evaluation;
157  FileName fnMicrograph, fnPSD, fnCTF, fnCTF2;
158 
159  evaluation.ctf_envelope_ssnr = fn_in.getDir()+"envelope.xmd";
160 
161  int enabled;
162  rowIn.getValue(MDL_ENABLED,enabled);
163  rowIn.getValue(MDL_MICROGRAPH, fnMicrograph);
164  rowIn.getValue(MDL_PSD,fnPSD);
165  if (enabled==-1 || fnPSD == "NA")
166  {
167  rowOut.setValue(MDL_ENABLED,-1);
168  return;
169  }
170 
171  if (rowIn.containsLabel(MDL_CTF_MODEL))
172  {
173  rowIn.getValue(MDL_CTF_MODEL, fnCTF);
174  if (!fnCTF.exists())
175  {
176  rowOut.setValue(MDL_ENABLED,-1);
177  return;
178  }
179  CTF1.read(fnCTF);
180  }
181  else
182  CTF1.readFromMdRow(rowIn);
183 
184  FileName fnRoot = fnMicrograph.withoutExtension();
185 
186  CTF1.produceSideInfo();
187  evaluation.defocusU=CTF1.DeltafU;
188  evaluation.defocusV=CTF1.DeltafV;
189 
190 
191  if (rowIn.containsLabel(MDL_CTF_MODEL2))
192  rowIn.getValue(MDL_CTF_MODEL2,fnCTF2);
193 
194  if (!fnCTF2.empty() && fnCTF2 != "NA")
195  {
196  CTF2.read(fnCTF2);
197  CTF2.produceSideInfo();
198  }
199 
200  // Evaluate beating due to astigmatism
201  /* The argument of the cosine part of the CTF is: wu=cos(K1*deltafu*u.^2+K2*u.^4)
202  * If there is no astigmatism, then in the V direction we would have wv=cos(K1*deltafv*u.^2+K2*u.^4)
203  * and we should have (wu+wv)/2 = wu.
204  * If there is astigmatism, the sum (wu+wv)/2 will depart from the behavior of wu
205  * http://en.wikipedia.org/wiki/Beat_%28acoustics%29
206  * calling argu and argv the argument of the two waves, we have
207  *
208  * (wu+wv)/2=cos((argu+argv)/2)cos((argu-argv)/2)
209  *
210  * The term cos((argu-argv)/2) acts as an envelope which may even vanish. Let's analyze this envelope
211  * cos(0.5*(K1*deltafu*u.^2+K2*u.^4-K1*deltafv*u.^2+K2*u.^4))=cos(0.5*K1*abs(deltafu-deltafv)*u^2)
212  *
213  * When this envelope is 0, the interference between the two waves is totally destructive (we cannot apply a
214  * non-astigmatic correction to an astigmatic CTF). This happens for
215  *
216  * 0.5*K1*abs(deltafu-deltafv)*u_0^2=pi/2 ---> u_0=sqrt(PI/(K1*abs(deltafu-deltafv)))
217  *
218  * This is the expression of critBeating
219  */
220  evaluation.beating=1.0/sqrt(PI/(CTF1.K1*abs(CTF1.DeltafU-CTF1.DeltafV)));
221 
222  // Read input PSD data
223  Image<double> PSD;
224  PSD.read(fnPSD);
225 
226  // Enhance the PSD
227  ProgCTFEnhancePSD enhancePSD;
228  enhancePSD.filter_w1 = filter_w1;
229  enhancePSD.filter_w2 = filter_w2;
230  enhancePSD.decay_width = decay_width;
231  enhancePSD.mask_w1 = mask_w1;
232  enhancePSD.mask_w2 = mask_w2;
233  enhancePSD.applyFilter(PSD());
234 
235  // Evaluate the radial integral
236  PSD().setXmippOrigin();
237  Matrix1D< int > center_of_rot(2);
238  MultidimArray< double > radial_mean;
239  MultidimArray<int> radial_count;
240  radialAverage(PSD(),center_of_rot,radial_mean,radial_count);
241  radial_mean.selfABS();
242  radial_mean/=radial_mean.computeMax();
243  evaluation.PSDradialIntegral=radial_mean.sum();
244 
245  // Rotate 90 degrees and compute correlation
246  Image<double> PSDrotated;
247  rotate(xmipp_transformation::LINEAR,PSDrotated(),PSD(),90);
248  evaluation.PSDcorrelation90=correlationIndex(PSD(), PSDrotated());
249 
250  // Get the fitting score and other quality criteria computed by ctf_estimate_from_micrograph
251  MetaDataVec MDctf1;
252  MDctf1.read(fnCTF);
253  size_t objId1 = MDctf1.firstRowId();
254 
255 #define GET_CTF_CRITERION(labelll,xxx) \
256  if (rowIn.containsLabel(labelll)) \
257  rowIn.getValue(labelll,xxx); \
258  else if (MDctf1.containsLabel(labelll)) \
259  MDctf1.getValue(labelll,xxx,objId1); \
260  else \
261  xxx=0;
267 
268  // Explore the CTF
269  Matrix1D<double> u(2), freqZero1(2), freqZero2(2), freqMin1(2), pixelZero1(2), pixelMin1(2);
270  double wmax=0.5/CTF1.Tm;
271  double maxModuleZero=0, minModuleZero=1e38;
272  double N=0;
273  evaluation.maxDampingAtBorder=0;
274  evaluation.firstZeroDisagreement=-1;
275  evaluation.firstZeroAvg=0;
276  double firstZeroAvgPSD=0;
277  double firstZeroStddevPSD=0;
278  double firstMinAvgPSD=0;
279  double firstMinStddevPSD=0;
280  double firstZeroMinAvgPSD=0;
281  double firstZeroMinStddevPSD=0;
282  evaluation.maxFreq=1000;
283 
284  CTF1.precomputeValues(0.0,0.0);
285  double idamping0=1.0/CTF1.getValueDampingAt();
286  double f2pixel=CTF1.Tm*XSIZE(PSD()); // COSS *downsampling
287 
289  {
290  double aux;
292  f2pixel*=aux;
293  }
294 
295  MetaDataVec mdEnvelope;
296  Matrix1D< double > envelope(100);
297  envelope.initZeros();
298  double Nalpha = 180;
299  for (double alpha=0; alpha<=PI; alpha+=PI/Nalpha, N++)
300  {
301  VECTOR_R2(u,cos(alpha),sin(alpha));
302 
303  // Get the zero in the direction of u
304  CTF1.lookFor(1, u, freqZero1, 0);
305  double moduleZero=1.0/freqZero1.module();
306  maxModuleZero=XMIPP_MAX(maxModuleZero,moduleZero);
307  minModuleZero=XMIPP_MIN(minModuleZero,moduleZero);
308  evaluation.firstZeroAvg+=moduleZero;
309 
310  // Get the first minimum (it is at higher frequency than the zero)
311  CTF1.lookFor(1, u, freqMin1, -1);
312  pixelZero1=freqZero1*f2pixel;
313  pixelMin1=freqMin1*f2pixel;
314  double psdZero=PSD().interpolatedElement2D(XX(pixelZero1),YY(pixelZero1),0.0);
315  double psdMin=PSD().interpolatedElement2D(XX(pixelMin1),YY(pixelMin1),0.0);
316  firstMinAvgPSD+=psdMin;
317  firstMinStddevPSD+=psdMin*psdMin;
318  firstZeroAvgPSD+=psdZero;
319  firstZeroStddevPSD+=psdZero*psdZero;
320  double zeroMinDiff=psdMin-psdZero;
321  firstZeroMinAvgPSD+=zeroMinDiff;
322  firstZeroMinStddevPSD+=zeroMinDiff*zeroMinDiff;
323 
324  // Evaluate damping
325  double wx=wmax*XX(u);
326  double wy=wmax*YY(u);
327  CTF1.precomputeValues(wx,wy);
328  double damping=CTF1.getValueDampingAt();
329  damping=damping*damping;
330  evaluation.maxDampingAtBorder=XMIPP_MAX(evaluation.maxDampingAtBorder,damping);
331 
332  int idx = 0;
333  for (double w=0; w<wmax; w+=wmax/99.0)
334  {
335  wx=w*XX(u);
336  wy=w*YY(u);
337  CTF1.precomputeValues(wx,wy);
338  double normalizedDamping=fabs(CTF1.getValueDampingAt()*idamping0);
339  if (normalizedDamping>0.1)
340  evaluation.maxFreq=std::min(evaluation.maxFreq,1.0/w);
341 
342  VEC_ELEM(envelope,idx) += double(fabs(CTF1.getValueDampingAt()));
343  idx++;
344  }
345 
346  if (fnCTF2!="") {
347  CTF2.lookFor(1, u, freqZero2, 0);
348  double module2=1.0/freqZero2.module();
349  double diff=ABS(moduleZero-module2);
350  evaluation.firstZeroDisagreement=XMIPP_MAX(evaluation.firstZeroDisagreement,diff);
351  }
352  }
353 
354  int idx=0;
355  for (double w=0; w<wmax; w+=wmax/99.0)
356  {
357  size_t objId2 = mdEnvelope.addObject();
358  mdEnvelope.setValue(MDL_RESOLUTION_FREQ,w,objId2);
359  mdEnvelope.setValue(MDL_CTF_ENVELOPE,VEC_ELEM(envelope,idx)/Nalpha,objId2);
360  idx++;
361  }
362  evaluation.firstZeroAvg/=N;
363  evaluation.firstZeroRatio=maxModuleZero/minModuleZero;
364  firstZeroAvgPSD/=N;
365  firstZeroStddevPSD=sqrt(fabs(firstZeroStddevPSD/N-firstZeroAvgPSD*firstZeroAvgPSD));
366  firstMinAvgPSD/=N;
367  firstMinStddevPSD=sqrt(fabs(firstMinStddevPSD/N-firstMinAvgPSD*firstMinAvgPSD));
368  firstZeroMinAvgPSD/=N;
369  firstZeroMinStddevPSD=sqrt(fabs(firstZeroMinStddevPSD/N-firstZeroMinAvgPSD*firstZeroMinAvgPSD));
370 
371  evaluation.firstMinimumStddev_ZeroStddev=1000;
372  evaluation.firstMinimumDiffStddev_ZeroStddev=1000;
373  if (firstZeroStddevPSD>1e-6)
374  {
375  evaluation.firstMinimumStddev_ZeroStddev=firstMinStddevPSD/firstZeroStddevPSD;
376  evaluation.firstMinimumDiffStddev_ZeroStddev=firstZeroMinAvgPSD/firstZeroStddevPSD;
377  }
378 
379  // Evaluate micrograph normality
380  ImageGeneric M;
381  M.readMapped(fnMicrograph);
382  double avg, stddev, minval, maxval;
383  M().computeStats(avg, stddev, minval, maxval);
384  Histogram1D hist;
385  compute_hist(M(), hist, minval, maxval, 400);
386  hist += 1;
387  hist /= hist.sum();
388 
389  Histogram1D histGaussian;
390  histGaussian.initZeros(hist);
391  histGaussian.hmin=hist.hmin;
392  histGaussian.hmax=hist.hmax;
393  histGaussian.step_size=hist.step_size;
394  histGaussian.istep_size=hist.istep_size;
395  FOR_ALL_ELEMENTS_IN_ARRAY1D(histGaussian) {
396  double x;
397  hist.index2val(i, x);
398  A1D_ELEM(histGaussian,i) = gaussian1D(x, stddev, avg);
399  }
400  evaluation.histogramNormality=0.5*(KLDistance(hist,histGaussian)+
401  KLDistance(histGaussian,hist));
402 
403  // Write criteria
404  rowOut.setValue(MDL_CTF_DEFOCUSU,evaluation.defocusU);
405  rowOut.setValue(MDL_CTF_DEFOCUSV,evaluation.defocusV);
407  rowOut.setValue(MDL_CTF_CRIT_MAXFREQ,evaluation.maxFreq);
409  if (evaluation.firstZeroDisagreement>0)
420  rowOut.setValue(MDL_CTF_CRIT_PSDVARIANCE,evaluation.PSDVariance);
424 
425 
426  //mdEnvelope.write(evaluation.ctf_envelope_ssnr,MD_OVERWRITE);
427  mdEnvelope.write(evaluation.ctf_envelope_ssnr,MD_OVERWRITE);
428  //std::cout << mdEnvelope << std::endl;
429 
430 }
431 
#define VECTOR_R2(v, x, y)
Definition: matrix1d.h:112
double firstZeroAvg
Definition: ctf_sort_psds.h:42
void min(Image< double > &op1, const Image< double > &op2)
#define VEC_ELEM(v, i)
Definition: matrix1d.h:245
Defocus U (Angstroms)
#define XMIPP_MAX(x, y)
Definition: xmipp_macros.h:193
double decay_width
Decay width (raised cosine)
Definition: ctf_sort_psds.h:71
double PSDVariance
Definition: ctf_sort_psds.h:52
double K1
Definition: ctf.h:218
double filter_w2
Bandpass filter high frequency (in Fourier space, max 0.5)
Definition: ctf_sort_psds.h:68
double getDoubleParam(const char *param, int arg=0)
double KLDistance(const Histogram1D &h1, const Histogram1D &h2)
Definition: histogram.cpp:377
double filter_w2
Bandpass filter high frequency (in Fourier space, max 0.5)
void read(const FileName &inFile, const std::vector< MDLabel > *desiredLabels=nullptr, bool decomposeStack=true) override
double histogramNormality
Definition: ctf_sort_psds.h:55
double fittingCorr13
Definition: ctf_sort_psds.h:51
void sqrt(Image< double > &op)
Maximum frequency (in Angstroms) at which non-astigmatic CTF correction is valid. ...
double mask_w1
Lower frequency for the mask (in Fourier space, max 0.5)
double DeltafV
Defocus in V (in Angstroms). Negative values are underfocused.
Definition: ctf.h:830
First zero average (in Angstroms)
double correlationIndex(const MultidimArray< T > &x, const MultidimArray< T > &y, const MultidimArray< int > *mask=NULL, MultidimArray< double > *Contributions=NULL)
#define A1D_ELEM(v, i)
PSD correlation at 90 degrees.
doublereal * w
void abs(Image< double > &op)
Name for the CTF Model (std::string)
void write(const FileName &outFile, WriteModeMetaData mode=MD_OVERWRITE) const
FileName ctf_envelope_ssnr
Definition: ctf_sort_psds.h:56
double firstZeroRatio
Definition: ctf_sort_psds.h:41
void defineLabelParam()
double hmin
Definition: histogram.h:125
A Power Spectrum Density file name (std::string)
double hmax
Definition: histogram.h:126
double PSDPC1Variance
Definition: ctf_sort_psds.h:53
doublereal * x
#define i
Is this image enabled? (int [-1 or 1])
#define rotate(a, i, j, k, l)
Correlation between the 1st and 3rd ring of the CTF.
void read(const FileName &fn, bool disable_if_not_K=true)
Definition: ctf.cpp:1220
double mask_w2
Higher frequency for the mask (in Fourier space, max 0.5)
double DeltafU
Global gain. By default, 1.
Definition: ctf.h:828
double fittingScore
Definition: ctf_sort_psds.h:50
double PSDcorrelation90
Definition: ctf_sort_psds.h:40
Score of the fitting.
void index2val(double i, double &v) const
Definition: histogram.h:295
#define GET_CTF_CRITERION(labelll, xxx)
T & getValue(MDLabel label)
FileName fn_in
Filenames of input and output Metadata.
void compute_hist(const MultidimArrayGeneric &array, Histogram1D &hist, int no_steps)
Definition: histogram.cpp:572
#define XX(v)
Definition: matrix1d.h:85
double maxDampingAtBorder
Definition: ctf_sort_psds.h:48
ProgPSDSort()
Downsampling factor used for the PSDs.
Integral of the radial PSD.
bool setValue(const MDObject &mdValueIn, size_t id)
size_t addObject() override
Minimum damping at border.
double PSDradialIntegral
Definition: ctf_sort_psds.h:49
size_t firstRowId() const override
Normality test between histogram of micrography and gaussian distribution.
#define XSIZE(v)
double Tm
Sampling rate (A/pixel)
Definition: ctf.h:240
Maximum frequency at which the envelope drops below 0.1 (in Angstroms)
Ratio sigma(firstMinimum)/sigma(firstZero)
void radialAverage(const MultidimArray< double > &VolFourierMag, const MultidimArray< double > &V, MultidimArray< double > &radial_mean)
bool produces_an_output
Indicate that a unique final output is produced.
#define ABS(x)
Definition: xmipp_macros.h:142
double decay_width
Decay width (raised cosine)
void readParams()
void readFromMdRow(const MDRow &row, bool disable_if_not_K=true)
Definition: ctf.cpp:1172
void precomputeValues(double X, double Y)
Precompute values for a given frequency.
Definition: ctf.h:1002
void defineParams()
int verbose
Verbosity level.
Name of a micrograph (std::string)
double getValueDampingAt(bool show=false) const
Compute CTF damping at (U,V). Continuous frequencies.
Definition: ctf.h:424
double filter_w1
Bandpass filter low frequency (in Fourier space, max 0.5)
Definition: ctf_sort_psds.h:65
bool exists() const
void initZeros()
Definition: matrix1d.h:592
First zero disagreement with second model (in Angstroms)
Runs test on the projection of the PSD on the first principal component.
#define XMIPP_MIN(x, y)
Definition: xmipp_macros.h:181
double firstMinimumDiffStddev_ZeroStddev
Definition: ctf_sort_psds.h:44
Frequency in 1/A (double)
#define YY(v)
Definition: matrix1d.h:93
Downsampling performed to estimate the CTF.
double mask_w1
Lower frequency for the mask (in Fourier space, max 0.5)
Definition: ctf_sort_psds.h:74
Variance in the first principal component of the PSDs.
void setValue(MDLabel label, const T &d, bool addLabel=true)
void show() const override
#define FOR_ALL_ELEMENTS_IN_ARRAY1D(v)
virtual bool containsLabel(MDLabel label) const =0
FileName withoutExtension() const
Name for another CTF model (std::string)
double filter_w1
Bandpass filter low frequency (in Fourier space, max 0.5)
void lookFor(int n, const Matrix1D< double > &u, Matrix1D< double > &freq, int iwhat=0)
Definition: ctf.cpp:1428
void applyFilter(MultidimArray< double > &PSD)
double PSDPCRunsTest
Definition: ctf_sort_psds.h:54
void produceSideInfo()
Produce Side information.
Definition: ctf.cpp:1392
double firstMinimumStddev_ZeroStddev
Definition: ctf_sort_psds.h:43
void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
doublereal * u
double mask_w2
Higher frequency for the mask (in Fourier space, max 0.5)
Definition: ctf_sort_psds.h:77
FileName getDir() const
bool keep_input_columns
Keep input metadata columns.
double step_size
Definition: histogram.h:127
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
Ratio sigma(firstMinimum-firstZero)/sigma(firstZero)
void addUsageLine(const char *line, bool verbatim=false)
void initZeros(const MultidimArray< T1 > &op)
#define PI
Definition: tools.h:43
Defocus V (Angstroms)
int readMapped(const FileName &name, size_t select_img=ALL_IMAGES, int mode=WRITE_READONLY)
bool produces_a_metadata
Indicate that the unique final output file is a Metadata.
double sum() const
void addParamsLine(const String &line)
double istep_size
Definition: histogram.h:128
T computeMax() const
double firstZeroDisagreement
Definition: ctf_sort_psds.h:46
double gaussian1D(double x, double sigma, double mu)