63 else if (type==
"histogram")
65 up_down_correction =
checkParam(
"--up_down_correction");
70 addUsageLine(
"Shows which is the angular distribution of a set of projections.");
71 addUsageLine(
"+There are three kinds of outputs: a bild file (chimera understands this format), a distance histogram and a postscript file. ");
72 addUsageLine(
"+In postcript, each projection is represented by a small isosceles triangles (the longest part is pointing to Y in the projection plane). ");
73 addUsageLine(
"+In chimera, each projection direction has a sphere whose radius is proportional to the number of images assigned to it");
74 addUsageLine(
"+The histogram output is the histogram of the minimum distance (in degrees) among projections. The distance is measured on the sphere surface. This gives an idea of how compact is the angular distribution.");
75 addParamsLine(
" -i <metadata> : Metadata file with the angles");
78 addParamsLine(
" chimera <R=60> <rmax=1.5> <shift_center=0> : R=sphere radius, rmax=maximum point radius, shift_center=shift in pixels applied to all coordinates");
79 addParamsLine(
" : shift_center should be half the volume size and R should be 2/3 the volume size");
80 addParamsLine(
" ps <R=60> <rmax=1.5> <rot=0> <tilt=30> <solid_sphere=0> : R=sphere radius, rmax=maximum point radius, rot and tilt defines the point of view, solid_sphere=0 (=no) or 1 (=yes)");
81 addParamsLine(
" : If the sphere is solid, projections in the back plane are not shown");
82 addParamsLine(
" histogram <stepno=100> : Number of divisions in the histogram");
83 addParamsLine(
"[--up_down_correction] : correct angles so that a semisphere is shown");
91 size_t AngleNo = angles.
size();
95 double maxWeight = -99.e99;
102 for (
size_t objId : angles.
ids())
110 double imaxWeight=1.0/maxWeight;
113 std::vector< Matrix1D<double> > v, v_ang;
115 v_ang.reserve(AngleNo);
118 for (
size_t objId : angles.
ids())
120 double rot, tilt,
psi;
124 if (up_down_correction && fabs(tilt)>90)
126 Euler_up_down(rot,tilt,psi,rot,tilt,psi);
130 v_ang.push_back(aux_ang);
133 if (type==
"histogram")
138 for (
size_t i = 0;
i < AngleNo;
i++)
141 for (
size_t j =
i + 1;
j < AngleNo;
j++)
146 double d = acos(
XX(vi)*
XX(vj) +
YY(vi)*
YY(vj) +
ZZ(vi)*
ZZ(vj));
157 dist_hist.
write(fnOut);
159 else if (type==
"chimera")
161 std::ofstream fh_bild;
162 fh_bild.open(fnOut.c_str(), std::ios::out);
165 fh_bild <<
".color 1 0 0" << std::endl;
168 for (
int i=0;
i<imax;
i++)
175 << R*
XX(v[
i]) + shift_center <<
" " 176 << R*
YY(v[i]) + shift_center <<
" " 177 << R*
ZZ(v[i]) + shift_center <<
" " 186 fh_ps.open(fnOut.c_str(), std::ios::out);
190 fh_ps <<
"%%!PS-Adobe-2.0\n";
191 fh_ps <<
"%% Creator: Angular Distribution\n";
192 fh_ps <<
"%% Title: Angular distribution of " << fnIn <<
"\n";
193 fh_ps <<
"%% Pages: 1\n";
197 y=400.0f-x*250.0f/60; \ 198 x=300.0f+tmp*250.0f/60; 203 euler_view.
getRow(2, view_direction);
206 for (
int i=0;
i<imax;
i++)
246 double d=
XX(p0)*
XX(view_direction)+
247 YY(p0)*
YY(view_direction)+
248 ZZ(p0)*
ZZ(view_direction);
256 fh_ps <<
"newpath\n";
257 fh_ps <<
XX(pp) <<
" " <<
YY(pp) <<
" moveto\n";
261 fh_ps <<
XX(pp) <<
" " <<
YY(pp) <<
" lineto\n";
265 fh_ps <<
XX(pp) <<
" " <<
YY(pp) <<
" lineto\n";
269 fh_ps <<
XX(pp) <<
" " <<
YY(pp) <<
" lineto\n";
271 fh_ps <<
"closepath\nstroke\n";
273 fh_ps <<
"showpage\n";
double getDoubleParam(const char *param, int arg=0)
#define REPORT_ERROR(nerr, ErrormMsg)
void Euler_angles2matrix(T alpha, T beta, T gamma, Matrix2D< T > &A, bool homogeneous)
void Euler_direction(double alpha, double beta, double gamma, Matrix1D< double > &v)
Couldn't write to file.
Matrix2D< T > transpose() const
#define MAT_ELEM(m, i, j)
#define DIRECT_A1D_ELEM(v, i)
const char * getParam(const char *param, int arg=0)
void compute_hist(const MultidimArrayGeneric &array, Histogram1D &hist, int no_steps)
double psi(const double x)
void write(const FileName &fn, MDLabel=MDL_X, MDLabel=MDL_COUNT)
#define VECTOR_R3(v, x, y, z)
bool checkParam(const char *param)
void addUsageLine(const char *line, bool verbatim=false)
void initZeros(const MultidimArray< T1 > &op)
int getIntParam(const char *param, int arg=0)
void getRow(size_t i, Matrix1D< T > &v) const
void Uproject_to_plane(const Matrix1D< double > &point, const Matrix1D< double > &direction, double distance, Matrix1D< double > &result)
void addParamsLine(const String &line)