Xmipp  v3.23.11-Nereus
Public Member Functions | Public Attributes | Protected Member Functions | List of all members

#include <project_tomography.h>

Inheritance diagram for ProgProjectTomography:
Inheritance graph
[legend]
Collaboration diagram for ProgProjectTomography:
Collaboration graph
[legend]

Public Member Functions

virtual void run ()
 
- 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)
 
ParamDefgetParamDef (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 &param, 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 ()
 

Public Attributes

FileName fn_proj_param
 Filename with the Projection_Parameters. More...
 
FileName fn_sel_file
 Selection file with all projections. More...
 
ParametersProjectionTomography projParam
 Projection parameters. More...
 
- Public Attributes inherited from XmippProgram
bool doRun
 
bool runWithoutArgs
 
int verbose
 Verbosity level. More...
 
int debug
 

Protected Member Functions

virtual void defineParams ()
 
virtual void readParams ()
 
- Protected Member Functions inherited from XmippProgram
void defineCommons ()
 

Additional Inherited Members

- Protected Attributes inherited from XmippProgram
int errorCode
 
ProgramDefprogDef
 Program definition and arguments parser. More...
 
std::map< String, CommentListdefaultComments
 
int argc
 Original command line arguments. More...
 
const char ** argv
 

Detailed Description

Definition at line 36 of file project_tomography.h.

Member Function Documentation

◆ defineParams()

void ProgProjectTomography::defineParams ( )
protectedvirtual

Function in which the param of each Program are defined.

Reimplemented from XmippProgram.

Definition at line 30 of file project_tomography.cpp.

31 {
32  addUsageLine("Generate projections as if it were a single axis tomographic series.");
33  addSeeAlsoLine("phantom_create, phantom_project");
34  //Params
35  projParam.defineParams(this);
36  //Examples
37  addExampleLine("Generating a set of projections using a projection parameter:", false);
38  addExampleLine("Generating a single projection at 45 degrees around X axis:", false);
39  addExampleLine("Generating a single projection at 45 degrees around Y axis:", false);
40  //Example projection file
41  addExampleLine("In the following link you can find an example of projection parameter file:",false);
42  addExampleLine(" ",false);
43  addExampleLine("https://sourceforge.net/p/testxmipp/code/ci/master/tree/input/tomoProjection.param?format=raw",false);
44 }
void defineParams(XmippProgram *program)
Definition: projection.cpp:74
void addSeeAlsoLine(const char *seeAlso)
void addExampleLine(const char *example, bool verbatim=true)
ParametersProjectionTomography projParam
Projection parameters.
void addUsageLine(const char *line, bool verbatim=false)

◆ readParams()

void ProgProjectTomography::readParams ( )
protectedvirtual

Function in which each program will read parameters that it need. If some error occurs the usage will be printed out.

Reimplemented from XmippProgram.

Definition at line 46 of file project_tomography.cpp.

47 {
48  projParam.readParams(this);
49 }
void readParams(XmippProgram *program)
Definition: projection.cpp:97
ParametersProjectionTomography projParam
Projection parameters.

◆ run()

void ProgProjectTomography::run ( )
virtual

Main Project routine. Generate a set of projections given the projection parameters. This is the main projecting routine. This function generates a set of projections according to the projecting parameters defined. The projections are written to disk.

The Projection field will keep at the end the last projection, this is useful in case you want to project only one image, although it is also written to disk. The returned number is the total number of projections generated. A selection file with all images is also returned (and saved if any name has been given in the parameters).

Reimplemented from XmippProgram.

Definition at line 51 of file project_tomography.cpp.

52 {
53 
54  Projection proj;
55  MetaDataVec projMD;
56 
58 
61 
62  // Project
63  int expectedNumProjs = FLOOR((projParam.tiltF-projParam.tilt0)/projParam.tiltStep);
64  int numProjs=0;
65 
66  std::cerr << "Projecting ...\n";
67  if (!(projParam.show_angles))
68  init_progress_bar(expectedNumProjs);
69 
70  projMD.setComment("True rot, tilt and psi; rot, tilt, psi, X and Y shifts applied");
71  double tRot,tTilt,tPsi,rot,tilt,psi;
72  FileName fn_proj; // Projection name
73  int idx = 1;
74  size_t objId;
75 
76  int iterAngle=static_cast<int>((projParam.tiltF - projParam.tilt0) / projParam.tiltStep);
77  for (int iangle=0; iangle<=iterAngle; iangle++)
78  {
79  double angle=projParam.tilt0+iangle*projParam.tiltStep;
81  fn_proj = projParam.fnOut;
82  else
83  fn_proj.compose(idx, projParam.fnRoot + ".stk");
84 
85  // Choose Center displacement ........................................
88  Matrix1D<double> inPlaneShift(3);
89  VECTOR_R3(inPlaneShift,shiftX,shiftY,0);
90 
91  projParam.calculateProjectionAngles(proj,angle, 0,inPlaneShift);
92 
93  // Really project ....................................................
97 
98  // Add noise in angles and voxels ....................................
99  proj.getEulerAngles(tRot, tTilt,tPsi);
100 
104 
105  proj.setEulerAngles(rot,tilt,psi);
106 
107  objId = projMD.addObject();
109  {
111  projMD.setValue(MDL_IMAGE,fn_proj,objId);
112  }
113 
114  projMD.setValue(MDL_ANGLE_ROT,rot,objId);
115  projMD.setValue(MDL_ANGLE_TILT,tilt,objId);
116  projMD.setValue(MDL_ANGLE_PSI,psi,objId);
117  projMD.setValue(MDL_ANGLE_ROT2,tRot,objId);
118  projMD.setValue(MDL_ANGLE_TILT2,tTilt,objId);
119  projMD.setValue(MDL_ANGLE_PSI2,tPsi,objId);
120  projMD.setValue(MDL_SHIFT_X,shiftX,objId);
121  projMD.setValue(MDL_SHIFT_Y,shiftY,objId);
122 
123  IMGMATRIX(proj).addNoise(projParam.Npixel_avg, projParam.Npixel_dev, "gaussian");
124 
125  // Save ..............................................................
127  std::cout << idx << "\t" << tRot << "\t"
128  << tTilt << "\t" << tPsi << std::endl;
129  else if ((expectedNumProjs % XMIPP_MAX(1, numProjs / 60))
130  == 0)
131  progress_bar(numProjs);
132 
133  numProjs++;
134  idx++;
135  }
136  if (!projParam.show_angles)
137  progress_bar(expectedNumProjs);
138 
140  {
141  projMD.setComment("Angles rot,tilt and psi contain noisy projection angles and rot2,tilt2 and psi2 contain actual projection angles");
142  projMD.write(projParam.fnRoot + ".sel");
143  }
144 
145  return;
146 }
bool only_create_angles
Only create angles, do not project.
Definition: projection.h:81
void init_progress_bar(long total)
Rotation angle of an image (double,degrees)
double Npixel_dev
Standard deviation of the noise to be added to each pixel grey value.
Definition: projection.h:101
#define XMIPP_MAX(x, y)
Definition: xmipp_macros.h:193
Tilting angle of an image (double,degrees)
FileName fnOut
Output filename (used for a singleProjection)
Definition: projection.h:67
double tilt0
Minimum tilt around this axis.
Definition: projection.h:92
Tilting angle of an image (double,degrees)
Shift for the image in the X axis (double)
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 compose(const String &str, const size_t no, const String &ext="")
Special label to be used when gathering MDs in MpiMetadataPrograms.
void write(const FileName &outFile, WriteModeMetaData mode=MD_OVERWRITE) const
#define IMGMATRIX(I)
double tiltF
Maximum tilt around this axis.
Definition: projection.h:94
virtual void setComment(const String &newComment="No comment")
Rotation angle of an image (double,degrees)
double Npixel_avg
Bias to be applied to each pixel grey value */.
Definition: projection.h:99
int proj_Ydim
Projection Ydim.
Definition: projection.h:78
#define FLOOR(x)
Definition: xmipp_macros.h:240
void produceSideInfo(const ParametersProjectionTomography &prm)
double Ncenter_avg
Bias to apply to the image center.
Definition: projection.h:104
bool setValue(const MDObject &mdValueIn, size_t id)
size_t addObject() override
double Ncenter_dev
Standard deviation of the image center.
Definition: projection.h:106
void progress_bar(long rlen)
void getEulerAngles(double &rot, double &tilt, double &psi, const size_t n=0) const
double Nangle_dev
Standard deviation of the angles.
Definition: projection.h:111
int proj_Xdim
Projection Xdim.
Definition: projection.h:76
void calculateProjectionAngles(Projection &P, double angle, double inplaneRot, const Matrix1D< double > &sinplane)
Definition: projection.cpp:277
Psi angle of an image (double,degrees)
FileName fnRoot
Root filename (used for a stack)
Definition: projection.h:65
void setEulerAngles(double rot, double tilt, double psi, const size_t n=0)
bool singleProjection
Only project a single image.
Definition: projection.h:69
double psi(const double x)
double rnd_gaus()
#define VECTOR_R3(v, x, y, z)
Definition: matrix1d.h:124
#define ALL_IMAGES
ParametersProjectionTomography projParam
Projection parameters.
double tiltStep
Step in tilt.
Definition: projection.h:96
Shift for the image in the Y axis (double)
void projectVolumeOffCentered(MultidimArray< double > &V, Projection &P, int Ydim, int Xdim)
Definition: projection.cpp:594
unsigned int randomize_random_generator()
Name of an image (std::string)
Image< double > phantomVol
Phantom Xmipp volume.
double Nangle_avg
Bias to apply to the angles.
Definition: projection.h:109

Member Data Documentation

◆ fn_proj_param

FileName ProgProjectTomography::fn_proj_param

Filename with the Projection_Parameters.

Definition at line 40 of file project_tomography.h.

◆ fn_sel_file

FileName ProgProjectTomography::fn_sel_file

Selection file with all projections.

Definition at line 42 of file project_tomography.h.

◆ projParam

ParametersProjectionTomography ProgProjectTomography::projParam

Projection parameters.

Definition at line 44 of file project_tomography.h.


The documentation for this class was generated from the following files: