| Bsoft 2.0.5 Bernard's software package

Functions
mg_tomo_rec.h File Reference

Functions to do a tomographic reconstruction. More...

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

Go to the source code of this file.

## Functions
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. More...
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. 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, Bstring &label, DataType datatype, double marker_radius, int fill_type, double fill)
| Fourier transform micrographs and write to disk. More...
Bimage * | img_extract_ytile (Bstring *file_list, int ystart, int ysize)
| Extracts a tile from the image with limits in y. More...
Bimage * | img_backtransform_z_on_disk (Bstring *file_list, Bstring &recfile, DataType datatype, Bstring &label, 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...
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. More...

## Detailed Description

Functions to do a tomographic reconstruction.

Author
  Bernard Heymann

Date
  Created: 20020416
  Modified: 20180629

Definition in file mg_tomo_rec.h.

## Function Documentation

## ◆ img_backtransform_slices()

int img_backtransform_slices | ( | Bimage * | p | ) |

Backtransforms 2D slices in a 3D volume.

Parameters

  *p | 3D 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.

Definition at line 731 of file mg_tomo_rec.cpp.

## ◆ 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

  *p | image 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.

Definition at line 1334 of file mg_tomo_rec.cpp.

## ◆ img_backtransform_z_on_disk()

Bimage* img_backtransform_z_on_disk | ( | Bstring * | file_list,
|  | Bstring & | recfile,
|  | DataType | datatype,
|  | Bstring & | label,
|  | 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_list | list of image file names.
  &recfile | new reconstruction file name.
  datatype | data type for new reconstruction file.
  &label | command line string.
  avg | target average.
  std | target standard deviation.
  cutmin | minimum for truncation.
  cutmax | maximum 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.

Definition at line 1184 of file mg_tomo_rec.cpp.

## ◆ 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_list | list of image file names.
  ystart | first y index.
  ysize | size 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.

Definition at line 1082 of file mg_tomo_rec.cpp.

## ◆ 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

  *p | 2D Fourier transform
  *prec | 3D reciprocal space slab volume.
  zsize | intentional z dimension of reconstruction.
  slab_start | start of current slab.
  *weight | weigth array.
  *weight2 | weight squared array.
  hi_res | high resolution limit.
  mat | affine matrix.
  scale | scale 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.

Definition at line 782 of file mg_tomo_rec.cpp.

## ◆ 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

  *p | complex image.
  zsize | slab thickness.
  slab_start | slab 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.

Definition at line 891 of file mg_tomo_rec.cpp.

## ◆ mg_fft_write()

int mg_fft_write | ( | Bproject * | project,
|  | Vector3< int > | size,
|  | double | scale,
|  | int | pad_factor,
|  | Bstring & | label,
|  | DataType | datatype,
|  | double | marker_radius,
|  | int | fill_type,
|  | double | fill
| ) |  |

Fourier transform micrographs and write to disk.

Parameters

  *project | image processing parameter structure.
  size | intended reconstruction size.
  scale | reconstruction scale.
  pad_factor | factor that determines image padding.
  &label | label to write into image.
  datatype | datatype (default complex float).
  marker_radius | flag to mask out markers.
  fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER
  fill | value 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.

Definition at line 986 of file mg_tomo_rec.cpp.

## ◆ 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

  *project | image processing parameter structure.
  hi_res | high resolution limit.
  scale | scale of reconstruction.
  size | size of reconstruction.
  slab_start | start of reconstruction slab.
  slab_end | end of reconstruction slab.
  marker_radius | flag and radius to mask out markers.
  fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER
  fill | value to paint markers.
  action | flag to apply CTF to projections.
  wiener | Wiener 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.

Definition at line 299 of file mg_tomo_rec.cpp.

## ◆ 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

  *project | project parameter structure.
  size | size of mask.
  origin | origin of mask.
  hi_res | high resolution limit.
  scale | scale 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.

Definition at line 1594 of file mg_tomo_rec.cpp.

## ◆ 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

  *project | image processing parameter structure.
  hi_res | high resolution limit.
  scale | scale of reconstruction.
  size | size of reconstruction.
  interp_type | interpolation type.
  pad_factor | factor that determines image padding.
  edge_width | edge smoothing width for masks.
  marker_radius | flag and radius to mask out markers.
  fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER
  fill | value to paint markers.
  action | flag to apply CTF to projections.
  wiener | Wiener 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.

Definition at line 113 of file mg_tomo_rec.cpp.

## ◆ 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

  *project | micrograph project.
  resolution | high resolution limit for reconstruction.
  interp_type | interpolation type.
  pad_factor | factor that determines image padding.
  ctf_action | flag to apply CTF to projections.
  wiener | Wiener factor.
  *sym | point group symmetry.
  &partbase | particle base name for new particle reconstructions.
  &partpath | directory for new particle reconstructions.
  &partext | extension 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.

Definition at line 604 of file mg_tomo_rec.cpp.