53 if (!program->
checkParam(
"--enhance_min_freq"))
57 if (!program->
checkParam(
"--enhance_max_freq"))
75 <<
"PSD file: " <<
fn_psd << std::endl
77 <<
"Min Freq.: " <<
min_freq << std::endl
78 <<
"Max Freq.: " <<
max_freq << std::endl
79 <<
"Sampling: " <<
Tm << std::endl
82 <<
"Enhance min freq: " <<
f1 << std::endl
83 <<
"Enhance max freq: " <<
f2 << std::endl
86 <<
"Bootstrap: " <<
bootstrap << std::endl
93 <<
"Regularization factor: " <<
lambdaPhase << std::endl
104 " [--downSamplingPerformed <F=1>] : Downsampling performed to produce this PSD");
106 " : Note that the output CTF model is referred to the original sampling rate");
108 " : not the one of the downsampled image.");
109 program->
addParamsLine(
"== CTF fit: Optimization constraints");
111 " [--min_freq <fmin=0.03>] : Minimum digital frequency (<0.5) to use in adjust. Its value");
113 " : should be a little lower than the dig. freq. of the first ");
116 " [--max_freq <fmax=0.35>] : Maximum digital frequency (<0.5) to use in adjust.");
118 " : It should be higher than the last zero of the CTF.");
120 " [--fastDefocus <lambda=2> <size=10>] : Estimate first defocus with Zernike polynomials");
122 " :+Lambda is a regularization factor used during the estimation of the CTF phase");
124 " :+During the estimation, the phase values are averaged within a window of this size");
126 " [--noDefocus] : No defocus estimation");
128 " [--defocus_range <D=8000>] : Defocus range in Angstroms");
130 " [--refine_amplitude_contrast] : Refine amplitude contrast with respect to the input one");
132 " [--show_optimization+] : Show optimization process");
134 " [--radial_noise++] : By default, noise is astigmatic");
136 " [--enhance_weight++ <w=1>] : Weight of the enhanced term");
138 " [--model_simplification++ <s=0>]: 0 (no simplification)");
140 " : 1 (simplified envelope)");
142 " : 2 (last Gaussian removal)");
144 " : 3 (symmetric intermediate Gaussian)");
146 " [--bootstrapFit++ <N=-1>] : Perform bootstrap fit (Fourier pixels are randomly chosen)");
148 " : This is used to test the variability of the fit");
150 " : N defines the number of times the fit is repeated");
153 " [--ctfmodelSize <size=256>] : Size for the ctfmodel thumbnails");
156 " [--enhance_min_freq <f1>] : Bandpass cutoff. Normalized to 0.5");
158 " : If fmax>0.35, f1 default=0.01");
160 " : If fmax<0.35, f1 default=0.02");
162 " [--enhance_max_freq <f2>] : Bandpass cutoff. Normalized to 0.5.");
164 " [--selfEstimation] : Estimate defocus without previous estimation");
166 " : If fmax>0.35, f2 default=0.08");
168 " : If fmax<0.35, f2 default=0.15");
173 addUsageLine(
"Adjust a parametric model to a PSD file.");
175 "The PSD is enhanced ([[http://www.ncbi.nlm.nih.gov/pubmed/16987671][See article]]). ");
177 "And finally, the CTF is fitted to the PSD, being guided by the enhanced PSD ");
179 "([[http://www.ncbi.nlm.nih.gov/pubmed/17911028][See article]]).");
240 if (
fn_psd.find(
'@')==std::string::npos)
324 maxDiff=
std::max(maxDiff,fabs(diff));
348 double N1=0, N2=0, avg1=0, avg2=0;
double defocus_range
Defocus range.
#define A2D_ELEM(v, i, j)
double enhanced_weight
Weight of the enhanced image.
MultidimArray< double > * f
double getDoubleParam(const char *param, int arg=0)
Image< double > ctftomodel
CTF amplitude to model.
double filter_w2
Bandpass filter high frequency (in Fourier space, max 0.5)
__host__ __device__ float2 floor(const float2 v)
bool fastDefocusEstimate
Fast defocus estimate.
#define FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY2D(m)
int sizeWindowPhase
Size of the average window used during phase direction and unwrapping estimates (used in Zernike esti...
MultidimArray< double > w_digfreq
double mask_w1
Lower frequency for the mask (in Fourier space, max 0.5)
void readBasicParams(XmippProgram *program)
Read parameters.
void write(const FileName &name="", size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE, CastWriteMode castMode=CW_CAST, int _swapWrite=0)
MultidimArray< double > y_digfreq
double f1
Enhancement filter low freq.
MultidimArray< double > w_digfreq_r_iN
double downsampleFactor
Downsample performed.
void show()
Show parameters.
MultidimArray< double > psd_exp_enhanced_radial_derivative
void FFT_idx2digfreq(T &v, const Matrix1D< int > &idx, Matrix1D< double > &freq)
FileName fn_psd
CTF filename.
MultidimArray< double > w_digfreq_r
#define FOR_ALL_ELEMENTS_IN_ARRAY2D(m)
void addSeeAlsoLine(const char *seeAlso)
double max_freq
Maximum frequency to adjust.
double mask_w2
Higher frequency for the mask (in Fourier space, max 0.5)
void CenterFFT(MultidimArray< T > &v, bool forward)
Image< double > enhanced_ctftomodel_fullsize
CTF amplitude to model.
int ctfmodelSize
X dimension of particle projections (-1=the same as the psd)
bool bootstrap
Bootstrap estimation.
MultidimArray< double > w_contfreq
MultidimArray< double > psd_theo_radial
MultidimArray< double > psd_exp_radial
PSD data.
const char * getParam(const char *param, int arg=0)
bool noDefocusEstimate
No defocus estimate.
void write(const FileName &fn) const
void max(Image< double > &op1, const Image< double > &op2)
bool refineAmplitudeContrast
Refine amplitude contrast.
double decay_width
Decay width (raised cosine)
int verbose
Verbosity level.
static void defineBasicParams(XmippProgram *program)
Define basic parameters.
double f2
Enhancement filter high freq.
bool show_optimization
Show convergence values.
MultidimArray< double > psd_theo_radial_derivative
void defineParams()
Define Parameters.
MultidimArray< double > x_digfreq
#define FOR_ALL_ELEMENTS_IN_ARRAY1D(v)
double evaluateIceness(MultidimArray< double > &psd, double Tm)
void produceSideInfo()
Produce side information.
int modelSimplification
Model simplification.
FileName withoutExtension() const
double filter_w1
Bandpass filter low frequency (in Fourier space, max 0.5)
void medianFilter3x3(MultidimArray< T > &m, MultidimArray< T > &out)
void applyFilter(MultidimArray< double > &PSD)
double min_freq
Minimum frequency to adjust.
Image< double > enhanced_ctftomodel
CTF amplitude to model.
void readParams()
Read parameters.
MultidimArray< double > x_contfreq
Frequencies in axes.
bool checkParam(const char *param)
MultidimArray< double > psd_exp_enhanced_radial
double lambdaPhase
Regularization factor for the phase direction and unwrapping estimates (used in Zernike estimate) ...
void addUsageLine(const char *line, bool verbatim=false)
void initZeros(const MultidimArray< T1 > &op)
MultidimArray< double > mask
Masks.
int getIntParam(const char *param, int arg=0)
void generateMask(MultidimArray< double > &v)
MultidimArray< double > w_count
void addParamsLine(const String &line)
MultidimArray< double > y_contfreq
void applyMaskSpace(MultidimArray< double > &v)
void digfreq2contfreq(const Matrix1D< double > &digfreq, Matrix1D< double > &contfreq, double pixel_size)