Xmipp  v3.23.11-Nereus
project_xray.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Authors: Joaquin Oton (joton@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 #ifndef _PROJECTXRAY_H_
27 #define _PROJECTXRAY_H_
28 
29 #include "core/metadata_vec.h"
30 #include "core/xmipp_program.h"
31 #include "core/xmipp_threads.h"
33 #include "data/projection.h"
34 #include "data/psf_xr.h"
35 
39 
42 {
49  int forw;
50  std::vector<int> *phantomSlabIdx;
51  std::vector<int> *psfSlicesIdx;
54 };
55 
62 {
63 public:
67 
72 
77  void read(const FileName &fnVol);
78 };
79 
80 /* Projection XR Program -------------------------------- */
82 class ProgXrayProject: public virtual XmippProgram
83 {
84 
85 public:
92  // Projection parameters
94  // Microscope optics parameters
97  double psfThr;
98  // Input volume sampling
99  double dxo;
101  int nThr;
104 
109 
110 protected:
111  virtual void defineParams();
112  virtual void readParams();
113 
114 public:
115 
116  virtual void run();
117 
118 protected:
119 
120  void preRun();
121  void postRun();
122 };
123 
142  int Ydim, int Xdim);
143 
146  XRayPSF &psf, Projection &P, MultidimArray<double> * projNorm=nullptr, ThreadManager * ThrMgr=nullptr);
147 
148 //Some global threads management variables
149 extern Mutex mutex;
150 extern Barrier * barrier;
151 extern ThreadManager * thMgr;
152 
154 void threadXrayProject(ThreadArgument &thArg);
155 
157 {
158  double samplingZ;
164 
166  {
167  samplingZ = 0;
168  muVol = cumMu = IgeoVol = IgeoZb = nullptr;
169  td = nullptr;
170  }
171 };
172 
176  int nThreads = 1 , ThreadManager * ThrMgr = nullptr);
177 
179 
180 
183  MultidimArray<double> &muVol, // Volume
184  XRayPSF &psf, // Basis
185  MultidimArray<double> &IgeoVol,
186  Projection &proj, // Projection
187  MultidimArray<double> *projNorm, // Projection of a unitary volume
188  int FORW, // 1 if we are projecting a volume
189  // norm_proj is calculated
190  // 0 if we are backprojecting
191  // norm_proj must be valid
192  ThreadManager * thMgr);
193 
195  MultidimArray<double> *IgeoVol,
196  Projection *proj, MultidimArray<double> &projNorm, int FORW,
197  int threadId = -1, int nThreads = 1);
198 
200 {
201  double sampling;
206 };
207 
208 
210 
212 
213 #endif /* _PROJECTXR_H_ */
void threadXrayProject(ThreadArgument &thArg)
Thread Job to generate an X-ray microscope projection.
Mutex mutex
ParametersProjectionTomography projParam
Definition: project_xray.h:93
double samplingZ
Definition: project_xray.h:158
Projection stdProj
Definition: project_xray.h:106
void projectXraySimpleGridThread(ThreadArgument &thArg)
Data struct to be passed to threads.
Definition: project_xray.h:41
ThreadManager * thMgr
MultidimArray< double > * IgeoVol
Definition: project_xray.h:45
MultidimArray< double > * muVol
Definition: project_xray.h:202
FileName fn_proj_param
Filename with the Projection_Parameters.
Definition: project_xray.h:87
void projectXrayVolume(MultidimArray< double > &muVol, MultidimArray< double > &IgeoVol, XRayPSF &psf, Projection &P, MultidimArray< double > *projNorm=nullptr, ThreadManager *ThrMgr=nullptr)
ParallelTaskDistributor * td
Definition: project_xray.h:205
void XrayRotateAndProjectVolumeOffCentered(XrayProjPhantom &side, XRayPSF &psf, Projection &P, Projection &standardP, int Ydim, int Xdim)
Image< double > iniVol
Phantom Xmipp volume.
Definition: project_xray.h:65
ParallelTaskDistributor * td
Definition: project_xray.h:52
MultidimArray< double > * projNorm
Definition: project_xray.h:48
MultidimArray< double > * IgeoVol
Definition: project_xray.h:203
std::vector< int > * phantomSlabIdx
Definition: project_xray.h:50
std::vector< int > * psfSlicesIdx
Definition: project_xray.h:51
MetaDataVec projMD
Definition: project_xray.h:107
void projectXrayGridVolume(MultidimArray< double > &muVol, XRayPSF &psf, MultidimArray< double > &IgeoVol, Projection &proj, MultidimArray< double > *projNorm, int FORW, ThreadManager *thMgr)
Project as in an X-ray microscope using a grids and blobs.
FileName fn_psf_xr
Filename with the Microscope Parameters.
Definition: project_xray.h:91
ParallelTaskDistributor * td
Intensity in the beginning of the volume to project.
Definition: project_xray.h:163
bool save_std_projs
Save standard projections.
Definition: project_xray.h:103
ParallelTaskDistributor * td
Definition: project_xray.h:108
MultidimArray< double > * IgeoZb
Definition: project_xray.h:46
double psfThr
threshold for psfSlabs
Definition: project_xray.h:97
#define sampling
Projection * projOut
Definition: project_xray.h:47
void projectXraySimpleGrid(MultidimArray< double > *vol, const XRayPSF &psf, MultidimArray< double > *IgeoVol, Projection *proj, MultidimArray< double > &projNorm, int FORW, int threadId=-1, int nThreads=1)
MultidimArray< double > * muVol
Definition: project_xray.h:159
void calculateIgeoThread(ThreadArgument &thArg)
XrayProjPhantom phantom
Definition: project_xray.h:105
MultidimArray< double > * IgeoVol
Accumulated Mu == Standard EM projection used as reference for reconstruction.
Definition: project_xray.h:161
int nThr
Number of threads;.
Definition: project_xray.h:101
MultidimArray< double > * IgeoZb
Definition: project_xray.h:204
MultidimArray< double > * muVol
Definition: project_xray.h:44
FileName fn_sel_file
Selection file with all projections.
Definition: project_xray.h:89
ProgClassifyCL2D * prm
MultidimArray< double > * IgeoZb
Igeo accumulated along Z axis.
Definition: project_xray.h:162
MultidimArray< double > * cumMu
Phantom volume.
Definition: project_xray.h:160
MultidimArray< double > rotVol
Definition: project_xray.h:66
void calculateIgeo(MultidimArray< double > &muVol, double sampling, MultidimArray< double > &IgeoVol, MultidimArray< double > &cumMu, MultidimArray< double > &IgeoZb, int nThreads=1, ThreadManager *ThrMgr=nullptr)
Calculate the volume of the information of Igeometric at each plane of the phantom.
file read(std::istream &is)
Definition: pdb2cif.cpp:6200