37 #define x0 STARTINGX(IMGMATRIX(proj)) 38 #define xF FINISHINGX(IMGMATRIX(proj)) 39 #define y0 STARTINGY(IMGMATRIX(proj)) 40 #define yF FINISHINGY(IMGMATRIX(proj)) 41 #define xDim XSIZE(IMGMATRIX(proj)) 42 #define yDim YSIZE(IMGMATRIX(proj)) 76 program->
addParamsLine(
" -i <volume_file> : Volume file to be projected.");
78 program->
addParamsLine(
" --oroot <rootname> : Output rootname");
83 program->
addParamsLine(
"== Generating a set of projections == ");
84 program->
addParamsLine(
" [--params <parameters_file>] : File containing projection parameters");
85 program->
addParamsLine(
" : Check the manual for a description of the parameters");
87 program->
addParamsLine(
"== Generating a single projection == ");
88 program->
addParamsLine(
" [--angles <tilt> <axisRot=90> <axisTilt=90>] : Tilt angle for a single projection.");
89 program->
addParamsLine(
" : (axisRot, axisTilt) is the direction of the rotation axis." );
92 program->
addParamsLine(
"[--show_angles] : Print angles value for each projection.");
93 program->
addParamsLine(
"[--only_create_angles] : Projections are not calculated, only the angles values.");
135 MD.
read(fn_proj_param);
138 std::vector<double> vecD;
189 if ((fh_param = fopen(fn_proj_param.c_str(),
"r")) ==
nullptr)
191 (std::string)
"ParametersProjectionTomography::read: There is a problem " 192 "opening the file " + fn_proj_param);
193 while (fgets(line, 200, fh_param) !=
nullptr)
212 if (auxstr !=
nullptr)
244 if (auxstr !=
nullptr)
253 if (auxstr !=
nullptr)
262 if (auxstr !=
nullptr)
272 "couldn't read all parameters from file " + fn_proj_param);
298 if (angle * tilt < 0)
321 <<
" axis=" << axis.
transpose() << std::endl
322 <<
"angle=" << angle << std::endl
323 <<
"Raxis\n" << Raxis
324 <<
"Rinplane\n" << Rinplane
325 <<
"Raxis*Rinplane\n" << Raxis*Rinplane
326 <<
"rot=" << rot <<
" tilt=" << tilt <<
" psi=" << psi
330 std::cout <<
"E\n" << E << std::endl;
338 double rot,
double tilt,
double psi,
357 double step = 1.0 / 3.0;
371 double half_x_sign = 0.5 * x_sign;
372 double half_y_sign = 0.5 * y_sign;
373 double half_z_sign = 0.5 * z_sign;
389 double ray_sum = 0.0;
392 for (
int rays_per_pixel = 0; rays_per_pixel < 4; rays_per_pixel++)
395 switch (rays_per_pixel)
412 if (roffset!=
nullptr)
415 XX(p1_shifted)=
XX(p1)-half_x_sign;
416 YY(p1_shifted)=
YY(p1)-half_y_sign;
417 ZZ(p1_shifted)=
ZZ(p1)-half_z_sign;
421 double alpha_xmin = (x_0 - 0.5 -
XX(p1))* iXXP_direction;
422 double alpha_xmax = (x_F + 0.5 -
XX(p1))* iXXP_direction;
423 double alpha_ymin = (y_0 - 0.5 -
YY(p1))* iYYP_direction;
424 double alpha_ymax = (y_F + 0.5 -
YY(p1))* iYYP_direction;
425 double alpha_zmin = (z_0 - 0.5 -
ZZ(p1))* iZZP_direction;
426 double alpha_zmax = (z_F + 0.5 -
ZZ(p1))* iZZP_direction;
430 if (alpha_xmin<alpha_xmax)
440 double alpha_min=auxMin;
441 double alpha_max=auxMax;
442 if (alpha_ymin<alpha_ymax)
452 alpha_min=
fmax(auxMin,alpha_min);
453 alpha_max=fmin(auxMax,alpha_max);
454 if (alpha_zmin<alpha_zmax)
464 alpha_min=
fmax(auxMin,alpha_min);
465 alpha_max=fmin(auxMax,alpha_max);
471 std::cout <<
"Pixel: " << r_p.
transpose() << std::endl
472 <<
"Univ: " << p1.
transpose() << std::endl
474 <<
"Alpha x:" << alpha_xmin <<
" " << alpha_xmax << std::endl
477 <<
"Alpha y:" << alpha_ymin <<
" " << alpha_ymax << std::endl
480 <<
"Alpha z:" << alpha_zmin <<
" " << alpha_zmax << std::endl
483 <<
"alpha :" << alpha_min <<
" " << alpha_max << std::endl
502 xx_idxd = xx_idx =
CLIP(xx_idx, x_0, x_F);
503 yy_idxd = yy_idx =
CLIP(yy_idx, y_0, y_F);
504 zz_idxd = zz_idx =
CLIP(zz_idx, z_0, z_F);
508 std::cout <<
"First voxel: " << v.
transpose() << std::endl;
509 std::cout <<
" First index: " << idx.
transpose() << std::endl;
510 std::cout <<
" Alpha_min: " << alpha_min << std::endl;
514 double alpha = alpha_min;
518 std::cout <<
" \n\nCurrent Value: " << V(zz_idx, yy_idx, xx_idx) << std::endl;
521 double alpha_x = (xx_idxd -
XX(p1_shifted))* iXXP_direction;
522 double alpha_y = (yy_idxd -
YY(p1_shifted))* iYYP_direction;
523 double alpha_z = (zz_idxd -
ZZ(p1_shifted))* iZZP_direction;
527 double diffx = fabs(alpha-alpha_x);
528 double diffy = fabs(alpha-alpha_y);
529 double diffz = fabs(alpha-alpha_z);
531 double diff_alpha=diffx;
532 if (diffy<diff_alpha)
537 if (diffz<diff_alpha)
542 ray_sum += diff_alpha *
A3D_ELEM(V, zz_idx, yy_idx, xx_idx);
563 std::cout <<
"Alpha x,y,z: " << alpha_x <<
" " << alpha_y
564 <<
" " << alpha_z <<
" ---> " << alpha << std::endl;
570 std::cout <<
" Next entry point: " << v.
transpose() << std::endl
571 <<
" Index: " << idx.
transpose() << std::endl
572 <<
" diff_alpha: " << diff_alpha << std::endl
573 <<
" ray_sum: " << ray_sum << std::endl
574 <<
" Alfa tot: " << alpha <<
"alpha_max: " << alpha_max <<
585 std::cout <<
"Assigning P(" <<
i <<
"," <<
j <<
")=" << ray_sum << std::endl;
633 double half_x_sign = 0.5 * x_sign;
634 double half_y_sign = 0.5 * y_sign;
635 double half_z_sign = 0.5 * z_sign;
662 double alpha_min =
fmax(fmin(alpha_xmin, alpha_xmax),
663 fmin(alpha_ymin, alpha_ymax));
664 alpha_min =
fmax(alpha_min, fmin(alpha_zmin, alpha_zmax));
665 double alpha_max = fmin(
fmax(alpha_xmin, alpha_xmax),
666 fmax(alpha_ymin, alpha_ymax));
667 alpha_max = fmin(alpha_max,
fmax(alpha_zmin, alpha_zmax));
683 std::cout <<
"First voxel: " << v.
transpose() << std::endl;
684 std::cout <<
" First index: " << idx.
transpose() << std::endl;
685 std::cout <<
" Alpha_min: " << alpha_min << std::endl;
689 double alpha = alpha_min;
693 std::cout <<
" \n\nCurrent Value: " << V(
ZZ(idx),
YY(idx),
XX(idx)) << std::endl;
702 double diffx =
ABS(alpha - alpha_x);
703 double diffy =
ABS(alpha - alpha_y);
704 double diffz =
ABS(alpha - alpha_z);
706 double diff_alpha = fmin(fmin(diffx, diffy), diffz);
730 std::cout <<
"Assigning P(" <<
i <<
"," <<
j <<
")=" << ray_sum << std::endl;
769 #define wrap_as_Crystal(x,y,xw,yw) \ 770 xw=(int) intWRAP(x,x0,xF); \ 771 yw=(int) intWRAP(y,y0,yF); 841 Eulerg = proj.
euler * D;
852 double rot, tilt,
psi;
854 std::cout <<
"rot= " << rot <<
" tilt= " << tilt
855 <<
" psi= " << psi << std::endl;
856 std::cout <<
"D\n" << D << std::endl;
857 std::cout <<
"Eulerf\n" << proj.
euler << std::endl;
858 std::cout <<
"Eulerg\n" << Eulerg << std::endl;
859 std::cout <<
"aint " << aint.
transpose() << std::endl;
860 std::cout <<
"bint " << bint.
transpose() << std::endl;
861 std::cout <<
"prjaint " << prjaint.
transpose() << std::endl;
862 std::cout <<
"prjbint " << prjbint.
transpose() << std::endl;
885 prjOrigin +=
XX(shift) * prjaint +
YY(shift) * prjbint;
889 std::cout <<
"prjX " << prjX.
transpose() << std::endl;
890 std::cout <<
"prjY " << prjY.
transpose() << std::endl;
891 std::cout <<
"prjZ " << prjZ.
transpose() << std::endl;
892 std::cout <<
"prjOrigin " << prjOrigin.
transpose() << std::endl;
902 A(0, 0) =
YY(prjbint) *
xDim;
903 A(0, 1) = -
XX(prjbint) *
xDim;
904 A(1, 0) = -
YY(prjaint) *
yDim;
905 A(1, 1) =
XX(prjaint) *
yDim;
906 double nor = 1 / (
XX(prjaint) *
YY(prjbint) -
XX(prjbint) *
YY(prjaint));
912 std::cout <<
"A\n" << A << std::endl;
913 std::cout <<
"Ainv\n" << Ainv << std::endl;
914 std::cout <<
"Check that A*prjaint=(Xdim,0) " 916 std::cout <<
"Check that A*prjbint=(0,Ydim) " 918 std::cout <<
"Check that Ainv*(Xdim,0)=prjaint " 920 std::cout <<
"Check that Ainv*(0,Ydim)=prjbint " 936 XX(c1) =
XX(footprint_size);
937 YY(c1) =
YY(footprint_size);
942 XX(deffootprint_size) =
fmax(fabs(
XX(c1)), fabs(
XX(c2)));
943 YY(deffootprint_size) =
fmax(fabs(
YY(c1)), fabs(
YY(c2)));
947 std::cout <<
"Footprint_size " << footprint_size.
transpose() << std::endl;
948 std::cout <<
"c1: " << c1.
transpose() << std::endl;
949 std::cout <<
"c2: " << c2.
transpose() << std::endl;
950 std::cout <<
"Deformed Footprint_size " << deffootprint_size.
transpose()
956 auto ZZ_lowest = (int)
ZZ(grid.
lowest);
959 auto ZZ_highest = (int)
ZZ(grid.
highest);
972 beginZ = (double)XX_lowest * prjX + (
double)YY_lowest * prjY + (double)ZZ_lowest * prjZ + prjOrigin;
976 std::cout <<
"BeginZ " << beginZ.
transpose() << std::endl;
977 std::cout <<
"Mask ";
979 std::cout << std::endl;
982 std::cout << std::endl;
983 std::cout <<
"Proj ";
985 std::cout << std::endl;
986 std::cout <<
"Norm Proj ";
987 norm_proj().printShape();
988 std::cout << std::endl;
998 for (k = ZZ_lowest; k <= ZZ_highest; k++)
1002 for (i = YY_lowest; i <= YY_highest; i++)
1006 for (j = XX_lowest; j <= XX_highest; j++)
1011 std::cout <<
"Visiting " << i <<
" " << j << std::endl;
1023 XX_corner1 =
CEIL(
XX(defactprj) -
XX(deffootprint_size));
1024 YY_corner1 =
CEIL(
YY(defactprj) -
YY(deffootprint_size));
1025 XX_corner2 =
FLOOR(
XX(defactprj) +
XX(deffootprint_size));
1026 YY_corner2 =
FLOOR(
YY(defactprj) +
YY(deffootprint_size));
1030 std::cout <<
" k= " << k <<
" i= " << i <<
" j= " << j << std::endl;
1031 std::cout <<
" Actual position: " << actprj.
transpose() << std::endl;
1032 std::cout <<
" Deformed position: " << defactprj.
transpose() << std::endl;
1033 std::cout <<
" Blob corners: (" << XX_corner1 <<
"," << YY_corner1
1034 <<
") (" << XX_corner2 <<
"," << YY_corner2 <<
")\n";
1054 for (
y = YY_corner1;
y <= YY_corner2;
y++)
1055 for (
x = XX_corner1;
x <= XX_corner2;
x++)
1065 std::cout <<
" Studying: " << r.
transpose()
1067 <<
"dist (" <<
xc -
XX(actprj)
1068 <<
"," <<
yc -
YY(actprj) <<
") --> " 1069 << foot_U <<
" " << foot_V << std::endl;
1082 std::cout <<
" After wrapping " << xw <<
" " << yw << std::endl;
1083 std::cout <<
" Value added = " <<
VOLVOXEL(vol, k, i, j) *
1106 vol_corr +=
IMGPIXEL(norm_proj, yw, xw) *
1112 #ifdef DEBUG_INTERMIDIATE 1113 proj.
write(
"inter.xmp");
1114 norm_proj.
write(
"inter_norm.xmp");
1115 std::cout <<
"Press any key\n";
1124 VOLVOXEL(vol, k, i, j) += vol_corr;
1127 VOLVOXEL(vol, k, i, j) += vol_corr / N_eq;
1140 #ifdef DEBUG_AT_THE_END 1141 proj.
write(
"inter.xmp");
1142 norm_proj.
write(
"inter_norm.xmp");
1143 std::cout <<
"Press any key\n";
1152 #undef wrap_as_Crystal 1164 double rot,
double tilt,
double psi,
1180 proj.
reset(Ydim, Xdim);
1182 norm_proj().resize(proj());
1189 proj, norm_proj, shift, aint, bint, D, Dinv, mask, FORW, eq_mode);
1196 save.
write((std::string)
"PPPnorm_FORW" + (
char)(48 +
i));
1198 save.write((std::string)
"PPPnorm_BACK" + (
char)(48 +
i));
1222 int thread_id = thread_data->thread_id;
1223 int threads_count = thread_data->threads_count;
1225 const Basis * basis;
1251 if( thread_data->destroy ==
true )
1254 vol = thread_data->vol;
1255 grid = thread_data->grid;
1256 basis = thread_data->basis;
1257 FORW = thread_data->FORW;
1258 eq_mode = thread_data->eq_mode;
1259 VNeq = thread_data->VNeq;
1261 mask = thread_data->mask;
1262 ray_length = thread_data->ray_length;
1263 global_proj = thread_data->global_proj;
1264 global_norm_proj = thread_data->global_norm_proj;
1266 rot = thread_data->
rot;
1267 tilt = thread_data->tilt;
1268 psi = thread_data->psi;
1273 norm_proj = forw_norm_proj;
1277 (*norm_proj)().initZeros((*proj)());
1282 norm_proj = global_norm_proj;
1288 norm_proj, FORW, eq_mode,
1300 (*global_proj)() = (*global_proj)() + (*proj)();
1301 (*global_norm_proj)() = (*global_norm_proj)() + (*norm_proj)();
1310 return (
void *)NULL;
1320 int thread_id,
int numthreads)
1346 double XX_footprint_size=0.;
1347 double YY_footprint_size=0.;
1348 double ZZ_footprint_size=0.;
1381 bool isVolPSF =
false;
1417 if (basis->
VolPSF != NULL)
1425 YY_footprint_size = XX_footprint_size =
CEIL(basis->
maxLength());
1426 Usampling = Vsampling = 0;
1443 auto ZZ_lowest = (int)
ZZ(grid->
lowest);
1445 if( thread_id != -1 )
1446 ZZ_lowest += thread_id;
1448 auto YY_lowest = (int)
YY(grid->
lowest);
1449 auto XX_lowest = (int)
XX(grid->
lowest);
1450 auto ZZ_highest = (int)
ZZ(grid->
highest);
1451 auto YY_highest = (int)
YY(grid->
highest);
1452 auto XX_highest = (int)
XX(grid->
highest);
1454 beginZ = (double)XX_lowest * prjX + (
double)YY_lowest * prjY + (double)ZZ_lowest * prjZ + prjOrigin;
1457 bool VSSNR_mode = (ray_length == basis->
maxLength());
1462 condition = thread_id==1;
1463 if (condition || numthreads==1)
1465 std::cout <<
"Equation mode " << eq_mode << std::endl;
1466 std::cout <<
"Footprint size " << YY_footprint_size <<
"x" 1467 << XX_footprint_size << std::endl;
1468 std::cout <<
"rot=" << proj->
rot() <<
" tilt=" << proj->
tilt()
1469 <<
" psi=" << proj->
psi() << std::endl;
1470 std::cout <<
"Euler matrix " << proj->
euler;
1471 std::cout <<
"Projection direction " << prjDir << std::endl;
1473 std::cout <<
"image limits (" <<
x0 <<
"," <<
y0 <<
") (" <<
xF <<
"," 1475 std::cout <<
"prjX " << prjX.
transpose() << std::endl;
1476 std::cout <<
"prjY " << prjY.
transpose() << std::endl;
1477 std::cout <<
"prjZ " << prjZ.
transpose() << std::endl;
1478 std::cout <<
"prjOrigin " << prjOrigin.
transpose() << std::endl;
1479 std::cout <<
"beginZ(coord) " << beginZ.
transpose() << std::endl;
1480 std::cout <<
"lowest " << XX_lowest <<
" " << YY_lowest
1481 <<
" " << XX_lowest << std::endl;
1482 std::cout <<
"highest " << XX_highest <<
" " << YY_highest
1483 <<
" " << XX_highest << std::endl;
1484 std::cout <<
"Stats of input basis volume ";
1485 (*vol)().printStats();
1486 std::cout << std::endl;
1499 grid_basis.
getCol(0, gridX);
1500 grid_basis.
getCol(1, gridY);
1501 grid_basis.
getCol(2, gridZ);
1503 univ_beginZ = (double)XX_lowest * gridX + (
double)YY_lowest * gridY + (double)ZZ_lowest * gridZ + grid->
origin;
1505 int number_of_basis = 0;
1507 for (k = ZZ_lowest; k <= ZZ_highest; k += numthreads)
1511 univ_beginY = univ_beginZ;
1512 for (i = YY_lowest; i <= YY_highest; i++)
1516 univ_position = univ_beginY;
1517 for (j = XX_lowest; j <= XX_highest; j++)
1520 bool ray_length_interesting =
true;
1524 if (ray_length != -1 || isVolPSF)
1528 if (ray_length != -1)
1529 ray_length_interesting = (
ABS(zCenterDist) <= ray_length);
1532 if (isVolPSF && ray_length_interesting)
1534 ray_length_interesting = (
ABS(zCenterDist) <= ZZ_footprint_size);
1541 ray_length_interesting)
1546 condition = thread_id == 1;
1549 printf(
"\nProjecting grid coord (%d,%d,%d) ", j, i, k);
1550 std::cout <<
"Vol there = " <<
VOLVOXEL(*vol, k, i, j) << std::endl;
1551 printf(
" 3D universal position (%f,%f,%f) \n",
1552 XX(univ_position),
YY(univ_position),
ZZ(univ_position));
1553 std::cout <<
" Center of the basis proj (2D) " <<
XX(actprj) <<
"," <<
YY(actprj) << std::endl;
1556 std::cout <<
" Center of the basis proj (more accurate) " << aux.
transpose() << std::endl;
1570 std::cout <<
"Clipped and rounded Corner 1 " << XX_corner1
1571 <<
" " << YY_corner1 <<
" " << std::endl;
1572 std::cout <<
"Clipped and rounded Corner 2 " << XX_corner2
1573 <<
" " << YY_corner2 <<
" " << std::endl;
1579 if (XX_corner1 <= XX_corner2 && YY_corner1 <= YY_corner2)
1585 (
double)XX_corner1 -
XX(actprj), foot_V1, foot_U1);
1586 if (isVolPSF !=
false)
1597 for (
int y = YY_corner1;
y <= YY_corner2;
y++)
1600 for (
int x = XX_corner1;
x <= XX_corner2;
x++)
1602 if (!((mask != NULL) &&
A2D_ELEM(*mask,
y,
x)<0.5))
1607 std::cout <<
"Position in projection (" <<
x <<
"," 1612 std::cout <<
"in footprint (" 1613 << foot_U <<
"," << foot_V <<
")";
1615 std::cout <<
" (d= " <<
sqrt(y*y + x*x) <<
") ";
1653 if (XX_footprint_size > 1.41)
1663 std::cout <<
" in volume coord (" 1671 std::cout <<
" in voxel coord (" 1694 std::cout << std::endl;
1702 std::cout <<
" subsampling (" << ii <<
"," 1714 std::cout <<
" in volume coord (" 1722 std::cout <<
" in voxel coord (" 1730 std::cout <<
" partial a=" 1741 std::cout <<
" Finally ";
1749 std::cout <<
"=" << a <<
" , " << a2;
1764 (*proj)().toPhysical(
y,
x, py, px);
1765 int number_of_pixel = py *
XSIZE((*proj)()) + px;
1766 dMij(*M, number_of_pixel, number_of_basis) =
a;
1786 std::cout <<
" proj= " <<
IMGPIXEL(*proj,
y,
x)
1787 <<
" norm_proj=" <<
IMGPIXEL(*norm_proj,
y,
x) << std::endl;
1802 std::cout <<
" corr_img= " <<
IMGPIXEL(*norm_proj,
y,
x)
1803 <<
" correction=" << vol_corr << std::endl;
1811 foot_U += Usampling;
1813 foot_V += Vsampling;
1822 correction = (T) vol_corr;
1826 correction = (T)(vol_corr / N_eq);
1830 correction = (T) vol_corr;
1833 VOLVOXEL(*vol, k, i, j) += correction;
1839 printf(
"\nFinal value at (%d,%d,%d) ", j, i, k);
1840 std::cout <<
" = " <<
VOLVOXEL(*vol, k, i, j) << std::endl;
1852 V3_PLUS_V3(univ_position, univ_position, gridX);
1857 V2_PLUS_V2(beginZ, beginZ, prjZ * numthreads );
1858 V3_PLUS_V3(univ_beginZ, univ_beginZ, gridZ * numthreads);
1870 double rot,
double tilt,
double psi,
1886 proj.
reset(Ydim, Xdim);
1888 norm_proj().initZeros(proj());
1893 for(
int c = 0 ;
c < threads ;
c++ )
1897 project_threads[
c].
FORW = FORW;
1898 project_threads[
c].
eq_mode = eq_mode;
1899 project_threads[
c].
basis = &basis;
1900 project_threads[
c].
M = M;
1901 project_threads[
c].
rot = rot;
1902 project_threads[
c].
tilt = tilt;
1912 std::cout <<
"Number of volumes: " << vol.
VolumesNo() << std::endl
1913 <<
"YdimxXdim: " << Ydim <<
"x" << Xdim << std::endl;
1915 std::cout <<
"Volume " <<
i << std::endl << vol.
grid(
i) << std::endl;
1925 VNeq = &((*GVNeq)(
i));
1931 for(
int c = 0 ;
c < threads ;
c++ )
1933 project_threads[
c].
vol = &(vol(
i));
1935 project_threads[
c].
VNeq = VNeq;
1936 project_threads[
c].
mask = mask;
1949 &proj, &norm_proj, FORW, eq_mode,
1950 VNeq, M, mask, ray_length);
1957 save.
write((std::string)
"PPPnorm_FORW" + (
char)(48 +
i));
1959 save.
write((std::string)
"PPPnorm_BACK" + (
char)(48 +
i));
1967 template void project_GridVolume<double>(
GridVolumeT<double>&,
Basis const&,
Projection&,
Projection&, int, int, double, double, double, int, int,
GridVolumeT<int>*,
Matrix2D<double>*,
MultidimArray<int> const*, double, int);
const MultidimArray< int > * mask
bool only_create_angles
Only create angles, do not project.
Matrix2D< double > eulert
void defineParams(XmippProgram *program)
template void * project_SimpleGridThread< double >(void *)
char * firstWord(char *str)
#define A2D_ELEM(v, i, j)
double Npixel_dev
Standard deviation of the noise to be added to each pixel grey value.
void reset(int Ydim, int Xdim)
#define VOLVOXEL(V, k, i, j)
Matrix1D< double > highest
FileName fnOut
Output filename (used for a singleProjection)
double getDoubleParam(const char *param, int arg=0)
std::string fn_projection_extension
Extension for projection filenames. This is optional.
void printShape(std::ostream &out=std::cout) const
#define REPORT_ERROR(nerr, ErrormMsg)
double psi(const size_t n=0) const
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)
Projection * global_norm_proj
double projectionAt(const Matrix1D< double > &u, const Matrix1D< double > &r) const
void project_Crystal_SimpleGrid(Image< double > &vol, const SimpleGrid &grid, const Basis &basis, Projection &proj, Projection &norm_proj, const Matrix1D< double > &shift, const Matrix1D< double > &aint, const Matrix1D< double > &bint, const Matrix2D< double > &D, const Matrix2D< double > &Dinv, const MultidimArray< int > &mask, int FORW, int eq_mode)
ParametersProjectionTomography()
double tilt0
Minimum tilt around this axis.
void Euler_another_set(double rot, double tilt, double psi, double &newrot, double &newtilt, double &newpsi)
void sqrt(Image< double > &op)
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)
#define V3_MINUS_V3(a, b, c)
void * project_SimpleGridThread(void *params)
void readParams(XmippProgram *program)
tBasisFunction type
Basis function to use.
double rot(const size_t n=0) const
ImageOver blobprint2
Square of the footprint.
void singleWBP(MultidimArray< double > &V, Projection &P)
bool is_interesting(const Matrix1D< double > &uv) const
Matrix1D< double > lowest
#define V2_PLUS_V2(a, b, c)
double tiltF
Maximum tilt around this axis.
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define FOR_ALL_ELEMENTS_IN_ARRAY2D(m)
Matrix1D< T > transpose() const
double tilt(const size_t n=0) const
const Image< int > * VNeq
Matrix1D< double > raxis
Offset of the tilt axis.
#define A3D_ELEM(V, k, i, j)
void setShifts(double xoff, double yoff, double zoff=0., const size_t n=0)
double Npixel_avg
Bias to be applied to each pixel grey value */.
int proj_Ydim
Projection Ydim.
const int ART_PIXEL_SUBSAMPLING
#define V3_BY_CT(a, b, c)
void project_SimpleGrid(Image< T > *vol, const SimpleGrid *grid, const Basis *basis, Projection *proj, Projection *norm_proj, int FORW, int eq_mode, const Image< int > *VNeq, Matrix2D< double > *M, const MultidimArray< int > *mask, double ray_length, int thread_id, int numthreads)
const char * getParam(const char *param, int arg=0)
MultidimArray< double > * VolPSF
Footprint is convolved with a volume PSF // At this moment only used with blobs.
#define M2x2_BY_V2x1(a, M, b)
void transpose(double *array, int size)
double point_plane_distance_3D(const Matrix1D< double > &p, const Matrix1D< double > &a, const Matrix1D< double > &v)
double Ncenter_avg
Bias to apply to the image center.
float textToFloat(const char *str)
void projectVolume(MultidimArray< double > &V, Projection &P, int Ydim, int Xdim, double rot, double tilt, double psi, const Matrix1D< double > *roffset)
double Ncenter_dev
Standard deviation of the image center.
void project_GridVolume(GridVolumeT< T > &vol, const Basis &basis, Projection &proj, Projection &norm_proj, int Ydim, int Xdim, double rot, double tilt, double psi, int FORW, int eq_mode, GridVolumeT< int > *GVNeq, Matrix2D< double > *M, const MultidimArray< int > *mask, double ray_length, int threads)
pthread_mutex_t project_mutex
#define XMIPP_EQUAL_ACCURACY
#define IMG2OVER(IO, iv, iu, v, u)
void resize(size_t Xdim, bool copy=true)
double Nangle_dev
Standard deviation of the angles.
Matrix1D< double > vectorR2(double x, double y)
#define XMIPP_EQUAL_ZERO(x)
int proj_Xdim
Projection Xdim.
void project_Crystal_Volume(GridVolume &vol, const Basis &basis, Projection &proj, Projection &norm_proj, int Ydim, int Xdim, double rot, double tilt, double psi, const Matrix1D< double > &shift, const Matrix1D< double > &aint, const Matrix1D< double > &bint, const Matrix2D< double > &D, const Matrix2D< double > &Dinv, const MultidimArray< int > &mask, int FORW, int eq_mode)
void calculateProjectionAngles(Projection &P, double angle, double inplaneRot, const Matrix1D< double > &sinplane)
double relative_size
Measuring unit in the grid coordinate system.
double axisRot
Rotational angle of the tilt axis.
Matrix1D< double > direction
template void project_GridVolume< double >(GridVolumeT< double > &, Basis const &, Projection &, Projection &, int, int, double, double, double, int, int, GridVolumeT< int > *, Matrix2D< double > *, MultidimArray< int > const *, double, int)
FileName fnRoot
Root filename (used for a stack)
double valueAt(const Matrix1D< double > &r) const
#define M2x2_BY_CT(M2, M1, k)
double axisTilt
Tilt angle of the tilt axis.
#define M3x3_BY_V3x1(a, M, b)
void getCol(size_t j, Matrix1D< T > &v) const
barrier_t project_barrier
bool isMetaData(bool failIfNotExists=true) const
bool singleProjection
Only project a single image.
Matrix1D< double > origin
Origin of the grid in the Universal coordinate system.
const SimpleGrid & grid(size_t n) const
double psi(const double x)
void Euler_matrix2angles(const Matrix2D< double > &A, double &alpha, double &beta, double &gamma, bool homogeneous)
#define VECTOR_R3(v, x, y, z)
project_thread_params * project_threads
int get_number_of_samples() const
#define OVER2IMG(IO, v, u, iv, iu)
int textToInteger(const char *str)
#define realWRAP(x, x0, xF)
char * firstToken(const char *str)
bool checkParam(const char *param)
void read(const FileName &fn_proj_param)
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
double tiltStep
Step in tilt.
void Gdir_project_to_plane(const Matrix1D< double > &gr, double rot, double tilt, double psi, Matrix1D< double > &result) const
#define wrap_as_Crystal(x, y, xw, yw)
void projectVolumeOffCentered(MultidimArray< double > &V, Projection &P, int Ydim, int Xdim)
void setAngles(double _rot, double _tilt, double _psi)
#define M2x2_INV(Ainv, A)
int barrier_wait(barrier_t *barrier)
String nextToken(const String &str, size_t &i)
Incorrect value received.
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 count_eqs_in_projection(GridVolumeT< int > &GVNeq, const Basis &basis, Projection &read_proj)
int starting
First projection number. By default, 1.
void addParamsLine(const String &line)
double Nangle_avg
Bias to apply to the angles.
ql0001_ & zero(ctemp+1),(cvec+1),(a+1),(b+1),(bl+1),(bu+1),(x+1),(w+1), &iout, ifail, &zero,(w+3), &lwar2,(iw+1), &leniw, &glob_grd.epsmac
#define V3_PLUS_V3(a, b, c)
#define IMGPIXEL(I, i, j)
void getShifts(double &xoff, double &yoff, double &zoff, const size_t n=0) const
#define SPEED_UP_temps012
ImageOver blobprint
Blob footprint.
#define OVER2IMG_Z(IO, w, iw)