Xmipp
v3.23.11-Nereus
|
#include <mlf_align2d.h>
Public Member Functions | |
ProgMLF2D (int nr_vols=0, int rank=0, int size=1) | |
void | defineParams () |
Params definition. More... | |
void | readParams () |
Read arguments from command line. More... | |
void | show (bool ML3D=false) |
Show. More... | |
virtual void | produceSideInfo () |
Setup lots of stuff. More... | |
virtual void | produceSideInfo2 () |
virtual void | defineBasicParams (XmippProgram *prog) |
Some redefinitions of the basic and additional params. More... | |
virtual void | defineAdditionalParams (XmippProgram *prog, const char *sectionLine) |
void | estimateInitialNoiseSpectra () |
void | updateWienerFilters (const MultidimArray< double > &spectral_signal, std::vector< double > &sumw_defocus, int iter) |
void | setCurrentSamplingRates (double current_probres_limit) |
Vary in-plane and translational sampling rates with resolution. More... | |
void | generateInitialReferences () |
Generate initial references from random subset averages. More... | |
void | calculatePdfInplane () |
Calculate probability density distribution for in-plane transformations. More... | |
void | appendFTtoVector (const MultidimArray< std::complex< double > > &Fin, std::vector< double > &out) |
void | getFTfromVector (const std::vector< double > &in, const int start_point, MultidimArray< std::complex< double > > &out, bool only_real=false) |
void | rotateReference (std::vector< double > &out) |
Fill vector of matrices with all rotations of reference. More... | |
void | reverseRotateReference (const std::vector< double > &in, std::vector< MultidimArray< double > > &out) |
Apply reverse rotations to all matrices in vector and fill new matrix with their sum. More... | |
void | preselectDirections (float &phi, float &theta, std::vector< double > &pdf_directions) |
void | preselect_significant_model_phi (MultidimArray< double > &Mimg, std::vector< double > &offsets, std::vector< std::vector< MultidimArray< double > > > &Mref, MultidimArray< int > &Msignificant, std::vector< double > &pdf_directions) |
void | fourierTranslate2D (const std::vector< double > &in, MultidimArray< double > &trans, std::vector< double > &out, int point_start=0) |
void | calculateFourierOffsets (const MultidimArray< double > &Mimg, const std::vector< double > &offsets, std::vector< double > &out, MultidimArray< int > &Moffsets, MultidimArray< int > &Moffsets_mirror) |
void | processOneImage (const MultidimArray< double > &Mimg, size_t focus, bool apply_ctf, double &fracweight, double &maxweight2, double &sum_refw2, double &opt_scale, size_t &opt_refno, double &opt_psi, size_t &opt_ipsi, size_t &opt_iflip, MultidimArray< double > &opt_offsets, std::vector< double > &opt_offsets_ref, std::vector< double > &pdf_directions, bool do_kstest, bool write_histograms, FileName fn_img, double &KSprob) |
Perform expectation step for a single image. More... | |
double | performKSTest (MultidimArray< double > &Mimg, const int focus, bool apply_ctf, FileName &fn_img, bool write_histogram, std::vector< std::vector< MultidimArray< std::complex< double > > > > &Fref, double &opt_scale, int &opt_refno, int &opt_ipsi, int &opt_iflip, MultidimArray< double > &opt_offsets) |
Perform Kolmogorov-Smirnov test. More... | |
void | iteration () |
One iteration of the process. More... | |
void | expectation () |
Integrate over all experimental images. More... | |
void | maximization () |
Update all model parameters (maximization step) More... | |
void | endIteration () |
Redefine endIteration to update Wiener filters. More... | |
virtual void | writeOutputFiles (const ModelML2D &model, OutputType outputType) |
Write out reference images, selfile and logfile. More... | |
void | writeNoiseFile (const FileName &fn_base, int ifocus) |
Write noise estimation per resolution. More... | |
virtual void | addPartialDocfileData (const MultidimArray< double > &data, size_t first, size_t last) |
Add docfiledata to docfile. More... | |
Public Member Functions inherited from ML2DBaseProgram | |
void | initSamplingStuff () |
ML2DBaseProgram () | |
virtual void | setNumberOfLocalImages () |
Set the number of images, this function is useful only for MPI. More... | |
virtual void | randomizeImagesOrder () |
Randomize initial images order, only once. More... | |
virtual void | createThreads () |
Create working threads. More... | |
virtual void | destroyThreads () |
Exit threads and free memory. More... | |
virtual bool | checkConvergence () |
virtual void | run () |
Main function of the program. More... | |
virtual void | defineHiddenParams (XmippProgram *prog) |
Public Member Functions inherited from XmippProgram | |
const char * | getParam (const char *param, int arg=0) |
const char * | getParam (const char *param, const char *subparam, int arg=0) |
int | getIntParam (const char *param, int arg=0) |
int | getIntParam (const char *param, const char *subparam, int arg=0) |
double | getDoubleParam (const char *param, int arg=0) |
double | getDoubleParam (const char *param, const char *subparam, int arg=0) |
float | getFloatParam (const char *param, int arg=0) |
float | getFloatParam (const char *param, const char *subparam, int arg=0) |
void | getListParam (const char *param, StringVector &list) |
int | getCountParam (const char *param) |
bool | checkParam (const char *param) |
bool | existsParam (const char *param) |
void | addParamsLine (const String &line) |
void | addParamsLine (const char *line) |
ParamDef * | getParamDef (const char *param) const |
virtual void | quit (int exit_code=0) const |
virtual int | tryRun () |
void | initProgress (size_t total, size_t stepBin=60) |
void | setProgress (size_t value=0) |
void | endProgress () |
void | processDefaultComment (const char *param, const char *left) |
void | setDefaultComment (const char *param, const char *comment) |
virtual void | initComments () |
void | setProgramName (const char *name) |
void | addUsageLine (const char *line, bool verbatim=false) |
void | clearUsage () |
void | addExampleLine (const char *example, bool verbatim=true) |
void | addSeeAlsoLine (const char *seeAlso) |
void | addKeywords (const char *keywords) |
const char * | name () const |
virtual void | usage (int verb=0) const |
virtual void | usage (const String ¶m, int verb=2) |
int | version () const |
virtual void | show () const |
virtual void | read (int argc, const char **argv, bool reportErrors=true) |
virtual void | read (int argc, char **argv, bool reportErrors=true) |
void | read (const String &argumentsLine) |
XmippProgram () | |
XmippProgram (int argc, const char **argv) | |
virtual | ~XmippProgram () |
Additional Inherited Members | |
Protected Member Functions inherited from XmippProgram | |
void | defineCommons () |
Protected Attributes inherited from XmippProgram | |
int | errorCode |
ProgramDef * | progDef |
Program definition and arguments parser. More... | |
std::map< String, CommentList > | defaultComments |
int | argc |
Original command line arguments. More... | |
const char ** | argv |
MLFalign2D parameters.
Definition at line 70 of file mlf_align2d.h.
ProgMLF2D::ProgMLF2D | ( | int | nr_vols = 0 , |
int | rank = 0 , |
||
int | size = 1 |
||
) |
Constructor nr_vols: Used for 3D case, if 0, then doML3D = false rank and size are for MPI use
Definition at line 30 of file mlf_align2d.cpp.
|
virtual |
Add docfiledata to docfile.
Implements ML2DBaseProgram.
Definition at line 2884 of file mlf_align2d.cpp.
void ProgMLF2D::appendFTtoVector | ( | const MultidimArray< std::complex< double > > & | Fin, |
std::vector< double > & | out | ||
) |
Definition at line 1288 of file mlf_align2d.cpp.
void ProgMLF2D::calculateFourierOffsets | ( | const MultidimArray< double > & | Mimg, |
const std::vector< double > & | offsets, | ||
std::vector< double > & | out, | ||
MultidimArray< int > & | Moffsets, | ||
MultidimArray< int > & | Moffsets_mirror | ||
) |
Definition at line 1479 of file mlf_align2d.cpp.
void ProgMLF2D::calculatePdfInplane | ( | ) |
Calculate probability density distribution for in-plane transformations.
Definition at line 1254 of file mlf_align2d.cpp.
|
virtual |
Reimplemented from ML2DBaseProgram.
Definition at line 55 of file mlf_align2d.cpp.
|
virtual |
Some redefinitions of the basic and additional params.
Reimplemented from ML2DBaseProgram.
Definition at line 46 of file mlf_align2d.cpp.
|
virtual |
Params definition.
Reimplemented from XmippProgram.
Definition at line 71 of file mlf_align2d.cpp.
|
virtual |
Redefine endIteration to update Wiener filters.
Reimplemented from ML2DBaseProgram.
Definition at line 2675 of file mlf_align2d.cpp.
void ProgMLF2D::estimateInitialNoiseSpectra | ( | ) |
Calculate initial sigma2 from average power spectrum of the experimental images
Definition at line 738 of file mlf_align2d.cpp.
|
virtual |
Integrate over all experimental images.
Implements ML2DBaseProgram.
Definition at line 2308 of file mlf_align2d.cpp.
void ProgMLF2D::fourierTranslate2D | ( | const std::vector< double > & | in, |
MultidimArray< double > & | trans, | ||
std::vector< double > & | out, | ||
int | point_start = 0 |
||
) |
Definition at line 1445 of file mlf_align2d.cpp.
void ProgMLF2D::generateInitialReferences | ( | ) |
Generate initial references from random subset averages.
Definition at line 1199 of file mlf_align2d.cpp.
void ProgMLF2D::getFTfromVector | ( | const std::vector< double > & | in, |
const int | start_point, | ||
MultidimArray< std::complex< double > > & | out, | ||
bool | only_real = false |
||
) |
Definition at line 1302 of file mlf_align2d.cpp.
|
virtual |
One iteration of the process.
Implements ML2DBaseProgram.
Definition at line 2300 of file mlf_align2d.cpp.
|
virtual |
Update all model parameters (maximization step)
Implements ML2DBaseProgram.
Definition at line 2490 of file mlf_align2d.cpp.
double ProgMLF2D::performKSTest | ( | MultidimArray< double > & | Mimg, |
const int | focus, | ||
bool | apply_ctf, | ||
FileName & | fn_img, | ||
bool | write_histogram, | ||
std::vector< std::vector< MultidimArray< std::complex< double > > > > & | Fref, | ||
double & | opt_scale, | ||
int & | opt_refno, | ||
int & | opt_ipsi, | ||
int & | opt_iflip, | ||
MultidimArray< double > & | opt_offsets | ||
) |
Perform Kolmogorov-Smirnov test.
void ProgMLF2D::preselect_significant_model_phi | ( | MultidimArray< double > & | Mimg, |
std::vector< double > & | offsets, | ||
std::vector< std::vector< MultidimArray< double > > > & | Mref, | ||
MultidimArray< int > & | Msignificant, | ||
std::vector< double > & | pdf_directions | ||
) |
Pre-calculate which model and phi have significant probabilities without taking translations into account!
void ProgMLF2D::preselectDirections | ( | float & | phi, |
float & | theta, | ||
std::vector< double > & | pdf_directions | ||
) |
Calculate which references have projection directions close to phi and theta
Definition at line 1410 of file mlf_align2d.cpp.
void ProgMLF2D::processOneImage | ( | const MultidimArray< double > & | Mimg, |
size_t | focus, | ||
bool | apply_ctf, | ||
double & | fracweight, | ||
double & | maxweight2, | ||
double & | sum_refw2, | ||
double & | opt_scale, | ||
size_t & | opt_refno, | ||
double & | opt_psi, | ||
size_t & | opt_ipsi, | ||
size_t & | opt_iflip, | ||
MultidimArray< double > & | opt_offsets, | ||
std::vector< double > & | opt_offsets_ref, | ||
std::vector< double > & | pdf_directions, | ||
bool | do_kstest, | ||
bool | write_histograms, | ||
FileName | fn_img, | ||
double & | KSprob | ||
) |
Perform expectation step for a single image.
Definition at line 1589 of file mlf_align2d.cpp.
|
virtual |
Setup lots of stuff.
Implements ML2DBaseProgram.
Reimplemented in MpiProgMLF2D.
Definition at line 300 of file mlf_align2d.cpp.
|
virtual |
Read reference images in memory & set offset vectors (This produceSideInfo is Selfile-dependent!)
Implements ML2DBaseProgram.
Reimplemented in MpiProgMLF2D.
Definition at line 523 of file mlf_align2d.cpp.
|
virtual |
Read arguments from command line.
Reimplemented from XmippProgram.
Definition at line 90 of file mlf_align2d.cpp.
void ProgMLF2D::reverseRotateReference | ( | const std::vector< double > & | in, |
std::vector< MultidimArray< double > > & | out | ||
) |
Apply reverse rotations to all matrices in vector and fill new matrix with their sum.
Definition at line 1379 of file mlf_align2d.cpp.
void ProgMLF2D::rotateReference | ( | std::vector< double > & | out | ) |
Fill vector of matrices with all rotations of reference.
Definition at line 1334 of file mlf_align2d.cpp.
void ProgMLF2D::setCurrentSamplingRates | ( | double | current_probres_limit | ) |
Vary in-plane and translational sampling rates with resolution.
Definition at line 1127 of file mlf_align2d.cpp.
void ProgMLF2D::show | ( | bool | ML3D = false | ) |
Show.
Definition at line 199 of file mlf_align2d.cpp.
void ProgMLF2D::updateWienerFilters | ( | const MultidimArray< double > & | spectral_signal, |
std::vector< double > & | sumw_defocus, | ||
int | iter | ||
) |
Calculate Wiener filter for defocus series as defined by Frank (2nd ed. formula 2.32b on p.60)
Definition at line 853 of file mlf_align2d.cpp.
void ProgMLF2D::writeNoiseFile | ( | const FileName & | fn_base, |
int | ifocus | ||
) |
Write noise estimation per resolution.
Definition at line 2866 of file mlf_align2d.cpp.
|
virtual |
Write out reference images, selfile and logfile.
Implements ML2DBaseProgram.
Reimplemented in MpiProgMLF2D.
Definition at line 2698 of file mlf_align2d.cpp.
std::vector<double> ProgMLF2D::alpha_k |
Vector containing estimated fraction for each model
Definition at line 77 of file mlf_align2d.h.
std::vector<int> ProgMLF2D::count_defocus |
Vector with number of images per defocuss group
Definition at line 104 of file mlf_align2d.h.
size_t ProgMLF2D::current_highres_limit |
Current highest resolution shell
Definition at line 129 of file mlf_align2d.h.
size_t ProgMLF2D::dnr_points_2d |
Definition at line 127 of file mlf_align2d.h.
bool ProgMLF2D::do_ctf_correction |
CTFDat file for all images Flag whether to include CTFs in the image formation model
Definition at line 100 of file mlf_align2d.h.
bool ProgMLF2D::do_divide_ctf |
Divide by CTF (until first zero) instead of wiener filter
Definition at line 120 of file mlf_align2d.h.
bool ProgMLF2D::do_include_allfreqs |
Include all frequencies in the refinement
Definition at line 122 of file mlf_align2d.h.
bool ProgMLF2D::do_kstest |
Statistical analysis of the noise distributions.
Perform Kolmogorov-Smirnov test on noise distribution
Definition at line 141 of file mlf_align2d.h.
bool ProgMLF2D::do_student |
IN DEVELOPMENT.
USe t-distribution instead of normal one Use t-student distribution instead of normal one
Definition at line 135 of file mlf_align2d.h.
bool ProgMLF2D::do_student_sigma_trick |
Perform sigma-trick for faster convergence (Mclachlan&Peel, p. 228)
Definition at line 137 of file mlf_align2d.h.
bool ProgMLF2D::do_variable_psi |
Vary psi and translational sampling with resolution
Definition at line 83 of file mlf_align2d.h.
bool ProgMLF2D::do_variable_trans |
Definition at line 83 of file mlf_align2d.h.
bool ProgMLF2D::first_iter_noctf |
Do not multiply signal with CTF in the first iteration
Definition at line 118 of file mlf_align2d.h.
double ProgMLF2D::fix_high |
Fix high-resolution limit
Definition at line 124 of file mlf_align2d.h.
std::vector<double> ProgMLF2D::Fref |
Definition at line 157 of file mlf_align2d.h.
std::vector<double> ProgMLF2D::Fwsum_ctfimgs |
Definition at line 157 of file mlf_align2d.h.
std::vector<double> ProgMLF2D::Fwsum_imgs |
Definition at line 157 of file mlf_align2d.h.
double ProgMLF2D::highres_limit |
Definition at line 116 of file mlf_align2d.h.
std::vector< Image<double> > ProgMLF2D::Ictf |
Vector for images to hold references (new & old)
Definition at line 85 of file mlf_align2d.h.
double ProgMLF2D::ini_highres_limit |
Definition at line 116 of file mlf_align2d.h.
int ProgMLF2D::iter_write_histograms |
Iteration at which to write out histograms
Definition at line 143 of file mlf_align2d.h.
bool ProgMLF2D::limit_trans |
Limit translational searches
Definition at line 87 of file mlf_align2d.h.
double ProgMLF2D::LL |
Taken from expectation and/or maximization
Definition at line 153 of file mlf_align2d.h.
double ProgMLF2D::lowres_limit |
Overall low and high resolution cutoffs for fourier-mode (in Fourier pixels)
Definition at line 116 of file mlf_align2d.h.
size_t ProgMLF2D::max_nr_psi |
Number of steps to sample in-plane rotation in 90 degrees
Definition at line 81 of file mlf_align2d.h.
std::vector<double> ProgMLF2D::mirror_fraction |
Vector containing estimated fraction for mirror of each model
Definition at line 79 of file mlf_align2d.h.
MultidimArray<size_t> ProgMLF2D::Mresol_int |
Matrix with resolution shell at each Fourier pixel
Definition at line 108 of file mlf_align2d.h.
std::vector< std::vector<double> > ProgMLF2D::Mwsum_sigma2 |
Definition at line 155 of file mlf_align2d.h.
size_t ProgMLF2D::nr_focus |
number of defocus groups
Definition at line 114 of file mlf_align2d.h.
size_t ProgMLF2D::nr_points_2d |
Definition at line 127 of file mlf_align2d.h.
size_t ProgMLF2D::nr_points_prob |
Definition at line 127 of file mlf_align2d.h.
size_t ProgMLF2D::nr_trans |
Number of limited translations
Definition at line 89 of file mlf_align2d.h.
int ProgMLF2D::nr_vols |
Definition at line 150 of file mlf_align2d.h.
int ProgMLF2D::offsets_keepdir |
Number of subdirectories to keep for unique offsets filenames
Definition at line 95 of file mlf_align2d.h.
bool ProgMLF2D::phase_flipped |
Flag whether the phases of the experimental images are flipped already
Definition at line 106 of file mlf_align2d.h.
std::vector<int> ProgMLF2D::pointer_2d |
Pointers to the 2D matrices (in FourierTransformHalf format)
Definition at line 126 of file mlf_align2d.h.
std::vector<int> ProgMLF2D::pointer_i |
Definition at line 126 of file mlf_align2d.h.
std::vector<int> ProgMLF2D::pointer_j |
Definition at line 126 of file mlf_align2d.h.
int ProgMLF2D::rank |
Definition at line 150 of file mlf_align2d.h.
double ProgMLF2D::reduce_snr |
Multiplicative factor for SSNR
Definition at line 112 of file mlf_align2d.h.
std::vector<double> ProgMLF2D::refs_avgscale |
Definition at line 148 of file mlf_align2d.h.
std::vector<Histogram1D > ProgMLF2D::resolhist |
Definition at line 146 of file mlf_align2d.h.
double ProgMLF2D::sampling |
Pixel size in Angstroms
Definition at line 102 of file mlf_align2d.h.
int ProgMLF2D::search_shift |
Limited search range for origin offsets
Definition at line 93 of file mlf_align2d.h.
double ProgMLF2D::sigma_offset |
sigma-value for origin offsets
Definition at line 75 of file mlf_align2d.h.
int ProgMLF2D::size |
Definition at line 150 of file mlf_align2d.h.
double ProgMLF2D::sumcorr |
Definition at line 153 of file mlf_align2d.h.
Histogram1D ProgMLF2D::sumhist |
Average histogram
Definition at line 145 of file mlf_align2d.h.
std::vector<double> ProgMLF2D::sumw |
Definition at line 156 of file mlf_align2d.h.
std::vector<double> ProgMLF2D::sumw2 |
Definition at line 156 of file mlf_align2d.h.
double ProgMLF2D::sumw_allrefs |
Definition at line 153 of file mlf_align2d.h.
std::vector<double> ProgMLF2D::sumw_defocus |
Definition at line 156 of file mlf_align2d.h.
std::vector<double> ProgMLF2D::sumw_mirror |
Definition at line 156 of file mlf_align2d.h.
std::vector<double> ProgMLF2D::sumwsc |
Definition at line 156 of file mlf_align2d.h.
std::vector<double> ProgMLF2D::sumwsc2 |
Definition at line 156 of file mlf_align2d.h.
std::vector<MultidimArray<double> > ProgMLF2D::Vctf |
Definition at line 110 of file mlf_align2d.h.
std::vector<MultidimArray<double> > ProgMLF2D::Vdec |
Definition at line 110 of file mlf_align2d.h.
std::vector<MultidimArray<double> > ProgMLF2D::Vsig |
Vectors with sigma2 (for each defocus group)
Definition at line 110 of file mlf_align2d.h.
std::vector<MultidimArray<double> > ProgMLF2D::wsum_ctfMref |
Definition at line 154 of file mlf_align2d.h.
std::vector<MultidimArray<double> > ProgMLF2D::wsum_Mref |
Definition at line 154 of file mlf_align2d.h.
double ProgMLF2D::wsum_sigma_offset |
Definition at line 153 of file mlf_align2d.h.
size_t ProgMLF2D::zero_trans |
Number for which limited translation is zero
Definition at line 91 of file mlf_align2d.h.