46 addUsageLine(
"MPI Generate projections as in a X-ray microscope from a 3D Xmipp volume.");
51 node = std::make_shared<MpiNode>(argc, argv);
62 projMD.setComment(
"True rot, tilt and psi; rot, tilt, psi, X and Y shifts applied");
68 std::vector<mpiProjData> mpiData;
74 double angle=projParam.tilt0;
75 while (angle <= projParam.tiltF)
77 if (projParam.singleProjection)
83 double shiftX =
rnd_gaus(projParam.Ncenter_avg, projParam.Ncenter_dev);
84 double shiftY =
rnd_gaus(projParam.Ncenter_avg, projParam.Ncenter_dev);
88 projParam.calculateProjectionAngles(proj,angle, 0,inPlaneShift);
94 data.
rot = data.
tRot +
rnd_gaus(projParam.Nangle_avg, projParam.Nangle_dev);
96 data.
psi = data.
tPsi +
rnd_gaus(projParam.Nangle_avg, projParam.Nangle_dev);
102 id = projMD.addObject();
115 mpiData.push_back(data);
117 angle += projParam.tiltStep;
122 long long int nodeBlockSize = 1;
123 std::unique_ptr<MpiTaskDistributor>jobHandler = std::make_unique<MpiTaskDistributor>(mpiData.size(), nodeBlockSize,
node);
125 size_t first = 0, last = 0;
130 if (!projParam.singleProjection)
131 projMD.write(projParam.fnRoot +
".sel");
133 if (!(projParam.show_angles))
141 std::cout <<
"Projecting ...\n";
146 MPI_Barrier(MPI_COMM_WORLD);
149 while (jobHandler->getTasks(first, last))
151 for (
size_t k = first;
k <= last;
k++)
153 std::cout <<
"Node: " <<
node->
rank <<
" - Task: " <<
k <<std::endl;
161 if (!projParam.only_create_angles)
169 IMGMATRIX(proj).addNoise(projParam.Npixel_avg, projParam.Npixel_dev,
"gaussian");
171 if (projParam.show_angles)
172 std::cout <<
"Node: " <<
node->
rank <<
"\t" << proj.rot() <<
"\t" 173 << proj.tilt() <<
"\t" << proj.psi() << std::endl;
void init_progress_bar(long total)
virtual void read(int argc, const char **argv, bool reportErrors=true)
virtual void defineParams()
#define MULTIDIM_ARRAY(v)
void compose(const String &str, const size_t no, const String &ext="")
void XrayRotateAndProjectVolumeOffCentered(XrayProjPhantom &phantom, XRayPSF &psf, Projection &P, Projection &standardP, int Ydim, int Xdim)
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
void progress_bar(long rlen)
void createEmptyFile(const FileName &filename, int xdim, int ydim, int Zdim, size_t select_img, bool isStack, int mode, int _swapWrite, const MDRowVec *md)
#define VECTOR_R3(v, x, y, z)
void read(int argc, char **argv)