Xmipp  v3.23.11-Nereus
subtomo_subtraction.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Estrella Fernandez Gimenez me.fernandez@cnb.csic.es (2019)
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 #ifndef _PROG_SUBTOMO_SUBTRACTION
26 #define _PROG_SUBTOMO_SUBTRACTION
27 
28 #include "core/xmipp_program.h"
29 #include <core/xmipp_fftw.h>
30 #include "data/fourier_filter.h"
32 
38 /*This class contains methods that are use to adjust an input volume (V) to a another reference volume (V1) through the use
39  of Projectors Onto Convex Sets (POCS) and to perform the subtraction between them. Other methods contained in this class
40  are used to pre-process and operate with the volumes*/
41 
43 {
44 public:
45  // Input params
46  FileName fnVolMd; // Input metadata of volume(s)
47  FileName fnVolRef; // Input reference volume (V1)
48  FileName fnVol2; // Volume filename
49  FileName fnOut; // Output metadata
53  FileName fnVol1F; // save filtered reference
54  FileName fnVol2A; // save process volumes before subtraction
55 
56  bool computeE;
57  size_t iter;
58  double v1min;
59  double v1max;
61  int sigma;
62  double cutFreq;
63  double lambda;
64  bool radavg;
65  bool subtomos;
66 
67  // Particle metadata
70  Matrix1D<double> roffset; // particle shifts
71  struct Angles // particle angles for projection
72  {
73  double rot;
74  double tilt;
75  double psi;
76  };
78 
79  // Data variables
80  Image<double> V; // volume to adjust
81  Image<double> V1; // reference volume
82  Image<double> padv; // padded image when applying aligment
83  double pad; // size of padding
84  double std1;
85  size_t n;
92  int rank; // for MPI version
93 
97  void POCSFourierAmplitude(const MultidimArray<double> &, MultidimArray<std::complex<double>> &, double );
98  void POCSFourierAmplitudeRadAvg(MultidimArray<std::complex<double>> &, double , const MultidimArray<double> &, int, int, int);
99  void POCSMinMax(MultidimArray<double> &, double, double);
100  void POCSFourierPhase(const MultidimArray<std::complex<double>> &, MultidimArray<std::complex<double>> &);
101  void extractPhase(MultidimArray<std::complex<double>> &) const;
103  void centerFFTMagnitude(MultidimArray<double> &, MultidimArray<std::complex<double>> &,MultidimArray<double> &) const;
106  const MultidimArray<double> &);
107  void createFilter(FourierFilter &, double);
109  const FileName &, FourierFilter &, double );
112  void filterMask(MultidimArray<double> &) const;
115 
118 
120  void readParams() override;
122  void show() const override;
124  void defineParams() override;
126  void readParticle(const MDRow &rowIn);
127  void writeParticle(MDRow &rowOut, FileName, Image<double> &);
129  void preProcess() override;
130  void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut) override;
131  void postProcess() override;
132 
133 };
135 #endif
void processImage(const FileName &fnImg, const FileName &fnImgOut, const MDRow &rowIn, MDRow &rowOut) override
MultidimArray< double > computeRadQuotient(const MultidimArray< double > &, const MultidimArray< double > &, const MultidimArray< double > &, const MultidimArray< double > &)
void radialAverage(const MultidimArray< double > &, const MultidimArray< double > &, MultidimArray< double > &)
MultidimArray< double > getSubtractionMask(const FileName &, MultidimArray< double >)
void readParams() override
Read argument from command line.
void preProcess() override
MPI methods.
void POCSmask(const MultidimArray< double > &, MultidimArray< double > &)
Processing methods.
MultidimArray< double > mask
Matrix1D< double > roffset
MultidimArray< std::complex< double > > V2Fourier
Image< double > subtraction(Image< double >, Image< double > &, const MultidimArray< double > &, const FileName &, const FileName &, FourierFilter &, double)
ProgSubtomoSubtraction()
Empty constructor.
void extractPhase(MultidimArray< std::complex< double >> &) const
FourierTransformer transformer2
void centerFFTMagnitude(MultidimArray< double > &, MultidimArray< std::complex< double >> &, MultidimArray< double > &) const
void createFilter(FourierFilter &, double)
void POCSFourierAmplitude(const MultidimArray< double > &, MultidimArray< std::complex< double >> &, double)
void filterMask(MultidimArray< double > &) const
void show() const override
Show.
MultidimArray< std::complex< double > > computePhase(MultidimArray< double > &)
MultidimArray< double > computeMagnitude(MultidimArray< double > &)
void POCSFourierPhase(const MultidimArray< std::complex< double >> &, MultidimArray< std::complex< double >> &)
MultidimArray< double > createMask(const Image< double > &, const FileName &, const FileName &)
void POCSFourierAmplitudeRadAvg(MultidimArray< std::complex< double >> &, double, const MultidimArray< double > &, int, int, int)
void POCSMinMax(MultidimArray< double > &, double, double)
void POCSnonnegative(MultidimArray< double > &)
void computeEnergy(MultidimArray< double > &, const MultidimArray< double > &) const
void readParticle(const MDRow &rowIn)
Read and write methods.
void defineParams() override
Define parameters.
void writeParticle(MDRow &rowOut, FileName, Image< double > &)
MultidimArray< double > V1FourierMag