49 addUsageLine(
"Apply a geometrical transformation to a phantom description or PDB.");
51 addParamsLine(
" -i <file> : Phantom description file (.descr) or PDB (.pdb)");
52 addParamsLine(
"[-o <file=\"\">] : Phantom description file (.descr) or PDB (.pdb)");
53 addParamsLine(
" : For PDB files, you must explicitly give an output file, different from input");
58 addParamsLine(
" rotate_euler <rot> <tilt> <psi> :Rotate with these Euler angles ");
59 addParamsLine(
" rotate_align_with_z <x> <y> <z> : Align (x,y,z) with Z");
60 addParamsLine(
" rotate_axis <x> <y> <z> <ang>: Rotate <ang> degrees around (x,y,z)");
61 addParamsLine(
" [--center_pdb] : Subtract the center of mass from coordinates.");
63 addExampleLine(
"xmipp_phantom_transform -i model.pdb -o shifted.pdb --operation shift 1 2 3");
78 Euler_mode = Align_mode = Axis_mode =
false;
81 if (operation==
"shift")
88 else if (operation==
"scale")
95 else if (operation==
"rotate_euler")
103 else if (operation==
"rotate_align_with_z")
112 else if (operation==
"rotate_axis")
124 A3D(0, 3) =
XX(shift);
125 A3D(1, 3) =
YY(shift);
126 A3D(2, 3) =
ZZ(shift);
129 A3D(0, 0) *=
XX(scale);
130 A3D(0, 1) *=
YY(scale);
131 A3D(0, 2) *=
ZZ(scale);
132 A3D(1, 0) *=
XX(scale);
133 A3D(1, 1) *=
YY(scale);
134 A3D(1, 2) *=
ZZ(scale);
135 A3D(2, 0) *=
XX(scale);
136 A3D(2, 1) *=
YY(scale);
137 A3D(2, 2) *=
ZZ(scale);
144 std::cout <<
"Input file : " << fn_in << std::endl
145 <<
"Output file: " << fn_out << std::endl;
147 std::cout <<
"Input file is PDB\n";
149 std::cout <<
"Centering PDB\n";
151 std::cout <<
"Euler angles (rot, tilt, psi): " << rot <<
" " << tilt
152 <<
" " << psi << std::endl;
154 std::cout <<
"Aligning " << axis.
transpose() <<
" with Z\n";
156 std::cout <<
"Rotating " << ang <<
" degrees around " 158 std::cout <<
"Transformation matrix\n" << A3D << std::endl;
169 P.
read(fn_in,
false);
double getDoubleParam(const char *param, int arg=0)
void applyGeometryToPDBFile(const std::string &fn_in, const std::string &fn_out, const Matrix2D< double > &A, bool centerPDB, const std::string &intensityColumn)
void Euler_angles2matrix(T alpha, T beta, T gamma, Matrix2D< T > &A, bool homogeneous)
Matrix1D< double > vectorR3(double x, double y, double z)
Matrix1D< T > transpose() const
void addSeeAlsoLine(const char *seeAlso)
const char * getParam(const char *param, int arg=0)
void write(const FileName &fn_phantom="")
void resize(size_t Xdim, bool copy=true)
void addExampleLine(const char *example, bool verbatim=true)
void read(const FileName &fn_phantom, bool apply_scale=true)
int verbose
Verbosity level.
bool contains(const String &str) const
bool checkParam(const char *param)
void addUsageLine(const char *line, bool verbatim=false)
void selfApplyGeometry(const Matrix2D< double > &A, int inv)
void addParamsLine(const String &line)