Xmipp  v3.23.11-Nereus
volume_to_pseudoatoms.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Carlos Oscar S. Sorzano (coss@cnb.csic.es)
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 /* This file contains functions related to the Radon Transform */
26 
27 #ifndef _CONVERT_VOL2PSEUDO_HH
28 #define _CONVERT_VOL2PSEUDO_HH
29 
30 #include <core/xmipp_image.h>
31 #include <data/mask.h>
32 #include <core/xmipp_threads.h>
33 #include <core/xmipp_program.h>
34 #include <vector>
35 #include <data/fourier_filter.h>
36 
40 class PseudoAtom
42 {
43 public:
46 
48  double intensity;
49 
51  PseudoAtom();
52 
54  friend std::ostream& operator << (std::ostream &o, const PseudoAtom &f);
55 };
56 
58 bool operator <(const PseudoAtom &a, const PseudoAtom &b);
59 
60 // Forward declaration
62 
63 // Thread parameters
65 {
69  int Nmovement;
70 };
71 
73 {
74 public:
77 
80 
81  // Mask
83 
84  // Use mask
85  bool useMask;
86 
88  double sigma;
89 
91  double targetError;
92 
94  double stop;
95 
98 
100  double growSeeds;
101 
104 
107 
113 
115  std::string intensityColumn;
116 
118  double minDistance;
119 
121  double penalty;
122 
125 
127  double sampling;
128 
130  size_t Nclosest;
131 
133  bool dontScale;
134 
136  bool binarize;
137 
139  double threshold;
140 public:
142  void readParams();
143 
145  void show() const;
146 
148  void defineParams();
149 
151  void produceSideInfo();
152 
154  void run();
155 
157  void placeSeeds(int Nseeds);
158 
160  void removeSeeds(int Nseeds);
161 
163  void removeTooCloseSeeds();
164 
166  double computeAverage(int k, int i, int j, MultidimArray<double> &V);
167 
169  void drawGaussian(double k, double i, double j, MultidimArray<double> &V,
170  double intensity);
171 
173  void drawApproximation();
174 
176  void extractRegion(int idxGaussian, MultidimArray<double> &region,
177  bool extended=false) const;
178 
180  void insertRegion(const MultidimArray<double> &region);
181 
183  double evaluateRegion(const MultidimArray<double> &region) const;
184 
186  void optimizeCurrentAtoms();
187 
189  static void* optimizeCurrentAtomsThread(void * threadArgs);
190 
192  void writeResults();
193 public:
194  // Input volume
196 
197  // Current approximation volume
199 
200  // Energy of the difference
201  double energyDiff;
202 
203  // Maximum percentage diffence
205 
206  // Original energy
208 
209  // List of atoms
210  std::vector< PseudoAtom > atoms;
211 
212  // Maximum radius
213  double sigma3;
214 
215  // Percentil 1
216  double percentil1;
217 
218  // Range
219  double range;
220 
221  // Small atom intensity
222  double smallAtom;
223 
224  // Gaussian table
226 
227  // Barrier
229 
230 #define KILLTHREAD -1
231 #define WORKTHREAD 0
232  // Thread operation code
234 
235  // Pointer to thread arguments
237 
238  // Pointer to threads
239  pthread_t *threadIds;
240 
241  // Filter for the difference volume
243 };
245 #endif
int numThreads
Number of threads.
Pseudoatom class.
double sampling
Sampling rate.
Definition: mask.h:360
FileName fnOut
Output volume.
std::vector< PseudoAtom > atoms
MultidimArray< double > gaussianTable
std::string intensityColumn
Column for the intensity (if any)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
PseudoAtom()
Empty constructor.
doublereal * b
double * f
friend std::ostream & operator<<(std::ostream &o, const PseudoAtom &f)
Show pseudo atom.
double intensity
Intensity.
bool allowIntensity
Allow gaussians to vary intensity.
Matrix1D< double > location
Location.
bool allowMovement
Allow gaussians to move.
#define j
double stop
Stop criterion.
double targetError
Maximum error (as a percentage)
double minDistance
Mindistance.
FileName fnVol
Volume to convert.
double threshold
Threshold for the binarization.
Prog_Convert_Vol2Pseudo_ThreadParams * threadArgs
bool operator<(const PseudoAtom &a, const PseudoAtom &b)
Comparison between pseudo atoms.
int initialSeeds
Initial seeds.
bool dontScale
Don&#39;t scale the atom weights at the end.
double penalty
Penalization.
doublereal * a
size_t Nclosest
N closest atoms for the distance histogram.