Bsoft 2.1.4
Bernard's software package
mg_tomo_rec.h File Reference

Functions to do a tomographic reconstruction. More...

#include "mg_processing.h"
#include "rwimg.h"

Functions

Bimageproject_tomo_reconstruct (Bproject *project, double hi_res, double scale, Vector3< long > size, int interp_type, int pad_factor, double edge_width, double marker_radius, int fill_type, double fill, int action, double wiener)
 Reciprocal space reconstruction from the images in a multi-image file.
More...
 
Bimageproject_fourier_reconstruction_slab (Bproject *project, double hi_res, double scale, Vector3< long > size, int slab_start, int slab_end, double marker_radius, int fill_type, double fill, int action, double wiener)
 Reciprocal space reconstruction from the images in a multi-image file.
More...
 
long project_tomo_reconstruct_particles (Bproject *project, double resolution, int interp_type, int pad_factor, int ctf_action, double wiener, Bsymmetry &sym, Bstring &partbase, Bstring &partpath, Bstring &partext)
 Reconstructs particles from a tilt series. More...
 
long img_pack_2D_in_recip_space_slab (Bimage *p, Bimage *prec, long zsize, long slab_start, float *weight, float *weight2, double hi_res, Matrix3 mat, double scale)
 Packs a 2D Fourier transform into a 3D reciprocal space volume.
More...
 
int img_backtransform_slices (Bimage *p)
 Backtransforms 2D slices in a 3D volume.
More...
 
int img_phase_shift_slab_to_origin (Bimage *p, int zsize, int slab_start)
 Phase shifts a set of reflections to the image origin. More...
 
int mg_fft_write (Bproject *project, Vector3< int > size, double scale, int pad_factor, DataType datatype, double marker_radius, int fill_type, double fill)
 Fourier transform micrographs and write to disk.
More...
 
Bimageimg_extract_ytile (Bstring *file_list, int ystart, int ysize)
 Extracts a tile from the image with limits in y.
More...
 
Bimageimg_backtransform_z_on_disk (Bstring *file_list, Bstring &recfile, DataType datatype, double avg, double std, double cutmin, double cutmax)
 The lines along the z-dimensions of a disk-based block is Fourier back-transformed.
More...
 
int img_backtransform_z_lines (Bimage *p)
 The lines along the z-dimensions of a disk-based block is Fourier back-transformed.
More...
 
Bimageproject_missing_mask (Bproject *project, Vector3< long > size, Vector3< double > origin, double hi_res, double scale)
 Creates a reciprocal space mask from the tilt series orientations.
More...
 

Detailed Description

Functions to do a tomographic reconstruction.

Author
Bernard Heymann
Date
Created: 20020416
Modified: 20180629

Function Documentation

◆ img_backtransform_slices()

int img_backtransform_slices ( Bimage p)

Backtransforms 2D slices in a 3D volume.

Parameters
*p3D complex volume.
Returns
int 0.
Each slice is extracted, backtransformed and copied back into the
original volume.
Note: The phases are now not hermitian any more.

◆ img_backtransform_z_lines()

int img_backtransform_z_lines ( Bimage p)

The lines along the z-dimensions of a disk-based block is Fourier back-transformed.

Parameters
*pimage header information (statistics updated).
Returns
int 0.
Each 2D xz plane is read from the raw complex data block.
Each z-line in the plane is back-transformed.
The transformed 2D plane is written back into the raw data block.

◆ img_backtransform_z_on_disk()

Bimage * img_backtransform_z_on_disk ( Bstring file_list,
Bstring recfile,
DataType  datatype,
double  avg,
double  std,
double  cutmin,
double  cutmax 
)

The lines along the z-dimensions of a disk-based block is Fourier back-transformed.

Parameters
*file_listlist of image file names.
&recfilenew reconstruction file name.
datatypedata type for new reconstruction file.
avgtarget average.
stdtarget standard deviation.
cutminminimum for truncation.
cutmaxmaximum for truncation.
Returns
int 0.
Each 2D xz plane is read from the raw complex data block.
Each z-line in the plane is back-transformed.
The transformed 2D plane is written back into the raw data block.

◆ img_extract_ytile()

Bimage * img_extract_ytile ( Bstring file_list,
int  ystart,
int  ysize 
)

Extracts a tile from the image with limits in y.

Parameters
*file_listlist of image file names.
ystartfirst y index.
ysizesize in y.
Returns
Bimage* tile, NULL on failure.
From a series of z-slab images, tiles are extracted from a defined start in y,
and with a defined size in y.
A file indicating the origins of the tiles, "y.tiles", is written to
be used with bpatch to assemble the tiles.

◆ img_pack_2D_in_recip_space_slab()

long img_pack_2D_in_recip_space_slab ( Bimage p,
Bimage prec,
long  zsize,
long  slab_start,
float *  weight,
float *  weight2,
double  hi_res,
Matrix3  mat,
double  scale 
)

Packs a 2D Fourier transform into a 3D reciprocal space volume.

Parameters
*p2D Fourier transform
*prec3D reciprocal space slab volume.
zsizeintentional z dimension of reconstruction.
slab_startstart of current slab.
*weightweigth array.
*weight2weight squared array.
hi_reshigh resolution limit.
mataffine matrix.
scalescale of reconstruction and particle magnification.
Returns
long 0.
The rotation matrix is used to determine the plane in reciprocal space
to which the 2D transform data is added. The map is assumed to be cubic
and the 2D transform square. The real space 2D image must be supplied.
This is then padded to more than twice its original size, fourier
transformed, and packed into the 3D reciprocal space block.

◆ img_phase_shift_slab_to_origin()

int img_phase_shift_slab_to_origin ( Bimage p,
int  zsize,
int  slab_start 
)

Phase shifts a set of reflections to the image origin.

Parameters
*pcomplex image.
zsizeslab thickness.
slab_startslab start.
Returns
int 0.
A real space translation with wrapping is equivalent to phase shifting
in reciprocal space. The phases are shifted based on the embedded
sub-image origins.

◆ mg_fft_write()

int mg_fft_write ( Bproject project,
Vector3< int >  size,
double  scale,
int  pad_factor,
DataType  datatype,
double  marker_radius,
int  fill_type,
double  fill 
)

Fourier transform micrographs and write to disk.

Parameters
*projectimage processing parameter structure.
sizeintended reconstruction size.
scalereconstruction scale.
pad_factorfactor that determines image padding.
datatypedatatype (default complex float).
marker_radiusflag to mask out markers.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER
fillvalue to paint markers.
Returns
Bimage* reconstruction, NULL on failure.
Each micrograph is padded to a square size that has power of 2
dimensions. The micrograph is transformed and the phases shifted
to the origin.
A pad factor of zero indicates use of original size.

◆ project_fourier_reconstruction_slab()

Bimage * project_fourier_reconstruction_slab ( Bproject project,
double  hi_res,
double  scale,
Vector3< long >  size,
int  slab_start,
int  slab_end,
double  marker_radius,
int  fill_type,
double  fill,
int  action,
double  wiener 
)

Reciprocal space reconstruction from the images in a multi-image file.

Parameters
*projectimage processing parameter structure.
hi_reshigh resolution limit.
scalescale of reconstruction.
sizesize of reconstruction.
slab_startstart of reconstruction slab.
slab_endend of reconstruction slab.
marker_radiusflag and radius to mask out markers.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER
fillvalue to paint markers.
actionflag to apply CTF to projections.
wienerWiener factor.
Returns
Bimage* reconstruction, NULL on failure.
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.

◆ project_missing_mask()

Bimage * project_missing_mask ( Bproject project,
Vector3< long >  size,
Vector3< double >  origin,
double  hi_res,
double  scale 
)

Creates a reciprocal space mask from the tilt series orientations.

Parameters
*projectproject parameter structure.
sizesize of mask.
originorigin of mask.
hi_reshigh resolution limit.
scalescale of mask.
Returns
Bimage* mask, NULL on failure.
The orientation parameters of the micrographs must all be set. 
A 2D mask is overlayed onto the 3D image for each micrograph.

◆ project_tomo_reconstruct()

Bimage * project_tomo_reconstruct ( Bproject project,
double  hi_res,
double  scale,
Vector3< long >  size,
int  interp_type,
int  pad_factor,
double  edge_width,
double  marker_radius,
int  fill_type,
double  fill,
int  action,
double  wiener 
)

Reciprocal space reconstruction from the images in a multi-image file.

Parameters
*projectimage processing parameter structure.
hi_reshigh resolution limit.
scalescale of reconstruction.
sizesize of reconstruction.
interp_typeinterpolation type.
pad_factorfactor that determines image padding.
edge_widthedge smoothing width for masks.
marker_radiusflag and radius to mask out markers.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER
fillvalue to paint markers.
actionflag to apply CTF to projections.
wienerWiener factor.
Returns
Bimage* reconstruction, NULL on failure.
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.

◆ project_tomo_reconstruct_particles()

long project_tomo_reconstruct_particles ( Bproject project,
double  resolution,
int  interp_type,
int  pad_factor,
int  ctf_action,
double  wiener,
Bsymmetry sym,
Bstring partbase,
Bstring partpath,
Bstring partext 
)

Reconstructs particles from a tilt series.

Parameters
*projectmicrograph project.
resolutionhigh resolution limit for reconstruction.
interp_typeinterpolation type.
pad_factorfactor that determines image padding.
ctf_actionflag to apply CTF to projections.
wienerWiener factor.
*sympoint group symmetry.
&partbaseparticle base name for new particle reconstructions.
&partpathdirectory for new particle reconstructions.
&partextextension of new reconstructions.
Returns
long number of particles.
Requires the particles to be defined in all micrographs.
The partbase, partpath and partext arguments can be left empty to
use defaults.