78 if (degree ==
"nearest")
80 else if (degree ==
"linear")
82 else if (degree ==
"bspline")
102 addUsageLine(
"Create a gallery of projections from a volume");
103 addUsageLine(
"+see [[http://xmipp.cnb.csic.es/twiki/bin/view/Xmipp/Angular_project_library_v3][here]] for further information about this program.");
106 addParamsLine(
" -o <output_file_name> : stack with output files");
107 addParamsLine(
" [--sym <symmetry=c1>] : Symmetry to define sampling ");
110 addParamsLine(
" [--sampling_rate <Ts=5>] : Distance in degrees between sampling points");
112 addParamsLine(
" [--sym_neigh <symmetry>] : symmetry used to define neighbors, by default");
114 addParamsLine(
" [--psi_sampling <psi=360>] : sampling in psi, 360 -> no sampling in psi");
115 addParamsLine(
" [--max_tilt_angle <tmax=180>] : maximum tilt angle in degrees");
116 addParamsLine(
" [--min_tilt_angle <tmin=0>] : minimum tilt angle in degrees");
117 addParamsLine(
" [--experimental_images <docfile=\"\">] : doc file with experimental data");
118 addParamsLine(
" [--angular_distance <ang=20>] : Do not search a distance larger than...");
120 addParamsLine(
" [--closer_sampling_points] : create doc file with closest sampling points");
122 addParamsLine(
" [--near_exp_data] : remove points far away from experimental data");
124 addParamsLine(
" [--compute_neighbors] : create doc file with sampling point neighbors");
126 addParamsLine(
" [--method <method=fourier>] : Projection method");
128 addParamsLine(
" real_space : Makes projections by ray tracing in real space");
129 addParamsLine(
" fourier <pad=1> <maxfreq=0.25> <interp=bspline> : Takes a central slice in Fourier space");
130 addParamsLine(
" : pad controls the padding factor, by default, the padded volume is");
132 addParamsLine(
" : maxfreq is the maximum frequency for the pixels and by default ");
133 addParamsLine(
" : pixels with frequency more than 0.25 are not considered.");
134 addParamsLine(
" : interp is the method for interpolation and the values can be: ");
138 addParamsLine(
" [--perturb <sigma=0.0>] : gaussian noise projection unit vectors ");
141 addParamsLine(
" [--groups <selfile=\"\">] : selfile with groups");
142 addParamsLine(
" [--only_winner] : if set each experimental");
145 addExampleLine(
"Sample at 2 degrees and use c6 symmetry:",
false);
146 addExampleLine(
"xmipp_angular_project_library -i in.vol -o out.stk --sym c6 --sampling_rate 2");
155 std::cout <<
"output input_volume root: " <<
input_volume << std::endl
157 <<
"Sampling rate: " <<
sampling << std::endl
158 <<
"symmetry sampling group: " <<
fn_sym << std::endl
159 <<
"symmetry neighbohound group: " <<
fn_sym_neigh << std::endl
165 <<
"verbose: " <<
verbose << std::endl
166 <<
"projection method: ";
170 std::cout <<
" fourier " <<std::endl;
171 std::cout <<
" pad factor: " <<
paddFactor <<std::endl;
172 std::cout <<
" maxFrequency: " <<
maxFrequency <<std::endl;
173 std::cout <<
" interpolator: ";
175 std::cout <<
" nearest" <<std::endl;
177 std::cout <<
" linear" <<std::endl;
179 std::cout <<
" bspline" <<std::endl;
182 std::cout <<
" realspace " <<std::endl;
199 int numberStepsPsi = 1;
201 mySize=my_end-my_init+1;
205 mySize *= numberStepsPsi;
213 for (
int i=0;
i<my_init;
i++)
227 for (
int i=my_init;
i<=my_end;
i++)
268 srand ( time(
nullptr) );
273 (std::string)
"Invalid symmetry" +
fn_sym);
305 #define BREAKSIMMETRY 371 for (
size_t objId : mySFin.ids())
373 double x,
y,
z, rot, tilt,
psi;
377 mySFin.getValue(
MDL_X,x,objId);
378 mySFin.getValue(
MDL_Y,y,objId);
379 mySFin.getValue(
MDL_Z,z,objId);
380 mySFin.getValue(
MDL_REF,ref,objId);
382 id = mySFout.addObject();
388 mySFout.setValue(
MDL_X,x,
id);
389 mySFout.setValue(
MDL_Y,y,
id);
390 mySFout.setValue(
MDL_Z,z,
id);
392 mySFout.setValue(
MDL_REF,ref,
id);
395 mySFout.setComment(
"x,y,z refer to the coordinates of the unitary vector at direction given by the euler angles");
396 if (mySFout.size()>0)
399 std::cout <<
"There are no projections within the specified angular range and sampling" << std::endl;
421 time_dif = difftime (end,start);
423 printf (
"re-read entire sampling file after %.2lf seconds\n", time_dif );
434 for (StringVector::iterator it= blockList.begin();
435 it!=blockList.end(); it++,igrp++)
438 std::cerr<<
"Writing group sampling file "<< my_output_file_root<<std::endl;
441 SFBlock.
read(fn_temp);
442 if (SFBlock.
size() > 0)
464 time_dif = difftime (end,start);
466 printf (
"Written all group sampling files after %.2lf seconds\n", time_dif );
void init_progress_bar(long total)
Errors on command line parameters.
void setSampling(double sampling)
void removeRedundantPoints(const int symmetry, int sym_order)
void setNoise(double deviation, int my_seed=-1)
double getDoubleParam(const char *param, int arg=0)
FileName output_file_root
#define REPORT_ERROR(nerr, ErrormMsg)
~ProgAngularProjectLibrary()
void createAsymUnitFile(const FileName &docfilename)
int BSplineDeg
The type of interpolation (NEAR.
void setNeighborhoodRadius(double neighborhood)
void findClosestSamplingPoint(const MetaData &DFi, const FileName &output_file_root)
int readSymmetryFile(FileName fn_sym, double accuracy=SYM_ACCURACY)
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)
bool isSymmetryGroup(FileName fn_sym, int &pgGroup, int &pgOrder)
FileName fn_sym
symmetry file for sampling
void computeNeighbors(bool only_winner=false)
void compose(const String &str, const size_t no, const String &ext="")
void saveSamplingFile(const FileName &fn_base, bool write_vectors=true, bool write_sampling_sphere=false)
bool angular_distance_bool
std::vector< String > StringVector
FileName fn_sym_neigh
symmetry file for heighbors computation
void createGroupSamplingFiles(void)
bool compute_closer_sampling_point_bool
std::vector< Matrix1D< double > > exp_data_projection_direction_by_L_R
void computeSamplingPoints(bool only_half_sphere=true, double max_tilt=180, double min_tilt=0)
const char * getParam(const char *param, int arg=0)
ProgAngularProjectLibrary()
double paddFactor
The padding factor for Fourier projection.
void project_angle_vector(int my_init, int my_end, bool verbose=true)
void progress_bar(long rlen)
Structure for holding a volume.
void addExampleLine(const char *example, bool verbatim=true)
void projectVolume(FourierProjector &projector, Projection &P, int Ydim, int Xdim, double rot, double tilt, double psi, const MultidimArray< double > *ctf)
int verbose
Verbosity level.
void setDataMode(DataMode mode)
#define STR_EQUAL(str1, str2)
FourierProjector * Vfourier
void fillLRRepository(void)
bool remove_points_far_away_from_experimental_data_bool
void setEulerAngles(double rot, double tilt, double psi, const size_t n=0)
FileName FnexperimentalImages
void readSamplingFile(const FileName &infilename, bool read_vectors=true, bool read_sampling_sphere=false)
std::vector< Matrix1D< double > > no_redundant_sampling_points_angles
FileName removeBlockName() const
FileName withoutExtension() const
double psi(const double x)
projectionType projType
Type of projection algorithm:
bool checkParam(const char *param)
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
void addUsageLine(const char *line, bool verbatim=false)
void fillExpDataProjectionDirectionByLR(const MetaData &DFi)
void removePointsFarAwayFromExperimentalData()
bool compute_neighbors_bool
Incorrect value received.
double perturb_projection_vector
void addParamsLine(const String &line)
double maxFrequency
The maximum frequency for Fourier projection.