Xmipp  v3.23.11-Nereus
ctf_correct_phase.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Authors: Carlos Oscar Sorzano (coss@cnb.csic.es)
3  *
4  *
5  * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20  * 02111-1307 USA
21  *
22  * All comments concerning this program package may be sent to the
23  * e-mail address 'xmipp@cnb.csic.es'
24  ***************************************************************************/
25 
26 #include "ctf_correct_phase.h"
27 
28 // Read arguments ==========================================================
30 {
32  sampling_rate = getDoubleParam("--sampling_rate");
33 }
34 
35 // Define parameters ==========================================================
37 {
38  addUsageLine("Perform CTF correction to 2D projection images with estimated ctfs using a phase flip filter.");
41  addKeywords("correct CTF by phase flipping");
42  addParamsLine(" [--sampling_rate <float=1.0>] : Sampling rate of the input particles");
43 }
44 
45 void ProgCorrectPhaseFlip2D::processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
46 {
47  rowOut = rowIn;
48  img.read(fnImg);
49  ctf.readFromMdRow(rowIn);
50  img().setXmippOrigin();
52  img.write(fnImgOut);
53  rowOut.setValue(MDL_IMAGE, fnImgOut);
54 }
double getDoubleParam(const char *param, int arg=0)
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)
void addKeywords(const char *keywords)
void readFromMdRow(const MDRow &row, bool disable_if_not_K=true)
Definition: ctf.cpp:1172
void correctPhase(MultidimArray< std::complex< double > > &FFTI, const MultidimArray< double > &I, double Ts)
Correct phase flip of an image.
Definition: ctf.cpp:1553
void setValue(MDLabel label, const T &d, bool addLabel=true)
void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut)
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
bool each_image_produces_an_output
Indicate that an output is produced for each image in the input.
double sampling_rate
Sampling rate.
void addUsageLine(const char *line, bool verbatim=false)
Name of an image (std::string)
void addParamsLine(const String &line)