![]() |
Bsoft 2.1.4
Bernard's software package
|
Functions for reconstruction. More...
#include "rwimg.h"
#include "rwmg.h"
#include "mg_processing.h"
#include "mg_select.h"
#include "mg_img_proc.h"
#include "mg_particle_select.h"
#include "mg_reconstruct.h"
#include "mg_ctf.h"
#include "Complex.h"
#include "symmetry.h"
#include "utilities.h"
#include <sys/stat.h>
#include <fcntl.h>
Functions | |
int | part_ft_size (int xsize, double scale, int pad_factor) |
Sets the Fourier transform size for 2D particle images for reconstruction. More... | |
Bimage * | particle_reconstruct (Bparticle *partlist, Bsymmetry sym, int sym_mode, double hi_res, Vector3< double > scale, Vector3< double > sam, Vector3< long > size, int ft_size, fft_plan plan, int interp_type, int ctf_action, double wiener, int flags, int first) |
Reciprocal space reconstruction from 2D particle images. More... | |
Bimage * | img_reconstruction_sum_weigh (Bimage **pacc, int imap, int nmaps, int maps_per_class, double hi_res) |
Combines and weighs a map from several partial maps and weight sets. More... | |
double | part_single_reconstruction (Bparticle *part, Vector3< long > size, Bimage *pmask, Bsymmetry &sym, double hi_res, Vector3< double > scale, int ft_size, fft_plan img_plan, fft_plan map_plan, double part_weight, int interp_type, CTFparam *mg_ctf, int ctf_action, double wiener, int flags) |
long | project_single_particle_reconstruction (Bproject *project, Bstring &maskfile, Bsymmetry &sym, int num_select, double hi_res, Vector3< double > scale, Vector3< long > size, int pad_factor, int interp_type, int ctf_action, double wiener, int flags) |
Reciprocal space reconstruction from the images in a multi-image file. More... | |
Vector3< long > | project_set_reconstruction_size (Bproject *project, Vector3< double > &sam, double scale, int twoD_flag) |
Sets the reconstruction size for reconstruction from 2D particle images. More... | |
int | project_configure_for_reconstruction (Bproject *project, Bstring classes, long &nmaps, int &nthreads) |
Sets up the particle selection for reconstruction. More... | |
int | project_update_class_averages (Bproject *project, Bimage *prec, Bstring file_name) |
Bimage * | project_reconstruct_2D (Bproject *project, Bstring file_name, int transform_output) |
Creates a 2D reconstruction from the images in a multi-image file. More... | |
Bparticle * | img_reconstruct_2D (long i, Bproject *project, Bimage *prec, double hires, fft_plan planf, fft_plan planb) |
long | img_reconstruct_2D_fspace (long i, Bproject *project, Bimage *prec, double hires, fft_plan planf, fft_plan planb) |
Bimage * | project_reconstruct_2D_fast (Bproject *project, Bstring file_name) |
Bimage * | project_reconstruct_3D (Bproject *project, long selnum, int calcfom, Vector3< long > size) |
Transforms 3D maps and calculates an average. More... | |
Bimage * | project_reconstruct_3D (Bproject *project, long selnum, Vector3< long > size, double resolution) |
Transforms 3D maps and calculates an average. More... | |
Bimage * | project_back_projection (Bproject *project, long num_select, Vector3< long > map_size, Vector3< double > sam, double scale, double resolution, fft_plan planf, fft_plan planb) |
Back projects a set of 2D images into a 3D volume. More... | |
Bimage * | img_backprojection_accumulate (Bimage **pacc, int imap, int nmaps, int nthreads) |
Accumulates multiple backprojections. More... | |
Variables | |
int | verbose |
Functions for reconstruction.
Accumulates multiple backprojections.
**pacc | array of partial maps with linked weight maps. |
imap | which output map to weigh. |
nmaps | number of output maps (1,2,3). |
nthreads | number of threads per map (= number of partial maps). |
Bparticle * img_reconstruct_2D | ( | long | i, |
Bproject * | project, | ||
Bimage * | prec, | ||
double | hires, | ||
fft_plan | planf, | ||
fft_plan | planb | ||
) |
long img_reconstruct_2D_fspace | ( | long | i, |
Bproject * | project, | ||
Bimage * | prec, | ||
double | hires, | ||
fft_plan | planf, | ||
fft_plan | planb | ||
) |
Bimage * img_reconstruction_sum_weigh | ( | Bimage ** | pacc, |
int | imap, | ||
int | nmaps, | ||
int | maps_per_class, | ||
double | hi_res | ||
) |
Combines and weighs a map from several partial maps and weight sets.
**pacc | array of partial maps with linked weight maps. |
imap | which output map to weigh. |
nmaps | number of output maps (1,2,3). |
maps_per_class | number of threads per map (= number of partial maps). |
hi_res | high resolution limit. |
The input is a set of partially integrated complex maps with associated weigths as follows: voxel power sums FOM block of map. voxel weight sums linked image. voxel weight squared sums linked image FOM block. The partial sums are completed into corresponding blocks in three possible ways based on the value of imap and nmap: nmap imap result 1 0 one map from all input maps 2 0,1 one map from half of the input maps 3 0 one map from all input maps 3 1,2 one map from half of the input maps The total number of maps in the array is nclasses*nmaps.
int part_ft_size | ( | int | xsize, |
double | scale, | ||
int | pad_factor | ||
) |
Sets the Fourier transform size for 2D particle images for reconstruction.
xsize | size of x dimension. |
scale | scale of reconstruction. |
pad_factor | factor that determines image padding. |
The reconstruction size must be set.
double part_single_reconstruction | ( | Bparticle * | part, |
Vector3< long > | size, | ||
Bimage * | pmask, | ||
Bsymmetry & | sym, | ||
double | hi_res, | ||
Vector3< double > | scale, | ||
int | ft_size, | ||
fft_plan | img_plan, | ||
fft_plan | map_plan, | ||
double | part_weight, | ||
int | interp_type, | ||
CTFparam * | mg_ctf, | ||
int | ctf_action, | ||
double | wiener, | ||
int | flags | ||
) |
Bimage * particle_reconstruct | ( | Bparticle * | partlist, |
Bsymmetry | sym, | ||
int | sym_mode, | ||
double | hi_res, | ||
Vector3< double > | scale, | ||
Vector3< double > | sam, | ||
Vector3< long > | size, | ||
int | ft_size, | ||
fft_plan | plan, | ||
int | interp_type, | ||
int | ctf_action, | ||
double | wiener, | ||
int | flags, | ||
int | first | ||
) |
Reciprocal space reconstruction from 2D particle images.
*partlist | a list of 2D particle image parameters. |
*sym | point group symmetry. |
sym_mode | 0=apply symmetry, 1=C1, 2=random symmetry view |
hi_res | high resolution limit. |
scale | scale of reconstruction. |
sam | sampling/voxel size of reconstruction. |
size | size of reconstruction. |
ft_size | Fourier transform size. |
plan | Fourier transform plan. |
interp_type | interpolation type. |
ctf_action | flag to apply CTF to projections. |
wiener | Wiener factor. |
flags | 1=rescale particles, 2=2D reconstruction, 4=bootstrap, 8=Ewald. |
first | flag to indicate the first thread. |
The orientation parameters, view vector, angle of rotation and origin, must all be set. Each image is padded to at least two times its size and its Fourier transform packed into 3D reciprocal space. The figure-of-merit calculated for each reciprocal space voxel is: sum(w*re)^2 + sum(w*im)^2 FOM = --------------------------- sum(w)*sum(w*(re^2 + im^2)) where re real part im imaginary part w weight (inverse distance of image pixel to closest grid point) For voxels with only one data pixel contributing to it, FOM = 0. A bootstrap reconstruction uses the particle selection to weigh each selected particle.
Bimage * project_back_projection | ( | Bproject * | project, |
long | num_select, | ||
Vector3< long > | map_size, | ||
Vector3< double > | sam, | ||
double | scale, | ||
double | resolution, | ||
fft_plan | planf, | ||
fft_plan | planb | ||
) |
Back projects a set of 2D images into a 3D volume.
*project | image processing parameter structure. |
num_select | selection number from the selection column. |
map_size | 3-valued vector for the new map size. |
sam | 3-value vector for the voxel size in angstrom. |
scale | reconstruction scale. |
resolution | resolution for low-pass filtering. |
planf | 2D forward Fourier transform plan. |
planb | 2D backward Fourier transform plan. |
All the information needed to do a 3D reconstruction is passed in through an image processing structure. The new 3D volume is initialized. Each sub-image in each particle file is read individually and back-projected within the new volume. The orientation parameters from the image processing structure is transferred to the sub-image structure in the 2D image before calling the function packing one image into the volume. The default origin is the center of the image.
int project_configure_for_reconstruction | ( | Bproject * | project, |
Bstring | classes, | ||
long & | nmaps, | ||
int & | nthreads | ||
) |
Sets up the particle selection for reconstruction.
*project | project parameter structure. |
classes | string specifying classes to use. |
nmaps | number of maps per class (1,2,3). |
nthreads | number of threads per class (must be even if nmaps > 1). |
The classes are specified in a string of comma-separated numbers, also allowing hyphened ranges (e.g., "2,5-7,9"). The selection numbers for the particles in the project are set to calculate partial maps so that there are nthread maps per class. Each such partial map will be calculated in its own thread and integrated with others from the same class afterwards.
Creates a 2D reconstruction from the images in a multi-image file.
*project | image processing parameter structure. |
file_name | 2D reconstruction file name. |
transform_output | flag to output transformed images. |
The angle of rotation and the x,y origins must already have been found and placed in the appropriate arrays within the Bproject structure. Each selected image is transformed, and then added to the reconstruction image corresponding to the original projection image chosen. If the transform_output flag is set, then the transformed images are written into a new image with a "_proj.spi" ending.
Bimage * project_reconstruct_3D | ( | Bproject * | project, |
long | selnum, | ||
int | calcfom, | ||
Vector3< long > | size | ||
) |
Transforms 3D maps and calculates an average.
*project | parameter structure with all parameters. |
selnum | selection number of reconstructions or particles. |
calcfom | flag to calculate FOM block (1=var, 2=std). |
size | size of particles to extract (only when extraction needed). |
The orientations of the maps in the project must already be specified. Each map is transformed and added to an average map. A FOM block is optionally calculated with either the variance or standard deviation.
Bimage * project_reconstruct_3D | ( | Bproject * | project, |
long | selnum, | ||
Vector3< long > | size, | ||
double | resolution | ||
) |
Transforms 3D maps and calculates an average.
*project | parameter structure with all parameters. |
selnum | selection number of reconstructions or particles. |
size | size of particles to extract (only when extraction needed). |
resolution | maximum reconstruction resolution (in angstrom, default Nyquest). |
The orientations of the maps in the project must already be specified. Each map is transformed and added to an average map. A FOM block is optionally calculated with either the variance or standard deviation.
Vector3< long > project_set_reconstruction_size | ( | Bproject * | project, |
Vector3< double > & | sam, | ||
double | scale, | ||
int | twoD_flag | ||
) |
Sets the reconstruction size for reconstruction from 2D particle images.
*project | project parameter structure. |
&sam | sampling/voxel size of new map. |
scale | scale of reconstruction. |
twoD_flag | doing a 2D reconstruction rather than 3D. |
The reconstruction size is set from the first particle image size found.
long project_single_particle_reconstruction | ( | Bproject * | project, |
Bstring & | maskfile, | ||
Bsymmetry & | sym, | ||
int | num_select, | ||
double | hi_res, | ||
Vector3< double > | scale, | ||
Vector3< long > | size, | ||
int | pad_factor, | ||
int | interp_type, | ||
int | ctf_action, | ||
double | wiener, | ||
int | flags | ||
) |
Reciprocal space reconstruction from the images in a multi-image file.
*project | image processing parameter structure. |
&maskfile | mask to determine density statistics. |
*sym | point group symmetry. |
num_select | selection number from the selection column. |
hi_res | high resolution limit. |
scale | scale of reconstruction. |
size | size of reconstruction. |
pad_factor | image padding factor. |
interp_type | interpolation type (provisional). |
ctf_action | flag to apply CTF to projections. |
wiener | Wiener factor. |
flags | option flags. |
The orientation parameters, view vector, angle of rotation and origin, must all be set. Each image is padded to at least two times its size and its Fourier transform packed into 3D reciprocal space. The figure-of-merit calculated for each reciprocal space voxel is: sum(w*re)^2 + sum(w*im)^2 FOM = --------------------------- sum(w)*sum(w*(re^2 + im^2)) where re real part im imaginary part w weight (inverse distance of image pixel to closest grid point) For voxels with only one data pixel contributing to it, FOM = 0. An image is used in the reconstruction if its selection flag has been set. If the selection number is less than zero, all particles with selection flags greater than zero are used. If the selection number is zero or above, all particles with the selection flag set to the same number are used. A bootstrap reconstruction uses the particle selection to weigh each selected particle.
|
extern |