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

#include <project.h>

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

Public Member Functions

void readParams ()
 
void defineParams ()
 
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 fnPhantom
 
FileName fnOut
 Output filename (used for a singleProjection or a stack) More...
 
FileName fn_crystal
 
FileName fn_sym
 Symmetry file. More...
 
int projSize
 Projection size when fnOut is given. More...
 
double samplingRate
 Sampling rate: Only used for PDB projections. More...
 
double highTs
 High sampling rate: Only used for PDB projections. More...
 
bool only_create_angles
 Only create angles, do not project. More...
 
bool singleProjection
 Single projection. More...
 
double rotSingle
 Rotational angle of a single projection. More...
 
double tiltSingle
 Tilt angle of a single projection. More...
 
double psiSingle
 Psi angle of a single projection. More...
 
double xShift
 
double yShift
 
projectionType projType
 Type of projection algorithm. More...
 
double paddFactor
 The padding factor for Fourier projection. More...
 
double maxFrequency
 The maximum frequency for Fourier projection. More...
 
int BSplineDeg
 The type of interpolation (NEAR. More...
 
- Public Attributes inherited from XmippProgram
bool doRun
 
bool runWithoutArgs
 
int verbose
 Verbosity level. More...
 
int debug
 

Additional Inherited Members

- Protected Member Functions inherited from XmippProgram
void defineCommons ()
 
- 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

Parameter class for the project program

Definition at line 45 of file project.h.

Member Function Documentation

◆ defineParams()

void ProgProject::defineParams ( )
virtual

Define parameters

Reimplemented from XmippProgram.

Definition at line 91 of file project.cpp.

92 {
93  addUsageLine("This program is able to generate a set of projections from a volume. ");
94  addUsageLine("++The projection is done using the information directly or from a file.");
95  addSeeAlsoLine("tomo_project,phantom_create");
96 
97  addParamsLine(" -i <volume_file> : Voxel volume, PDB or description file");
98  addParamsLine(" -o <image_file> : Output stack or image");
99  addParamsLine(" [--sampling_rate <Ts=1>] : It is only used for PDB phantoms");
100  addParamsLine(" [--high_sampling_rate <highTs=0.08333333>] : Sampling rate before downsampling. It is only used for PDB phantoms");
101  addParamsLine(" [--method <method=real_space>] : Projection method");
102  addParamsLine(" where <method>");
103  addParamsLine(" real_space : Makes projections by ray tracing in real space");
104  addParamsLine(" shears : Use real-shears algorithm");
105  addParamsLine(" :+This algorithm is slower but more accurate. For a full description see");
106  addParamsLine(" fourier <pad=2> <maxfreq=0.25> <interp=bspline> : Takes a central slice in Fourier space");
107  addParamsLine(" :+++ %BR% ");
108  addParamsLine(" : pad: controls the padding factor.");
109  addParamsLine(" :+++ %BR% ");
110  addParamsLine(" : maxfreq: is the maximum frequency for the pixels and by default ");
111  addParamsLine(" : pixels with frequency more than 0.25 are not considered.");
112  addParamsLine(" :+++ %BR% ");
113  addParamsLine(" : interp: is the method for interpolation and the values can be: ");
114  addParamsLine(" :+++ %BR% ");
115  addParamsLine(" : nearest: Nearest Neighborhood ");
116  addParamsLine(" :+++ %BR% ");
117  addParamsLine(" : linear: Linear BSpline ");
118  addParamsLine(" :+++ %BR% ");
119  addParamsLine(" : bspline: Cubic BSpline ");
120  addParamsLine("== Generating a set of projections == ");
121  addParamsLine(" [--params <parameters_file>] : File containing projection parameters");
122  addParamsLine(" : Check the manual for a description of the parameters");
123  addParamsLine(" : tilt angle should be in the range [0-180]");
124  addParamsLine(" [--sym <sym_file>] : It is used for computing the asymmetric unit");
125  addParamsLine(" [--only_create_angles] : Do not create projections");
126  addParamsLine("== Generating a single projection == ");
127  addParamsLine(" [--angles <rot> <tilt> <psi> <x=0.> <y=0.>]: Angles and shifts for a single projection");
128  addParamsLine(" [--xdim <size=-1>] : Size of the projection");
129  addParamsLine(" : For geometric descriptions and voxel volumes");
130  addParamsLine(" : this parameter is not necessary");
131  addExampleLine("Generating a set of projections using fourier method",false);
132  addExampleLine("xmipp_phantom_project -i volume.vol -o images.stk --method fourier 3 0.25 bspline --params uniformProjection_xmd.param");
133  addExampleLine("Generating a set of projections using shears method",false);
134  addExampleLine("xmipp_phantom_project -i volume.vol -o images.stk --method shears --params uniformProjection_xmd.param");
135  addExampleLine("Generating a top view from Z",false);
136  addExampleLine("xmipp_phantom_project -i volume.vol -o image.xmp --angles 0 0 0");
137  addExampleLine("Generating a side view from Y",false);
138  addExampleLine("xmipp_phantom_project -i volume.vol -o image.xmp --angles 90 90 0");
139  addExampleLine("Generating a side view from X",false);
140  addExampleLine("xmipp_phantom_project -i volume.vol -o image.xmp --angles 0 90 0");
141  addExampleLine("+++In the following links you can find some examples of projection parameter files",false);
142  addExampleLine("+++",false);
143  addExampleLine("+++http://sourceforge.net/p/testxmipp/code/ci/master/tree/input/phantomProject.param?format=raw",false);
144  addExampleLine("+++",false);
145  addExampleLine("+++http://sourceforge.net/p/testxmipp/code/ci/master/tree/input/uniformProjection_xmd.param?format=raw",false);
146  addExampleLine("+++",false);
147  addExampleLine("+++http://sourceforge.net/p/testxmipp/code/ci/master/tree/input/clusterProjection_xmd.param?format=raw",false);
148  addExampleLine("+++",false);
149  addExampleLine("+++Creating a 2D crystal",false);
150  addExampleLine("+In order to create a 2D crystal, you can pass --params as a projection file with a second block for crystal projection.: ",false);
151  addExampleLine("+xmipp_phantom_project -i cylinder_with_axis.descr --oroot MRCproj --params MRCCrystalProj_xmd.param");
152  addExampleLine("+++In the following links you can find some examples of projection parameter files",false);
153  addExampleLine("+++",false);
154  addExampleLine("+++http://sourceforge.net/p/testxmipp/code/ci/master/tree/input/Crystal/MRCCrystalProj_xmd.param?format=raw",false);
155  addExampleLine("+++",false);
156  addExampleLine("+++ http://sourceforge.net/p/testxmipp/code/ci/master/tree/input/Crystal/cylinder_with_axis.descr?format=raw",false);
157  addExampleLine("+++",false);
158  addExampleLine("+++http://sourceforge.net/p/testxmipp/code/ci/master/tree/input/Crystal/MRC_crystal_projection_xmd.param?format=raw",false);
159 
160  addExampleLine("+++",false);
161  addExampleLine("+++Figures (a) and (b) show the achievable resolution for different methods of projection. ",false);
162  addExampleLine("+++",false);
163  addExampleLine("+++<img width='100%' alt='Test_Resolution_Small.jpg' src='%ATTACHURLPATH%/Test_Resolution_Small.jpg' height='100%' />");
164  addExampleLine("+++",false);
165  addExampleLine("+++(a) The achievable resolution for different methods for a volume of size 64*64",false);
166  addExampleLine("+++",false);
167  addExampleLine("+++ <img width='100%' alt='Test_Resolution_Big.jpg' src='%ATTACHURLPATH%/Test_Resolution_Big.jpg' height='100%' />");
168  addExampleLine("+++",false);
169  addExampleLine("+++(b) The achievable resolution for different methods for a volume of size 400*400",false);
170  addExampleLine("+++",false);
171  addExampleLine("+++As it can be seen in these two figures, Fourier method with cubic B-Spline interpolation for both padding two and padding one provides the best resolution. However, there is a preference on padding one because of less memory and time complexity.",false);
172 }
void addSeeAlsoLine(const char *seeAlso)
void addExampleLine(const char *example, bool verbatim=true)
void addUsageLine(const char *line, bool verbatim=false)
void addParamsLine(const String &line)

◆ readParams()

void ProgProject::readParams ( )
virtual

Read parameters.

Reimplemented from XmippProgram.

Definition at line 35 of file project.cpp.

36 {
37  fnPhantom = getParam("-i");
38  fnOut = getParam("-o");
39  samplingRate = getDoubleParam("--sampling_rate");
40  highTs = getDoubleParam("--high_sampling_rate");
41  singleProjection = false;
42  if (STR_EQUAL(getParam("--method"), "real_space"))
44  if (STR_EQUAL(getParam("--method"), "shears"))
45  projType = SHEARS;
46  if (STR_EQUAL(getParam("--method"), "fourier"))
47  {
48  projType = FOURIER;
49  paddFactor = getDoubleParam("--method", 1);
50  maxFrequency = getDoubleParam("--method", 2);
51  String degree = getParam("--method", 3);
52  if (degree == "nearest")
54  else if (degree == "linear")
56  else if (degree == "bspline")
58  else
59  REPORT_ERROR(ERR_ARG_BADCMDLINE, "The values for interpolation can be : nearest, linear, bspline");
60 
61  }
62  bool doParams = checkParam("--params");
63  bool doAngles = checkParam("--angles");
64 
65  if (doParams && doAngles)
66  REPORT_ERROR(ERR_ARG_BADCMDLINE, "--params and --angles are mutually exclusive");
67  else if (!doParams && !doAngles)
68  REPORT_ERROR(ERR_ARG_BADCMDLINE, "You should provide --params or --angles");
69 
70  if (doParams)
71  {
72  fn_proj_param = getParam("--params");
73  if (checkParam("--sym"))
74  fn_sym = getParam("--sym");
75  only_create_angles = checkParam("--only_create_angles");
76  }
77  else //doAngles = true
78  {
79  singleProjection = true;
80  only_create_angles = false;
81  projSize = getIntParam("--xdim");
82  rotSingle = getDoubleParam("--angles",0);
83  tiltSingle = getDoubleParam("--angles",1);
84  psiSingle = getDoubleParam("--angles",2);
85  xShift = getDoubleParam("--angles",3);
86  yShift = getDoubleParam("--angles",4);
87  }
88 }
double highTs
High sampling rate: Only used for PDB projections.
Definition: project.h:65
Errors on command line parameters.
Definition: xmipp_error.h:112
constexpr int FOURIER
projectionType projType
Type of projection algorithm.
Definition: project.h:81
double getDoubleParam(const char *param, int arg=0)
double paddFactor
The padding factor for Fourier projection.
Definition: project.h:83
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
bool singleProjection
Single projection.
Definition: project.h:69
double maxFrequency
The maximum frequency for Fourier projection.
Definition: project.h:85
double xShift
Definition: project.h:77
Definition: project.h:42
FileName fnOut
Output filename (used for a singleProjection or a stack)
Definition: project.h:54
double yShift
Definition: project.h:79
double tiltSingle
Tilt angle of a single projection.
Definition: project.h:73
FileName fn_proj_param
Filename with the Projection_Parameters.
Definition: project.h:49
const char * getParam(const char *param, int arg=0)
double rotSingle
Rotational angle of a single projection.
Definition: project.h:71
double psiSingle
Psi angle of a single projection.
Definition: project.h:75
FileName fn_sym
Symmetry file.
Definition: project.h:59
bool only_create_angles
Only create angles, do not project.
Definition: project.h:67
#define STR_EQUAL(str1, str2)
Definition: xmipp_strings.h:42
int BSplineDeg
The type of interpolation (NEAR.
Definition: project.h:87
std::string String
Definition: xmipp_strings.h:34
bool checkParam(const char *param)
double samplingRate
Sampling rate: Only used for PDB projections.
Definition: project.h:63
int getIntParam(const char *param, int arg=0)
int projSize
Projection size when fnOut is given.
Definition: project.h:61
FileName fnPhantom
Definition: project.h:52

◆ run()

void ProgProject::run ( )
virtual

Run

Reimplemented from XmippProgram.

Definition at line 175 of file project.cpp.

176 {
177  Projection proj;
178  MetaDataVec SF;
179  ROUT_project(*this, proj, SF);
180 }
int ROUT_project(ProgProject &prm, Projection &proj, MetaData &SF)
Definition: project.cpp:1174

Member Data Documentation

◆ BSplineDeg

int ProgProject::BSplineDeg

The type of interpolation (NEAR.

Definition at line 87 of file project.h.

◆ fn_crystal

FileName ProgProject::fn_crystal

Filename with the special crystal parameters (Crystal_Projection_Parameters )

Definition at line 57 of file project.h.

◆ fn_proj_param

FileName ProgProject::fn_proj_param

Filename with the Projection_Parameters.

Definition at line 49 of file project.h.

◆ fn_sym

FileName ProgProject::fn_sym

Symmetry file.

Definition at line 59 of file project.h.

◆ fnOut

FileName ProgProject::fnOut

Output filename (used for a singleProjection or a stack)

Definition at line 54 of file project.h.

◆ fnPhantom

FileName ProgProject::fnPhantom

Phantom filename. It can be a Xmipp volume or a mathematically defined phantom.

Definition at line 52 of file project.h.

◆ highTs

double ProgProject::highTs

High sampling rate: Only used for PDB projections.

Definition at line 65 of file project.h.

◆ maxFrequency

double ProgProject::maxFrequency

The maximum frequency for Fourier projection.

Definition at line 85 of file project.h.

◆ only_create_angles

bool ProgProject::only_create_angles

Only create angles, do not project.

Definition at line 67 of file project.h.

◆ paddFactor

double ProgProject::paddFactor

The padding factor for Fourier projection.

Definition at line 83 of file project.h.

◆ projSize

int ProgProject::projSize

Projection size when fnOut is given.

Definition at line 61 of file project.h.

◆ projType

projectionType ProgProject::projType

Type of projection algorithm.

Definition at line 81 of file project.h.

◆ psiSingle

double ProgProject::psiSingle

Psi angle of a single projection.

Definition at line 75 of file project.h.

◆ rotSingle

double ProgProject::rotSingle

Rotational angle of a single projection.

Definition at line 71 of file project.h.

◆ samplingRate

double ProgProject::samplingRate

Sampling rate: Only used for PDB projections.

Definition at line 63 of file project.h.

◆ singleProjection

bool ProgProject::singleProjection

Single projection.

Definition at line 69 of file project.h.

◆ tiltSingle

double ProgProject::tiltSingle

Tilt angle of a single projection.

Definition at line 73 of file project.h.

◆ xShift

double ProgProject::xShift

Definition at line 77 of file project.h.

◆ yShift

double ProgProject::yShift

Definition at line 79 of file project.h.


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