|
Bsoft
1.9
Bernard's software package
|
General FFT for n-dimensional data. More...
#include "Bimage.h"#include "img_fourier.h"#include "Matrix.h"#include "matrix_linear.h"#include "math_util.h"#include "trigonometry.h"#include "timer.h"#include "utilities.h"Go to the source code of this file.
Functions | |
| Bimage * | img_cross_correlate (Bimage *p1, Bimage *p2, double hires, double lores, Bimage *pmask) |
| Calculates a cross-correlation map by Fast Fourier transformation. More... | |
| Bimage * | img_cross_correlate (Bimage *p1, Bimage *p2, double hires, double lores, Bimage *pmask, fft_plan planf, fft_plan planb) |
| int | img_find_shift (Bimage *pref, Bimage *p, Bimage *pmask, double hires, double lores, double radius, double sigma, int refine_flag) |
| Calculates a cross-correlation map to find the shift for the pair of images. More... | |
| int | img_find_shift (Bimage *pref, Bimage *p, Bimage *pmask, double hires, double lores, double radius, double sigma, int refine_flag, fft_plan planf, fft_plan planb) |
| int | img_find_peak (Bimage *p, double radius, double sigma) |
| Finds the peak in an image to the nearest voxel. More... | |
| int | img_refine_peak (Bimage *pc) |
| Refines the position of a peak to sub-voxel resolution. More... | |
| Bimage * | img_phase_difference (Bimage *p1, Bimage *p2, double resolution_hi, double resolution_lo) |
| Calculates the cosine of the phase difference between two images. More... | |
| double | img_average_phase_difference (Bimage *p1, Bimage *p2, double resolution_hi, double resolution_lo, int weighting) |
| Calculates the average of the cosine of the phase difference between two images within given resolution shells. More... | |
| int | img_flip_phases (Bimage *p, Bimage *pd) |
| Flips the phases of an image based on a phase difference map. More... | |
Variables | |
| int | verbose |
General FFT for n-dimensional data.
Implementing the FFTW library
Definition in file img_fourier.cpp.
| double img_average_phase_difference | ( | Bimage * | p1, |
| Bimage * | p2, | ||
| double | resolution_hi, | ||
| double | resolution_lo, | ||
| int | weighting | ||
| ) |
Calculates the average of the cosine of the phase difference between two images within given resolution shells.
| *p1 | real space image. |
| *p2 | real space image. |
| resolution_hi | upper resolution limit. |
| resolution_lo | lower resolution limit. |
| weighting | weighting type: 0, none; 1, p1-amp; 2, p2-amp; 3, both amps |
Both images are Fourier transformed and the cosine of the phase difference calculated and averaged.
Definition at line 570 of file img_fourier.cpp.
| Bimage* img_cross_correlate | ( | Bimage * | p1, |
| Bimage * | p2, | ||
| double | hires, | ||
| double | lores, | ||
| Bimage * | pmask | ||
| ) |
Calculates a cross-correlation map by Fast Fourier transformation.
| *p1 | first image. |
| *p2 | second image. |
| hires | high resolution limit. |
| lores | low resolution limit. |
| *pmask | binary mask (only 0 and 1), NULL if not desired. |
FFTW library (www.fftw.org). Two equally sized multi-image 1D, 2D and 3D real space data sets are packed into a complex data set and transformed forward. The transform is unpacked before the first transform is multiplied with the complex conjugate of the second transform. This is then back-transformed to obtain the cross-correlation map in real space. The low resolution limit can be 0, in which case no limits are applied. The resultant cross-correlation image data type is floating point.
Definition at line 45 of file img_fourier.cpp.
| Bimage* img_cross_correlate | ( | Bimage * | p1, |
| Bimage * | p2, | ||
| double | hires, | ||
| double | lores, | ||
| Bimage * | pmask, | ||
| fft_plan | planf, | ||
| fft_plan | planb | ||
| ) |
Definition at line 85 of file img_fourier.cpp.
| int img_find_peak | ( | Bimage * | p, |
| double | radius, | ||
| double | sigma | ||
| ) |
Finds the peak in an image to the nearest voxel.
| *p | image (not altered). |
| radius | search radius (if < 1, default 1e30). |
| sigma | attenuation around radius. |
An image is searched for the global maximum (typically used to find the shift vector in a cross-correlation map). The peak vectors returned are in actual pixel coordinates (no wrapping). The location around which to search is taken from the image origins.
Definition at line 262 of file img_fourier.cpp.
| int img_find_shift | ( | Bimage * | pref, |
| Bimage * | p, | ||
| Bimage * | pmask, | ||
| double | hires, | ||
| double | lores, | ||
| double | radius, | ||
| double | sigma, | ||
| int | refine_flag | ||
| ) |
Calculates a cross-correlation map to find the shift for the pair of images.
| *pref | reference image. |
| *p | image to be shifted. |
| *pmask | binary mask (only 0 and 1). |
| hires | high resolution limit. |
| lores | low resolution limit. |
| radius | search radius (if < 1, default 1e30). |
| sigma | attenuation around radius. |
| refine_flag | set to refine shift to subpixel resolution. |
FFTW library (www.fftw.org).
Two equally sized multi-image 1D, 2D and 3D data sets are transformed
forward, the first transform multiplied by the complex conjugate of
the second transform, followed by backward transformation and
rescaling by 1/(N*N). Data beyond the resolution set in the first
image structure are not used. Therefore the correct setting
of units and resolution in the image are required. Defaults for the
units are usually 1 Angstrom/voxel and a zero resolution would
include the whole image (i.e., no resolution limitation).
A shift vector for each pair of images is calculated to
determine the cross-correlation peak to sub-pixel resolution.
Note: The first image is the reference and the shift returned is to
transform the second to fit the first. Definition at line 154 of file img_fourier.cpp.
| int img_find_shift | ( | Bimage * | pref, |
| Bimage * | p, | ||
| Bimage * | pmask, | ||
| double | hires, | ||
| double | lores, | ||
| double | radius, | ||
| double | sigma, | ||
| int | refine_flag, | ||
| fft_plan | planf, | ||
| fft_plan | planb | ||
| ) |
Definition at line 201 of file img_fourier.cpp.
Flips the phases of an image based on a phase difference map.
| *p | real space or reciprocal space image. |
| *pd | reciprocal space phase difference map. |
Definition at line 666 of file img_fourier.cpp.
| Bimage* img_phase_difference | ( | Bimage * | p1, |
| Bimage * | p2, | ||
| double | resolution_hi, | ||
| double | resolution_lo | ||
| ) |
Calculates the cosine of the phase difference between two images.
| *p1 | real space image. |
| *p2 | real space image. |
| resolution_hi | upper resolution limit. |
| resolution_lo | lower resolution limit. |
Both images are Fourier transformed and the cosine of the phase difference calculated.
Definition at line 479 of file img_fourier.cpp.
| int img_refine_peak | ( | Bimage * | pc | ) |
Refines the position of a peak to sub-voxel resolution.
| *pc | cross-correlation image (not altered). |
The sub-voxel resolution peak in the vicinity of a voxel is defined by fitting a 2D/3D second order function around the voxel. (typically used to find the shift vector in a cross-correlation map).
Definition at line 341 of file img_fourier.cpp.
| int verbose |