119 program->
addParamsLine(
" -i <md_file> : Metadata file with input projections");
120 program->
addParamsLine(
" [-o <volume_file=\"rec_art.vol\">] : Filename for output volume.");
121 program->
addParamsLine(
" : Rootname for rest of output files is taken from volume filename");
122 program->
addParamsLine(
" :+++The created files are as follows: %BR%");
123 program->
addParamsLine(
" :+++ =outputname.vol= 3D reconstruction in voxels %BR%");
124 program->
addParamsLine(
" :+++ =outputname.basis= 3D reconstruction in basis if the =--save_basis= option is enabled). The grid parameters are also stored in the same file %BR%");
125 program->
addParamsLine(
" :+++ =outputname.hist= History and information about the 3D reconstruction process %BR%");
126 program->
addParamsLine(
" [--ctf <ctf_file=\"\">] : Metadata file with CTFs");
127 program->
addParamsLine(
" [--unmatched] : Apply unmatched forward/backward projectors");
128 program->
addParamsLine(
" [--start <basisvolume_file=\"\">] : Start from this basis volume. The reconstruction is performed in the same grid as the one ");
129 program->
addParamsLine(
" : in which the basis volume was stored (any -FCC or -CC or grid size value are useless)");
130 program->
addParamsLine(
" [--max_tilt <alpha=10.e+6>] : Skip projections with absolute tilt angle greater than alpha.");
131 program->
addParamsLine(
" : It means that if alpha=40, then only images with tilt angle ");
132 program->
addParamsLine(
" : within the ranges 0+/-40 and 180+/-40 will be processed. (Projection");
133 program->
addParamsLine(
" : tilt angles are forced to be in the range 0-360)");
134 program->
addParamsLine(
" [--ref_trans_after <n=-1>] : Refine the translation alignment after n projections. (Integer type)");
135 program->
addParamsLine(
" [--ref_trans_step <v=-1>] : Maximum displacement in translation alignment. (Double type)");
136 program->
addParamsLine(
" [--sparse <eps=-1>] : Sparsity threshold");
137 program->
addParamsLine(
" [--diffusion <eps=-1>] : Diffusion weight");
138 program->
addParamsLine(
" [--surface <surf_mask_file=\"\">] : Mask for the surface constraint. It says where the volume is known to be 0");
139 program->
addParamsLine(
" [--POCS_freq <f=1>] : Impose POCS conditions every f projections");
140 program->
addParamsLine(
" [--known_volume <value=-1>] : The volume is cut down to this mass, ie, the highest [value] voxels are kept while ");
142 program->
addParamsLine(
" [--POCS_positivity] : Force the resulting volume to be positive");
143 program->
addParamsLine(
" [--goldmask <value=1.e+6>] : Pixels below this value are considered to come from gold beads and are not used for reconstruction");
144 program->
addParamsLine(
" [--shiftedTomograms] : Remove external zero-valued border pixels created by alignment of tomograms");
145 program->
addParamsLine(
" [--dont_apply_shifts] : Do not apply shifts as stored in the 2D-image headers");
146 program->
addParamsLine(
" [--variability] : Perform variability analysis");
147 program->
addParamsLine(
" [--refine] : Refine input projection before backprojecting");
148 program->
addParamsLine(
" [--noisy_reconstruction] : Perform a companion noisy reconstruction. ");
149 program->
addParamsLine(
" :+ If given, the algorithm will perform two reconstructions. One with the input ");
150 program->
addParamsLine(
" :+ data, and another one with pure noise images applying exactly the same procedure ");
151 program->
addParamsLine(
" :+ as to the signal projections. This reconstruction is further used by ");
152 program->
addParamsLine(
" :+ the SSNR program in order to calculate the VSSNR or the SSNR itself.");
153 program->
addParamsLine(
" :+++ The created files are as follows: %BR%");
154 program->
addParamsLine(
" :+++ =[fn_root]_noise.vol= Reconstruction of the pure noise %BR%");
155 program->
addParamsLine(
" :+++ =[fn_root]_noise_proj.sel= Selection file with the pure noise images %BR%");
156 program->
addParamsLine(
" :+++ =[fn_root]_signal_proj.sel= Selection file with the signal images (a reordered version of the input (-i) selfile) %BR%");
157 program->
addParamsLine(
" :+++ =[fn_root]_noise_proj.stk= Pure noise images used for the reconstruction %BR%");
158 program->
addParamsLine(
" [--ray_length <r=-1>] : Length of the ray in basis units that will be projected onto the image plane");
161 program->
addParamsLine(
" [--sym <sym_file=\"\">] : Use a symmetry file. It should give symmetry elements, ie, rotational axis, ");
162 program->
addParamsLine(
" : symmetry planes or whatever such that new points of view can be obtained");
163 program->
addParamsLine(
" [--sym_each <n=0>] : Force the reconstruction to be symmetric each n projections");
164 program->
addParamsLine(
" [--force_sym <n=0>] : Force the reconstruction to be symmetric n times at each projection");
165 program->
addParamsLine(
" [--no_group] : Do not generate symmetry subgroup");
166 program->
addParamsLine(
" [--no_symproj] : Do not use symmetrized projections");
169 program->
addParamsLine(
" [-l <...>] : Relaxation factor, by default 0.01 (recommended range 0.0 - 0.1). ");
170 program->
addParamsLine(
" : A list of lambda values is also accepted as \"-l lambda0 lambda1 ...\"");
171 program->
addParamsLine(
" [-n <noit=1>] : Number of iterations");
172 program->
addParamsLine(
" [--stop_at <it_stop=0>] : Total number of iterated projections before algorithm stops. ");
173 program->
addParamsLine(
" :+ For instance, if there are 100 images, with two iterations and we ");
174 program->
addParamsLine(
" :+ want to stop at the half of the second iteration, then you must set it to 150");
175 program->
addParamsLine(
" [--equation_mode <mode=ARTK> ]: Equation to project onto the hyperplane");
180 program->
addParamsLine(
" CAVARTK : Component Averaging Variant of Block ART");
182 program->
addParamsLine(
" [--sort_last <N=2>] : By default the algorithm sorts projections in the most orthogonally possible way. ");
183 program->
addParamsLine(
" : The most orthogonal way is defined as choosing the projection which maximizes the ");
184 program->
addParamsLine(
" : dot product with the N previous inserted projections. Use -1 to sort with all ");
186 program->
addParamsLine(
" or --random_sort : Instead of orthogonal sort, projections are presented randomly to the algorithm");
187 program->
addParamsLine(
" or --no_sort : No sort must be applied");
188 program->
addParamsLine(
" [--WLS] : Perform weighted least squares ART");
189 program->
addParamsLine(
" [-k <...> ] : Relaxation factor for WLS residual, by default 0.5. ");
190 program->
addParamsLine(
" : A list of kappa values is also accepted as \"-k kappa0 kappa1 ...\"");
196 program->
addParamsLine(
" [-g <gridsz=1.41>] : Relative size of the measuring unit in the grid lattice in pixels. By default, a unit in ");
197 program->
addParamsLine(
" : the grid system equals 1.41 units in the Universal System. This value is optimized ");
200 program->
addParamsLine(
" : if gridsz = -1 => gridsz=2^(1/2)");
204 program->
addParamsLine(
" [--grid_type <type=BCC>] : Shape of the grid structure");
209 program->
addParamsLine(
" [-R <interest_sphere=-1>] : Radius of the interest sphere. If provided, ART runs twice faster since only the ");
210 program->
addParamsLine(
" : sphere with this radius (in pixel units) is reconstructed");
211 program->
addParamsLine(
" [--ext <proj_ext=0>] : Projection extension. In order to avoid the box effect (those voxels near the volume ");
212 program->
addParamsLine(
" : borders are brighter than the rest), you can extent your projections resulting in ");
213 program->
addParamsLine(
" : a slower reconstruction but more accurate. Recommended values to avoid the box ");
215 program->
addParamsLine(
" [--output_size <Xsize=0> <Ysize=0> <Zsize=0>] : Output volume size in Pixels. Reconstruction size is taken from ");
216 program->
addParamsLine(
" : the projection size. However, the output size can be different, if the output volume ");
217 program->
addParamsLine(
" : is bigger, then the volume is zero padded.");
218 program->
addParamsLine(
" [--sampling_rate <Ts=1>] : Pixel size (Angstroms)");
221 program->
addParamsLine(
" : by default, sequential ART is applied");
222 program->
addParamsLine(
" [--thr <N=1>] : Number of threads to use. NOTE: Not available when using MPI.");
223 program->
addParamsLine(
" [--parallel_mode <mode=ART>]: Parallelization algorithm to use with threads or MPI program version");
226 program->
addParamsLine(
" SIRT : Simultaneous Iterative Reconstruction Technique");
227 program->
addParamsLine(
" pSIRT : Parallel (MPI) Simultaneous Iterative Reconstruction Technique");
228 program->
addParamsLine(
" pfSIRT : Parallel (MPI) False Simultaneous Iterative Reconstruction Technique (Faster convergence than pSIRT)");
229 program->
addParamsLine(
" pSART : Parallel (MPI) Simultaneous ART");
230 program->
addParamsLine(
" pAVSP : Parallel (MPI) Average Strings");
231 program->
addParamsLine(
" pBiCAV : Parallel (MPI) Block Iterative CAV");
233 program->
addParamsLine(
" [--block_size <n=1>] : Number of projections for each block (SART and BiCAV)");
236 program->
addParamsLine(
" [--print_system_matrix] : Print the matrix of the system Ax=b. The format is:");
238 program->
addParamsLine(
" : Equation system (Ax=b) ---------------------- ");
240 program->
addParamsLine(
" : pixel=<p> --> <b> = <a1> <a2> ... ");
242 program->
addParamsLine(
" : I.e., for the pixel p (pixels are numbered lexicographically) with experimental ");
243 program->
addParamsLine(
" : value b, the equation ax=b is set. a is the corresponding row of matrix A. The ");
244 program->
addParamsLine(
" : coefficient a_i is equal to the contribution of the basis i to pixel p. x is the ");
246 program->
addParamsLine(
" [--show_iv <n=10>] : Show volumes/images as the reconstruction goes. The volume is update every n projections");
247 program->
addParamsLine(
" [--show_error] : Show error for each projection");
248 program->
addParamsLine(
" [--show_stats] : Give some statistical information during the process, they might be useful to see how the process is ");
249 program->
addParamsLine(
" : going. The mean squared error for each projection is shown by default");
250 program->
addParamsLine(
" [--save_at_each_step] : Save intermediate projections. This option allows deep debugging as it save all projections and volumes ");
251 program->
addParamsLine(
" : involved in the reconstruction process. After each step you are asked to press a key, so that you could ");
252 program->
addParamsLine(
" : inspect carefully the results. The names for these files are:");
253 program->
addParamsLine(
" : PPPtheo, PPPread, PPPcorr, PPPdiff");
255 program->
addParamsLine(
" : PPPvolPOCS1, PPPvolPOCS2, PPPvolPOCS3");
256 program->
addParamsLine(
" [--save_intermediate <n=0>] : Save intermediate volumes (every <n> projections). If not provided, volumes are stored at each iteration ");
257 program->
addParamsLine(
" : and this parameter must be used at the end of the command to prevent errors. The names for these volumes are:");
259 program->
addParamsLine(
" : [filename root]it[it_no].vol Ex: art0001it0.vol ");
261 program->
addParamsLine(
" : [filename root]it]it_no].basis If the --save_basis option is enabled");
263 program->
addParamsLine(
" [--save_basis] : Save also the 3D reconstruction in basis each time that you have to save the reconstructed volume");
264 program->
addParamsLine(
" [--manual_order] : You are prompted to give the number of the following projection to be presented to the algorithm");
265 program->
addParamsLine(
" [--only_sym] : Skip all those projections generated by symmetry (symmetries different from -1)");
305 size_t listSize = list.size();
311 for (
size_t k = 0;
k < listSize;
k++)
319 if (tempString ==
"CAVK")
321 else if (tempString ==
"CAV")
323 else if (tempString ==
"CAVARTK")
335 listSize = list.size();
340 for (
size_t k = 0;
k < listSize;
k++)
362 tempString = program->
getParam(
"--grid_type");
364 if (tempString ==
"BCC")
366 if (tempString ==
"FCC")
368 else if (tempString ==
"SC")
383 tempString = program->
getParam(
"--parallel_mode");
385 if (tempString ==
"pSART")
387 else if (tempString ==
"pSIRT")
389 else if (tempString ==
"SIRT")
391 else if (tempString ==
"pfSIRT")
393 else if (tempString ==
"pBiCAV")
395 else if (tempString ==
"pAVSP")
397 else if (tempString ==
"pCAV")
413 if (program->
checkParam(
"--save_at_each_step"))
419 if (program->
checkParam(
"--save_intermediate"))
441 if (program->
checkParam(
"--noisy_reconstruction"))
445 " can only be done for ART");
511 size_t idum, idumLong;
534 (*surface_mask)().setXmippOrigin();
571 for (
int iact_proj = 0; iact_proj <
numIMG ; iact_proj++)
575 read_proj.
read(fn_resi);
576 read_proj().setXmippOrigin();
577 weight = read_proj.
weight();
580 "BASIC_ART: negative weight not set correctly!");
693 int numProjs_node,
int debug_level)
695 if (
GVNeq ==
nullptr)
703 std::cerr <<
"Counting equations ...\n";
706 for (
int act_proj = 0; act_proj < numProjs_node ; act_proj++)
711 read_proj().setXmippOrigin();
715 read_proj().selfWindow(
723 if (debug_level > 0 &&
730 long int Neq = 0, Nunk = 0;
734 Neq += (*GVNeq)(
n)(
k,
i,
j);
737 double redundancy = (0 == Neq) ? 0 : (100.0 - 100.0*Nunk / Neq);
738 std::cerr <<
"There are " << Neq <<
" equations and " << Nunk
739 <<
" unknowns (redundancy=" << redundancy <<
")\n";
bool is_crystal
Is this a crystal 0 means NO 1 YES.
int verbose
Verbose level.
void init_progress_bar(long total)
MDRowVec row
Header information of projection.
bool positivity
Apply positivity constraint.
int numIMG
Total number of images to process (taking symmetries into account)
static void defineParams(XmippProgram *program, bool mpiMode=false)
size_t projXdim
Projection X dimension.
double getDoubleParam(const char *param, int arg=0)
bool refine
Refine experimental projection before backprojecting.
Basis basis
Basis function. By default, blobs.
#define REPORT_ERROR(nerr, ErrormMsg)
void resize(const Matrix1D< double > &corner1, const Matrix1D< double > &corner2)
FileName fn_start
Grid volume as initial guess.
SimpleGrid Create_CC_grid(double relative_size, const Matrix1D< double > &corner1, const Matrix1D< double > &corner2, const Matrix1D< double > &origin)
double grid_relative_size
Relative size for the grid.
void sqrt(Image< double > &op)
#define TELL_MANUAL_ORDER
Couldn't write to file.
int readSymmetryFile(FileName fn_sym, double accuracy=SYM_ACCURACY)
Matrix1D< double > vectorR3(double x, double y, double z)
void changeFromVoxels(const MultidimArray< double > &vol_voxels, GridVolume &vol_basis, int grid_type, double grid_relative_size, const MultidimArray< double > *vol_mask, const Matrix2D< double > *D, double R, int threads=1) const
bool do_not_use_symproj
Do not use symmetrized projections.
double grid_relative_size
Relative size for the grid.
FileName fn_sym
File containing symmetries.
bool shiftedTomograms
Shifted tomograms.
tBasisFunction type
Basis function to use.
void getListParam(const char *param, StringVector &list)
void setDefault()
Default values.
FileName fn_sel
Selection file with all images to process.
std::ofstream * fh_hist
File handler for the history file.
bool variability_analysis
Variability analysis.
int save_intermidiate_every
Frequency for saving intermidiate.
double weight(const size_t n=0) const
size_t projYdim
Projection Y dimension.
double sampling
Sampling rate.
std::vector< String > StringVector
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
Incorrect number of objects in Metadata.
int block_size
Number of projections for each parallel block.
bool random_sort
True if random sort of projections.
int grid_type
CC, BCC or FCC (in grids.hh)
#define BCC
BCC identifier.
int trueIMG
Number of different images (without symmetries)
void adapt_to_grid(const Grid &_grid)
FileName fn_surface_mask
File containing surface mask.
double known_volume
Known volume. If -1, not applied.
bool dont_sort
True if no sort must be made.
#define FOR_ALL_ELEMENTS_IN_ARRAY3D(V)
Matrix1D< double > kappa_list
double sparseEps
Sparse reconstruction.
bool print_system_matrix
Print system matrix.
bool apply_shifts
Apply shifts stored in the headers of the 2D-images.
const char * getParam(const char *param, int arg=0)
GridVolumeT< int > * GVNeq
void sortRandomly(int numIMG, MultidimArray< int > &ordered_list)
#define FCC
FCC identifier.
float textToFloat(const char *str)
Incorrect argument received.
int stop_at
Stop after this number of images, if 0 then don't use.
ReconsInfo * IMG_Inf
Array with all the sorting information for each projection.
void resize(size_t Xdim, bool copy=true)
void progress_bar(long rlen)
void read(const FileName &fn, const std::string &basisName)
#define TELL_SAVE_INTERMIDIATE
ARTParallelMode parallel_mode
void produceSideInfo(GridVolume &vol_basis0, int level=FULL, int rank=-1)
String basisName() const
Basis name.
bool contains(const String &str) const
FileName fn_proj
Projection filename.
void sortPerpendicular(int numIMG, ReconsInfo *IMG_Inf, MultidimArray< int > &ordered_list, int N)
double ref_trans_step
Refine the translation alignement after n projection presentations.
bool noisy_reconstruction
Noisy reconstruction.
void computeCAVWeights(GridVolume &vol_basis0, int numProjs_node, int debug_level=0)
int force_sym
Force the reconstruction to be symmetric this number of times.
Grid Create_FCC_grid(double relative_size, const Matrix1D< double > &corner1, const Matrix1D< double > &corner2)
bool unmatched
Apply unmatched projectors to correct for the CTF.
Grid Create_BCC_grid(double relative_size, const Matrix1D< double > &corner1, const Matrix1D< double > &corner2)
int no_it
Number of iterations.
void produceSideInfo(const Grid &grid)
void setD(Matrix2D< double > *_D)
MultidimArray< int > ordered_list
Order in which projections will be presented to algorithm.
FileName withoutExtension() const
#define TELL_SAVE_AT_EACH_STEP
Image< double > * surface_mask
FileName fn_control
Name of file for improved control in parallel jobs.
#define FIRST_XMIPP_INDEX(size)
void noSort(int numIMG, MultidimArray< int > &ordered_list)
const SimpleGrid & grid(size_t n) const
int ref_trans_after
Refine the translation alignement after n projection presentations.
static void defineParams(XmippProgram *program, const char *prefix=NULL, const char *comment=NULL)
void resizeNoCopy(int Xdim)
bool checkParam(const char *param)
void read(const FileName &fn, const bool only_apply_shifts=false, DataMode datamode=DATA, MDRow *row=nullptr)
int read(const FileName &name, DataMode datamode=DATA, size_t select_img=ALL_IMAGES, bool mapData=false, int mode=WRITE_READONLY)
int sort_last_N
Sort perpendicular with the last N projections. If -1 with all previous.
void readParams(XmippProgram *program)
FileName fn_ctf
Selection file with all images to process.
int getIntParam(const char *param, int arg=0)
double diffusionWeight
Tomographic diffussion.
void buildReconsInfo(MetaDataVec &selfile, const FileName &fn_ctf, const SymList &SL, ReconsInfo *&IMG_Inf, bool do_not_use_symproj)
void readParams(XmippProgram *program)
Incorrect value received.
void count_eqs_in_projection(GridVolumeT< int > &GVNeq, const Basis &basis, Projection &read_proj)
int threads
Number of threads to use. Can not be different than 1 when using MPI.
FileName fn_out
Name of the output volume, also used to set the root of rest output files.
void addParamsLine(const String &line)
SymList SL
A list with the symmetry matrices.
Matrix2D< double > * Dinv
Just the inverse of D.
Matrix1D< double > lambda_list
Relaxation parameter.
bool do_not_generate_subgroup
Do not generate symmetry subgroup.