Bimage(3)

NAME
Bimage - General image parameter class.

SYNOPSIS

#include <Bimage.h>

  Public Member Functions
Bimage ()
Initializes an image.
Bimage (const Bimage &p)
The copy constructor.
Bimage (Bstring &fn, int readdata, int img_select)
Reads an image from a file.
Bimage (DataType type, CompoundType ctype, long nx, long ny, long nz, long nn)
Initializes an image.
Bimage (DataType type, CompoundType ctype, Vector3< long > size, long nn)
Initializes an image.
Bimage (DataType type, CompoundType ctype, vector< long > size, long nn)
Initializes an image.
Bimage (DataType type, long nc, long nx, long ny, long nz, long nn)
Initializes a generic multi-channel image.
Bimage (DataType type, long nc, Vector3< long > size, long nn)
Initializes a generic multi-channel image.
~Bimage ()
Image destructor.
void check ()
Checks an image for reasonable properties.
bool check_if_same_size (Bimage *p)
Check if two images are the same size.
bool check_if_same_image_size (Bimage *p)
Check if two images are the same size.
void check_sampling ()
Checks that the sampling is properly specified.
void check_resolution (double &resolution)
Checks that the resolution falls within reasonable limits.
bool compatible (Bimage *p)
Check if this image has the same number of channels and data type as another.
void identifier (Bstring s)
Bstring & identifier ()
JSvalue & meta_data ()
JSvalue & operator[] (string tag)
vector< JSvalue * > query (string &path)
long erase (string tag)
void meta_data_update ()
Update metadata from the sub-image information.
void update_from_meta_data ()
Update sub-image information from the metadata.
void meta_data_retain_one_image (long img_num)
Erases all sub-image records from the meta data except one.
void file_name (string s)
string & file_name ()
void label (string s)
string & label ()
time_t get_time ()
tm * get_localtime ()
void set_time (time_t t)
void set_time (tm *t)
long alloc_size () const
long data_size ()
unsigned char * data_alloc ()
unsigned char * data_alloc (long nbytes)
Allocate image data.
unsigned char * data_alloc (DataType type, CompoundType ctype, long nx, long ny, long nz, long nn)
Allocate image data with size parameters.
unsigned char * data_assign (unsigned char *nudata)
Assign image data.
unsigned char * data_pointer ()
unsigned char * data_pointer (long offset)
void data_pointer (unsigned char *ptr)
void data_delete ()
Deallocates the image data.
long data_offset ()
void data_offset (long doff)
long image_size ()
Bimage & operator= (const Bimage &p)
Assigns an image.
double operator[] (long j) const
Returns the data value at the given index.
double get (long nn, long xx, long yy, long zz, long cc=0)
Returns the data value at the given coordinates.
double get (long nn, Vector3< double > vox, long cc=0)
Returns the data value at the given coordinates.
vector< double > values (long i)
void values (long i, vector< double > val)
double * values (long nn, Vector3< double > vox)
Returns an array with all channel data at the given coordinates.
Complex< double > complex (long j)
Returns a complex value at the given index.
Vector3< double > vector3 (long j)
Returns a 3-value vector at the given index.
RGB< double > rgb (long j)
Returns a color value at the given index.
RGBA< double > rgba (long j)
Returns a color value at the given index.
CMYK< double > cmyk (long j)
Returns a color value at the given index.
TypePointer fill_value (double v)
void set (long j, double v)
Sets a single value at the given index.
void set (long j, Complex< double > cv)
Sets a complex value at the given index.
void set (long j, RGB< double > color)
Sets a color value at the given index.
void set (long j, RGBA< double > color)
Sets a color value at the given index.
void set (long j, CMYK< double > color)
Sets a color value at the given index.
void set (long j, Vector3< double > vec)
Sets a 3-value vector at the given index.
void set (long j, View view)
Sets a 3-value vector at the given index.
void add (long j, double v)
void add (long j, Complex< double > cv)
void add (double xx, double yy, double zz, long nn, double v)
Adds a value at a given location to neigboring data elements.
void set_max (double xx, double yy, double zz, long nn, double v)
Sets a value at a given location to neigboring data elements if it is larger.
void multiply (long j, Complex< double > cv)
double average2D (long cc, double xf, double yf, double zf, long nn, double iscale)
Averages in the xy plane when scaling is less than 1.
double average (long cc, double xf, double yf, double zf, long nn, double iscale)
Averages in 3D when scaling is less than 1.
double interpolate (long cc, double xx, double yy=0, double zz=0, long nn=0, double fill=0) const
Interpolates using a given location.
double interpolate (double xx, double yy=0, double zz=0, long nn=0, double fill=0) const
double interpolate (long cc, Vector3< double > vec, long nn=0, double fill=0) const
double interpolate (Vector3< double > vec, long nn=0, double fill=0) const
double interpolate (vector< double > vec, long nn=0, double fill=0) const
double interpolate_wrap (long cc, double xx, double yy=0, double zz=0, long nn=0) const
Interpolates using a given location with wrapping.
double interpolate_wrap (double xx, double yy=0, double zz=0, long nn=0) const
double interpolate_wrap (long cc, Vector3< double > vec, long nn=0) const
double interpolate_wrap (Vector3< double > vec, long nn=0) const
DataType data_type ()
void data_type (DataType dt)
CompoundType compound_type ()
void compound_type (CompoundType ct)
long data_type_bits () const
Returns the size of the datatype in bits.
long data_type_size () const
Returns the size of the datatype in bytes.
long compound_type_size ()
double data_type_min ()
Get the minimum of a datatype.
double data_type_max ()
Get the maximum of a datatype.
Bstring data_type_string ()
Get the string representation of a datatype.
Bstring compound_type_string ()
Get the string representation of a datatype.
void fix_type ()
Determines the replacement data type.
void change_type (char letter)
Get the data type indicated by a single letter code.
void change_type (char *string)
Get the data type from a string.
void change_type (DataType newtype)
Change the data to the new type.
void split_channels ()
The channels are split into individual images.
void combine_channels (long nc)
The channels are composed from individual images.
FourierType fourier_type ()
void fourier_type (FourierType tf)
void zero_fourier_origin ()
Zeroes the first voxel in each image.
long channels ()
void channels (long cc)
Vector3< long > size () const
void size (long nx, long ny, long nz)
void size (Vector3< long > vec)
void size (vector< long > vec)
void sizeX (long nx)
void sizeY (long ny)
void sizeZ (long nz)
long sizeX () const
long sizeY () const
long sizeZ () const
long index (long nx, long ny) const
long index (long nx, long ny, long nz) const
long index (long nx, long ny, long nz, long nn) const
long index (long nc, long nx, long ny, long nz, long nn) const
long index (Vector3< long > vox, long nn) const
long index (vector< long > vox, long nn) const
long index_wrap (long nx, long ny, long nz) const
long index_wrap (Vector3< long > coor) const
long index_wrap (vector< long > coor) const
void coordinates (long i, long &nx, long &ny, long &nz)
void coordinates (long i, long &nx, long &ny, long &nz, long &nn)
void coordinates (long i, long &nc, long &nx, long &ny, long &nz, long &nn)
Vector3< long > coordinates (long i)
bool within_boundaries (Vector3< double > loc)
bool within_boundaries (long xx, long yy, long zz)
Vector3< long > kernel_low (long i, long k=1)
Vector3< long > kernel_high (long i, long k=1)
Vector3< long > kernel_low (long i, Vector3< long > k)
Vector3< long > kernel_high (long i, Vector3< long > k)
long kernel_max (long idx, long ksize)
Finds the highest value in a kernel.
long kernel_max_neigbor (long idx, long ksize)
Finds the highest value in a kernel excluding the central voxel.
long kernel_max_wrap (long idx, long ksize)
Finds the highest value in a kernel with wrapping.
Vector3< long > page_size ()
void page_size (long nx, long ny, long nz)
void page_size (Vector3< long > vec)
void page_size (vector< long > vec)
Vector3< double > real_size ()
long images ()
void images (long nn)
Vector3< double > sampling ()
double voxel_size ()
void sampling (long nn, Vector3< double > u)
void sampling (long nn, double ux, double uy, double uz)
void sampling (Vector3< double > u)
void sampling (double ux, double uy, double uz)
Vector3< double > sampling (long nn)
double minimum ()
double maximum ()
double average ()
double standard_deviation ()
void minimum (double d)
void maximum (double d)
void average (double d)
void standard_deviation (double d)
double background (long nn)
void background (long nn, double bkg)
void background (double bkg)
long show_image ()
void show_image (long nn)
long show_slice ()
void show_slice (long nz)
double show_scale ()
void show_scale (double scale)
double show_minimum ()
double show_maximum ()
void show_minimum (double v)
void show_maximum (double v)
void origin (double ox, double oy, double oz)
void origin (vector< double > vec)
void origin (Vector3< double > vec)
void origin (long nn, Vector3< double > vec)
void origin (long nn, vector< double > ori)
void origin (long nn, double ox, double oy, double oz)
Vector3< double > default_origin ()
void view (double vx, double vy, double vz, double va)
void view (View vw)
long space_group ()
void space_group (unsigned int grp)
string & symmetry ()
void symmetry (string grp)
void unit_cell (UnitCell uc)
UnitCell unit_cell ()
double maximum_included_radius ()
Returns the radius of the enclosed sphere or circle.
int slices_to_images ()
Changes the slices in a 3D image into a set of 2D images.
int images_to_slices ()
Changes the 2D images to slices in a 3D image.
long delete_images (Bstring list, int retain=0)
Retains or deletes sub-images from a multi-image structure.
long select_images (Bstring list)
unsigned char * read_data (ifstream *fimg, int img_select, int sb, int vax, long pad)
Read image data in a generalized style.
int write (Bstring &fn)
int unpack_transform (unsigned char *data, FourierType tf)
int unpack_transform (int img_select, unsigned char *data, FourierType tf)
int pack_transform (unsigned char *data, FourierType tf)
int pack_transform (int img_select, unsigned char *data, FourierType tf)
long statistics ()
Calculates the statistics for an image.
long statistics (long img_num)
Calculates the statistics for a sub-image.
long statistics (Bimage *pmask, double &regavg, double &regstd)
Calculates the statistics for a region in an image.
long stats_within_radii (long nn, Vector3< double > loc, double rad_min, double rad_max, double &vavg, double &vstd)
Calculates the statistics for an image within given radii from a location.
long stats_in_shape (long nn, int type, Vector3< long > start, Vector3< long > end, double &vavg, double &vstd)
Calculates the statistics for an image within the given box.
long stats_in_poly (long nn, int nvert, Vector3< double > *poly, double &vavg, double &vstd)
Calculates the statistics for an image within the given polyhedron.
long stats_in_mask (long nn, Bimage *pmask)
Calculates the statistics for an image for each level in a mask.
int variance (long kernel_size)
Calculates the local variance within the given kernel.
int variance (Bimage *pweight)
Calculates the local variance weighed with the given image.
int information ()
Prints out header information for an image.
int subimage_information ()
Prints out header information for all sub-images.
int moments (long max_order)
Prints out moments for all sub-images.
int moments (long max_order, long nn)
Prints out moments for one sub-image.
void get (Bstring tag)
Prints out header information associated with a tag string.
Bimage * copy ()
Copies the header information and data of an image into a new image structure.
Bimage * copy (long nu_nimg)
Copies the header information and data of an image into a new image structure.
Bimage * copy_header ()
Bimage * copy_header (long nu_nimg)
Copy an image structure into a new one.
Bimage * extract (long nn)
Extracts one sub-image into new image structure.
Bimage * extract (long n1, long n2)
Extracts a set of sub-images into new image structure.
Bimage * extract (long nn, Vector3< long > coords, Vector3< long > size, int fill_type=0, double fill=0)
Extracts a region of one sub-image into new image structure.
Bimage * extract (long nn, Vector3< double > loc, Vector3< long > size, Vector3< double > origin)
Bimage * extract (long nn, Vector3< double > loc, Vector3< long > size, Vector3< double > origin, Matrix3 mat)
Extracts a region of one sub-image into new image structure.
Bimage * extract (long nn, Vector3< double > loc, Vector3< long > size, Vector3< double > origin, View view)
Bimage * extract_wrap (long nn, Vector3< double > loc, Vector3< long > size, Vector3< double > origin, Matrix3 mat)
Extracts a region of one sub-image into new image structure with wrapping.
Bimage * extract_wrap (long nn, Vector3< long > size, Matrix3 mat)
Bimage * extract_shell (long nn, double minrad, double maxrad)
Extracts a shell from an image into a new image.
vector< Vector3< long > > tile_coordinates (Vector3< long > &start, Vector3< long > &region, Vector3< long > &tile_size, Vector3< long > &step_size, int exceed)
Generates a set of tile coordinates for an image.
Bimage * extract_tiles (long nn, vector< Vector3< long >> &coords, Vector3< long > tile_size)
Extracts a set of tiles at specified positions from an image into a new image.
Bimage * extract_tiles (long nn, Vector3< long > start, Vector3< long > region, Vector3< long > tile_size, Vector3< long > step_size, int exceed)
Extracts a set of tiles from an image into a new image.
Bimage * extract_tiles (long nn, Vector3< long > tile_size, double fraction=0.2)
Extracts a set of tiles from an image into a new image.
Bimage * extract_line (long nn, Vector3< double > start, Vector3< double > end, long width)
Extracts a line from an image into a new image.
Bimage * extract_tetrahedron (Vector3< double > *tet, int fill_type=0, double fill=0)
Extracts a tetrahedral part of the image.
Bimage * orthogonal_slices (long nn, Vector3< long > voxel, Vector3< long > ext_size)
Extracts orthogonal views around a voxel.
int extract_show_chunk (Bimage *pshow, int aflag, long i, long len)
Bimage * extract_show (int aflag)
Converts a slice from an image to a 2D plane for display.
Bimage * extract_magnify (long nn, Vector3< long > center, Vector3< long > ext_size, double scale)
Extracts a region from an image to magnify.
Bimage * extract_slice (long nz)
Extracts a given slice or slices from an image.
Bimage * extract_filament (long img_num, double width, int axis, long nspline, Vector3< double > *spline)
Extracts a filament defined by a series of coordinates.
int replace (Bimage *img)
Replaces the data with that from the given image.
int replace (long nn, Bimage *img, long nr=0)
Replaces one sub-image in an image structure.
int replace (long nn, Bimage *img, long nr, double fill)
Replaces one sub-image in an image structure.
void clear ()
void fill (double v)
double density (long nn, Vector3< double > coord, double radius, double &sigma)
Calculates the density in a sphere around a coordinate in an image.
double density (long nn, Vector3< double > coord, double radius)
double relative_density (Bimage *pmask)
Calculates the relative density in a region defined by a mask.
void invert ()
Inverts the data in the image.
void reslice (const char *order)
void reslice (Bstring order)
Switches axes of an image.
void add (double v)
Adds a constant value to an image.
void multiply (double v)
Multiplies an image with a constant value.
void multiply (long nn, double v)
Multiplies a sub-image with a constant value.
void power (double v)
Calculates the power of an image.
void sum_images ()
Adds all sub-images.
void average_images ()
Bimage * average_images (bool sd)
Averages all sub-images and optionally calculates standard deviation image.
void add (Bimage *p)
Adds another image to an image.
void add (long nn, Bimage *p)
Adds another image to a sub-image.
void subtract (Bimage *p)
Subtracts another image from an image.
void add (Bimage *p, double scale, double shift)
Adds another image to an image.
void add (long nn, Bimage *p, double scale, double shift)
Adds another image to an image.
void multiply (Bimage *p, double scale, double shift=0)
Multiplies an image with another image.
void multiply (long nn, Bimage *p)
Multiplies a sub-image with another image.
void multiply (Bimage *p)
Multiplies all sub-images with the first sub-image of the other image.
void divide (Bimage *p, double scale=1, double shift=0)
Divides the first image by the second.
void divide_one (Bimage *p, double scale=1, double shift=0)
Divides the first image by the first sub-image of the second.
void inverse (double minval=0)
Calculates the inverse of the image.
void largest (Bimage *p)
Selects the largest of each pixel from two images.
void smallest (Bimage *p)
Selects the smallest of each pixel from two images.
Bimage * operator+ (Bimage &p)
Adds two images together, adjusting for size difference.
Bplot * plot ()
Converts a one-dimensional image into a plot.
void sum (long m, Bimage **p)
Sums an array of images with their FOM blocks.
void catenate (long m, Bimage **p)
Catenates an array of images of the same size into a multi-image structure.
Bimage * blend (Bimage *p, long number)
Blends the two images, creating a new set of sub-images.
int place (long nn, Bimage *p, Vector3< double > loc, double radius=0, double scale=1, double shift=0, int operation=0)
Places a small image into a large image.
int place_with_addition (Bimage *p, long nn)
Packs a tile with overlap into a new composite image.
int place_with_overlap (Bimage *p, long nn)
Packs a tile with overlap into a new composite image.
int place_central_part (Bimage *p, long nn)
Packs a tile with overlap into a new composite image.
int assemble_tiles (Bimage *pt, int flag=0)
Assembles overlapping tiles into this image.
double linear_fit (Bimage *p, Bimage *pmask, double max_exclude)
Linear least squares fit of two images.
int histomatch (Bimage *p, long bins)
Fits two images by matching the histogram of the second to the first.
int kernel_gaussian (double sigma, double max)
Generates a gaussian kernel image.
int kernel_laplacian_of_gaussian (double sigma, double max)
Generates a laplacian-of-gaussian kernel.
int filter_average (long kernel_size)
Applies an averaging filter to an image.
int filter_average (Vector3< long > k)
int filter_gaussian (long kernel_size, double sigma)
Applies a gaussian filter to an image.
int filter_sinc ()
Weighs an image with a sinc function.
int convolve_chunk (Bimage *pkernel, float *nudata, long i, long len)
int convolve (Bimage *pkernel)
Convolves an image with an arbitrary size convolution filter.
int filter_ortho (int type)
Convolves the image with an orthogonal kernel with wrapping.
int filter_dog (double sigma1, double sigma2)
Convolves the image with a difference of gausians kernel.
int filter_bilateral_chunk (Bimage *pkernel, double sigma2, int kernel_type, float *nudata, long i, long len, int first)
int filter_bilateral (double sigma1, double sigma2, int kernel_type, long kernel_radius)
Denoise an image with combined gaussian distance and density difference kernel.
int filter_rolling_ball (long radius, double scale)
Apply a rolling ball filter.
int filter_rank_chunk (long kernel_size, double rank, float *nudata, long i, long len)
int filter_rank (long kernel_size, double rank)
Applies a median filter to an image.
Bimage * filter_peak (long kernel_size)
Finds the peaks in an image.
Bimage * periodic_averaging (Vector3< double > period)
Calculates an average within a periodic frame.
Bimage * nad_2D (double ht, double lambda, double C, double alpha)
Denoises a 2D image by non-linear anisotropic diffusion.
Bimage * nad (double ht, long zw, double lambda, double C, double alpha)
Denoises a 3D density map by non-linear anisotropic diffusion.
void simple_to_complex ()
A simple image is converted to a complex image.
void complex_to_real ()
The real part of a complex image is written to a simple image.
void complex_to_imaginary ()
The imaginary part of a complex image is written to a simple image.
void complex_to_intensities ()
The intensities from a complex image is written to a simple image.
void complex_to_amplitudes ()
The amplitudes from a complex image is written to a simple image.
void complex_to_signed_amplitudes ()
The signed amplitudes from a complex image is written to a simple image.
void complex_to_phases ()
The phases from a complex image is written to a simple image.
void complex_conjugate ()
Calculates the complex conjugate image.
double complex_power ()
Calculates the power in a complex image.
double complex_normalize ()
Normalizes the power in a complex image.
int phase_shift (Vector3< double > shift)
Phase shifts a complex image.
int phase_shift (long nn, Vector3< double > shift)
Phase shifts a complex sub-image.
int phase_shift_to_origin ()
Phase shifts a set of reflections to the image origin.
int phase_shift_to_center ()
Phase shifts a set of reflections to the nominal center of the image origin.
int complex_multiply (Bimage *p)
Calculates the product of a complex image with a simple image.
int complex_product (Bimage *p)
Calculates the complex product of two complex images.
int complex_conjugate_product (Bimage *p)
Calculates the product of a complex image with the conjugate of a second.
Bimage * complex_conjugate_product_one2many (Bimage *p)
Calculates the product of a complex image with the conjugate of a second.
int complex_apply_mask (Bimage *pmask)
Applies a mask to a complex image.
int complex_apply_negative_mask (Bimage *pmask)
Applies a negative mask to a complex image.
int complex_apply_dual_mask (Bimage *pmask)
Applies a dual mask to a complex image.
int complex_bandpass (double hires, double lores)
Bandpasses a Fourier transform.
Bimage * pack_two_in_complex (Bimage *p)
Packs two real images into one complex image.
Bimage * unpack_combined_transform ()
Unpacks a complex transform obtained from two real images.
int combined_complex_product ()
Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images.
int combined_complex_product (Bimage *pmask)
Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images.
int combined_complex_product (double hires, double lores)
Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images.
int combined_complex_product (double hires, double lores, Bimage *pmask)
Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images.
int combined_complex_product_implicit_mask (double hires, double lores)
Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images.
double merge_amplitudes_and_phases (Bimage *pamp)
Merges the amplitudes from one map with the phases of another.
double merge_amplitudes_and_phases (Bimage *pref, double res_hi, double res_lo)
Keeps selected phases and replaces amplitudes and other phases from a reference transform.
Bimage * intensities_phase_colored (double scale)
Generates a power spectrum with phases colored according to a color wheel.
int phase_colour_wheel ()
Generates a phase color wheel.
fft_plan fft_setup (fft_direction dir, int opt=0)
Sets up a plan for fast Fourier transforms.
int fft ()
int fft_back ()
int fft (fft_direction dir)
Fast Fourier transforms an image.
int fft_back (fft_plan plan, bool norm_flag=1)
int fft (fft_direction dir, bool norm_flag)
Fast Fourier transforms an image.
int fft (fft_plan plan, bool norm_flag=1)
Fast Fourier transforms an image.
Vector3< double > change_transform_size (Vector3< long > nusize)
Resizes a 'standard' transform.
int power_spectrum (int flags=0)
Calculates a power spectrum.
Bimage * powerspectrum_tiled (long img_num, Vector3< long > tile_size, int flags=0)
Prepares a tiled power spectrum from an image for determining CTF parameters.
Bimage * powerspectrum_tilt_axis (long img_num, Vector3< long > tile_size, double tilt_axis, double tilt_offset, int flags=0)
Prepares a tiled powerspectrum from a tilted image for determining CTF parameters.
Bimage * defocus_scale (long nn, double df, double df2, double iCL2, int fill_type)
Bimage * powerspectrum_tilted (long img_num, Vector3< long > tile_size, double tilt_axis, double tilt_angle, double defocus, double iCL2, int flags=0)
Prepares a tiled powerspectrum from a tilted image for determining CTF parameters.
Bimage * powerspectrum_tiled_and_tilted (Vector3< long > tile_size, double tilt_axis, double tilt_angle, double tilt_offset, double defocus, double iCL2, int flags=0)
Prepares a tiled powerspectrum from a tilted image for determining CTF parameters.
long fspace_maximum_radius (double resolution)
Calculates the maximum radius in frequency space from a given resolution.
int fspace_background ()
Calculates the background for a Fourier transform.
Complex< double > fspace_interpolate (long img_num, Vector3< double > m, FSI_Kernel *kernel)
Calculates the complex value at an image location by kernel-based interpolation.
int fspace_2D_interpolate (Complex< float > cv, Vector3< double > m, double part_weight, int interp_type, Vector3< double > vscale)
Interpolates a 2D image for packing ito a 3D reciprocal space volume.
int fspace_pack_2D (Bimage *p, Matrix3 mat, double hi_res=0, double lo_res=0, double scale=1, double part_weight=1, int interp_type=0)
Packs a 2D Fourier transform into a 3D reciprocal space volume.
int fspace_pack_2D (Bimage *p, View asu_view, Bsymmetry *sym, double hi_res=0, double lo_res=0, double scale=1, double part_weight=1, int interp_type=0)
Packs a 2D Fourier transform into a 3D reciprocal space volume.
long fspace_pack_2D_into_central_section (Bimage *p, long ft_size, double scale, double hi_res, double lo_res, Matrix3 matr, Matrix3 mat)
Packs a 2D Fourier transform into a central section of a 3D reciprocal space volume.
int fspace_pack_3D (Bimage *p, double hi_res=0, double threshold=0)
Packs a 3D Fourier transform into a 3D reciprocal space volume.
long fspace_reconstruction_add (Bimage *p)
Adds all components to a reconstruction.
long fspace_reconstruction_weigh ()
Weighs a reconstruction.
int fspace_reconstruction_stats (double resolution)
Calculates Fourier shell statistics.
int fspace_reconstruction_stats2 (double resolution)
long fspace_reconstruction_snr ()
Calculates the SNR map.
int fspace_translate (Vector3< double > shift)
Translates an image in frequency space to avoid interpolation.
int fspace_translate (long nn, Vector3< double > shift)
Translates an image in frequency space to avoid interpolation.
int fspace_resize (double scale, double res_hi, double res_lo)
Resizes an image in frequency space to avoid interpolation.
Bimage * fspace_resize (Bimage *pref)
Resizes an image in frequency space to avoid interpolation.
int fspace_amp_one ()
Sets all amplitudes to one.
int fspace_amp_threshold (double threshold)
Filters the amplitudes of the Fourier transform of an image.
int fspace_sqrt_amp ()
Change the amlitudes to their square roots.
int fspace_square_amp ()
Change the amlitudes to their squares.
int fspace_bandpass (double res_hi, double res_lo=0, double width=0)
Applies a bandpass filter to an image.
int fspace_bandpass (double res_hi, double res_lo, double width, fft_plan planf, fft_plan planb)
Applies a bandpass filter to an image.
Bimage * fspace_radial_power (double resolution)
Calculates the radial power spectrum from a Fourier transform.
double * fspace_radial (long nn, long maxrad, int flag=0)
Calculates the radial power spectrum from a Fourier transform.
int fspace_weigh (long maxrad, double *curve, int flag=0)
int fspace_weigh (vector< double > &curve, int flag=0)
int fspace_scale (long maxrad, double *scale, Bimage *pmask=NULL)
int fspace_scale (long nn, long maxrad, double *scale, Bimage *pmask=NULL)
int fspace_scale (vector< double > &scale, Bimage *pmask=NULL)
int fspace_scale (long nn, vector< double > &scale, Bimage *pmask=NULL)
double fspace_fit_B_factor (double res_hi=0)
Determines the overall B-factor of an image.
int fspace_weigh_ramp (double resolution, fft_plan planf, fft_plan planb)
Weighs a transform with a ramp.
int fspace_weigh_ramp (double resolution, double axis, fft_plan planf, fft_plan planb)
Weighs a transform with a ramp.
int fspace_weigh_B_factor (double B, double resolution=0)
Weighs an image's amplitudes with B-factor (gaussian) curve.
int fspace_weigh_C_curve (double resolution=0)
Weighs an image's amplitudes with the carbon scattering curve.
int fspace_weigh_LoG (double resolution, double sigma)
Weighs an image's amplitudes with a Laplacian-of-Gaussian function.
int fspace_weigh_RPS_curve (Bplot *plot, double resolution=0)
Weighs an image's amplitudes with a given RPS curve.
int fspace_weigh_FSC_curve (Bplot *plot, double resolution=0)
Weighs an image's amplitudes with a given FSC curve.
int fspace_weigh (Bimage *pref, Bimage *pmask, double resolution=0)
Weighs an image's amplitudes with the radial power spectrum of another.
int fspace_weigh_dose (long nn, double dose_per_frame, vector< double > critdose)
int fspace_weigh_dose (double dose_per_frame)
Weighs an image's amplitudes with the accumulated dose.
int fspace_normalize ()
Normalizes an image's amplitudes.
int fspace_normalize_radial (Bimage *pmask, double resolution=0, int flag=0)
Normalizes an image's amplitudes.
int fspace_positive ()
Sets the image to positive definite.
double friedel_check ()
Checks Friedel symmetry.
int friedel_apply ()
Applies Friedel symmetry.
Bimage * project (char axis, int flags=1)
Projects a 3D image to a 2D image down one of the three major axes.
Bimage * rotate_project (Matrix3 mat, Vector3< double > translate, double radial_cutoff, int norm_flag=1)
Rotates a 3D map and projects it along the z-axis.
Bimage * project (View *view, int norm_flag=1)
Calculates a set of projections from a 3D density map.
Bimage * central_section (Matrix3 mat, double resolution, FSI_Kernel *kernel)
Calculates a central section of a 3D fourier transform.
Bimage * project (View *view, double resolution, FSI_Kernel *kernel)
Calculates a set of projections as central sections from a 3D fourier transform.
int back_project (Bimage *p, double resolution, double axis, fft_plan planf, fft_plan planb)
Bimage * resolution_prepare (Bimage *p)
Bimage * resolution_prepare (Bimage *p, fft_plan plan)
Bplot * fsc_dpr (double hi_res, double sampling_ratio=1, int flag=0)
Calculates an FSC and DPR curves from two images.
Bplot * fsc (double hi_res, double sampling_ratio=1)
Bplot * fsc (Bimage *p, double hi_res, double sampling_ratio=1)
Bimage * fsc_shell (Bimage *p, double hi_res, double *cutoff, int thickness, int step, int minrad, int maxrad, int pad=1, int smooth=0, double fill=0)
Determine the resolution for each concentric shell in a map.
Bimage * fsc_local (Bimage *p, Bimage *pmask, double resolution, double *cutoff, int mask_level, int size, int pad, Vector3< long > vedge, int step=1, int taper=1, double fill=0)
Determine the local resolution at each masked voxel in a map.
Bimage * local_filter (Bimage *pmask, int mask_level, Bimage *resmap, int size, Vector3< long > vedge)
Applies a local resolution filter to a map.
Bimage * phase_difference (Bimage *p, int type=0, double res_hi=0, double res_lo=0)
Calculates the cosine of the phase difference between two images.
double average_phase_difference (Bimage *p, double res_hi, double res_lo, int weighting=1)
Calculates the average of the absolute phase difference between two images within given resolution shells.
int phase_flip (Bimage *pd)
Flips the phases of an image based on a phase difference map.
double correlate (Bimage *p)
Calculates correlation coefficient between two images.
double correlate (Bimage *p, double rmin, double rmax, Bimage *pmask=NULL, int flag=0)
Calculates a correlation coefficient between two images.
double rotate_correlate (Vector3< double > axis, double angle)
Rotates a copy of an image and correlates it with the original.
double R_factor (Bimage *p)
Calculates an R factor between two images.
int auto_correlate (double hires, double lores)
Calculates an autocorrelation map by Fast Fourier transformation.
Bimage * cross_correlate (Bimage *p, double hires, double lores, fft_plan planf, fft_plan planb)
Calculates a cross-correlation map by Fast Fourier transformation.
Bimage * cross_correlate (Bimage *p, Bimage *pmask=NULL)
Bimage * cross_correlate (Bimage *p, double hires, double lores, Bimage *pmask=NULL)
Calculates a cross-correlation map by Fast Fourier transformation.
double correlation_coefficient (Vector3< double > shift)
Calculates a coefficient from a Fourier correlation transform given a shift.
Vector3< double > find_shift_in_transform (double shift_limit)
Finds the shift by brute force backtransformation for selected shifts.
Bimage * cross_correlate_fspace (Bimage *p, double hires, double lores, double shift_limit)
Calculates a cross-correlation map by Fast Fourier transformation.
Bimage * cross_correlate (Bimage *p, double hires, double lores, Bimage *pmask, fft_plan planf, fft_plan planb)
Bimage * cross_correlate_two_way (Bimage *p, double hires, double lores, fft_plan planf, fft_plan planb)
Calculates a cross-correlation map by Fast Fourier transformation.
Bimage * cross_correlate_validate (Bimage *p, Bimage *pmask)
Calculates a masked cross-correlation map by Fast Fourier transformation.
Vector3< double > rotate_cross_correlate (Bimage *pref, View view, double hires, double lores, double search_radius, Bimage *pmask, double &cc, fft_plan planf, fft_plan planb)
double rotate_cross_correlate_two_way (Bimage *pref, double angle, double res_hi, double res_lo, double shift_limit, fft_plan planf, fft_plan planb)
int find_shift (Bimage *pref, 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.
Vector3< double > find_shift (Bimage *pref, Bimage *pmask, double hires, double lores, double radius, double sigma, int refine_flag, double &cc)
Vector3< double > find_shift (Bimage *pref, double hires, double lores, double radius, double sigma, int refine_flag, fft_plan planf, fft_plan planb)
Calculates a cross-correlation map to find the shift for the pair of images.
Vector3< double > find_shift (Bimage *pref, Bimage *pmask, double hires, double lores, double radius, double sigma, int refine_flag, fft_plan planf, fft_plan planb, double &cc)
Calculates a cross-correlation map to find the shift for the pair of images.
Vector3< double > find_shift (long nn, Bimage *pref, Bimage *pmask, double hi_res, double lo_res, double shift_limit, fft_plan planf, fft_plan planb)
Calculates a cross-correlation map to find the shift for the pair of images.
Bimage * find_template (Bimage *ptemp, Bimage *pmask, double hires, double lores, int bin, fft_plan planf, fft_plan planb)
Finds one or more matches to a template.
int find_center (Bimage *pmask, double hires, double lores, double radius, double sigma, int refine_flag)
Finds the center of mass of an image by cross-correlation with its inverse.
Vector3< double > rotate_find_shift (Matrix3 mat, double hires, double lores, double radius, double sigma, int refine_flag, fft_plan planf, fft_plan planb, double &cc)
Rotates and find shift by cross-correlation.
int find_peak (double radius=1e30, double sigma=0)
Finds the peak in an image to the nearest voxel.
Vector3< double > fit_peak ()
Fits an elliptic parabole to locate the position of the peak to sub-voxel resolution.
int refine_peak ()
Refines the position of a peak to sub-voxel resolution.
Bimage * find_peaks (long kernelsize)
Finds peaks in a map with periodic boundaries.
Vector3< double > * find_peaks (double excl_dist, long &ncoor, double &threshold_min, double &threshold_max, double pix_min=2, double pix_max=10)
Finds the peaks in a cross-correlation map to find template matches.
double ccmap_confidence (long nn)
Calculates a confidence level to associate with a cross-correlation peak.
double peak_sigma (long nn, Vector3< long > coor, long kernel_size)
Calculates a sigma value for a cross-correlation peak.
double search_views (Bimage *ptemp, View *view, double hires, double lores, double search_radius, Bimage *pmask, View &currview, Vector3< double > &currshift)
Searches a 2D/3D density map for a template.
double search_volume_view (Bimage *ptemp, View view, double hires, double lores, Bimage *pmask, double threshold, Bimage *pfit)
Searches a 2D/3D density map for a template using a specific view.
Bimage * search_volume (Bimage *ptemp, View *view, double alpha, double alpha_step, double hires, double lores, Bimage *pmask, double threshold)
Searches a 2D/3D density map for a template.
Vector3< double > find_shift_in_transform (long nn, Bimage *pref, double shift_limit)
Bimage * align_progressive_fast (long nref, double shift_limit)
Aligns and sums a set of sub-images using a progressive algorithm.
Bimage * align_progressive (long nref, Bimage *pmask, double hi_res, double lo_res, double shift_limit, fft_plan planf, fft_plan planb)
Aligns and sums a set of sub-images using a progressive algorithm.
JSvalue align (long ref_num, Bimage *pmask, double hi_res, double lo_res, double shift_limit, double edge_width, double gauss_width, Vector3< long > bin)
Aligns and sums a set of sub-images, first progressively and then iteratively.
JSvalue align_fast (long ref_num, Bimage *pmask, double hi_res, double lo_res, double shift_limit, double edge_width, double gauss_width)
Aligns and sums a set of sub-images, first progressively and then iteratively.
double correlate_annuli (Bimage *polref, int ann_min, int ann_max, double ang_min, double ang_max, fft_plan planf, fft_plan planb, double &cc_max)
Correlate annuli of a polar image.
double * pps_angular_correlation (Bimage *pref, double res_hi, double res_lo, long nang, fft_plan planf)
double align2D_pps (Bimage *pref, double res_hi, double res_lo, double shift_limit, double angle_limit, fft_plan planf, fft_plan planb)
Finds the best in-plane alignment for two 2D images using polar power spectra.
double align2D (Bimage *pref, double res_polar, int ann_min, int ann_max, Bimage *prs_mask, double shift_limit, double angle_limit, fft_plan planf_1D, fft_plan planb_1D, fft_plan planf_2D, fft_plan planb_2D)
Finds the best in-plane alignment for two 2D images using polar power spectra.
int align2D (Bimage *pref, int ann_min, int ann_max, double res_lo, double res_hi, double shift_limit, double angle_limit)
Finds the best in-plane alignment for two 2D images using polar power spectra.
void simple_to_rgb ()
A simple image is converted to a color image.
void simple_to_rgba ()
A simple image is converted to a color image.
void color_to_simple ()
A color image is converted to a simple image.
void rgb_to_rgba ()
An alpha channel is added to a RGB color image.
void rgba_to_rgb ()
The alpha channel is delete from an RGBA color image.
void rgb_to_cmyk ()
Converts an RGB color image to CMYK.
void cmyk_to_rgb ()
Converts a CMYK color image to RGB.
int one_color (int color, double cmin, double cmax, int gray_extremes=0)
Converts a gray-scale image to a single color.
int color_red (double cmin, double cmax, int gray_extremes=0)
Converts a gray-scale image to red.
int color_green (double cmin, double cmax, int gray_extremes=0)
Converts a gray-scale image to green.
int color_blue (double cmin, double cmax, int gray_extremes=0)
Converts a gray-scale image to blue.
int pure_color ()
Generates a pure color image without intensity.
int color_combine (Bimage *p)
Combines two colored images.
Bimage * color_spectrum (double cmin, double cmax)
Colorizes an image to a spectrum.
Bimage * red_white_blue (double red_min, double white_min, double white_max, double blue_max)
Colorizes an image with blue positive and red negative.
int rescale (double scale, double shift)
Rescales the image data with a given multiplier and offset.
int rescale (long nn, double scale, double shift)
Rescales the image data with a given multiplier and offset.
int rescale_to_min_max (double numin, double numax)
Rescales the image data to a given minimum and maximum.
int rescale_to_min_max (long nn, double numin, double numax)
Rescales the image data to a given minimum and maximum.
int rescale_to_avg_std (double nuavg, double nustd)
Rescales the image data to a given average and standard deviation.
int rescale_to_avg_std (long nn, double nuavg, double nustd)
Rescales the image data to a given average and standard deviation.
int rescale_to_avg_std (double nuavg, double nustd, Bimage *pmask)
Rescales the image data to a given average and standard deviation.
int truncate (double minim, double maxim, double setmin, double setmax)
Truncates image data to a given minimum and maximum.
int truncate_to_min_max (double minim, double maxim)
Truncates image data to a given minimum and maximum.
int truncate_to_avg (double minim, double maxim)
Sets voxels in image data exceeding a given minimum and maximum to the average.
int truncate_to_background (double minim, double maxim)
Sets voxels in image data exceeding a given minimum and maximum to the image background.
int limit_levels (int nlevels)
Converts a full gray scale image to a limited level image.
int normalize (long imgnum, double average, double stdev, int norm_type, long bins)
Normalizes a sub-image to a desired average and standard deviation.
int normalize (double average, double stdev, int norm_type)
Normalizes a set of images to a desired average and standard deviation.
int normalize_local (long kernel_size)
Normalizes by subtracting local average and dividing by local standard deviation.
int normalize_local (Vector3< long > kernel)
Normalizes by subtracting local average and dividing by local standard deviation.
void square ()
Calculates the square of an image.
void square_root ()
Calculates the square root of an image.
void logarithm ()
Calculates the logarithm of the image data.
int gradient_correction ()
Calculates and corrects for a linear gradient across an image.
int quadric_correct (vector< double > param)
Corrects for a quadric surface.
vector< double > quadric_fit ()
Fits the whole image to a quadric surface.
int calculate_background (long nn, int flag)
Calculates the background for one sub-image.
int calculate_background (int flag=0)
Calculates the background for each sub-image.
int calculate_background (Bimage *pmask, long nn, int flag=0)
Calculates the background for one sub-image.
int calculate_background (Bimage *pmask, int flag=0)
Calculates the background for each sub-image.
int correct_background (long nn, int flag)
Corrects the background for one sub-image.
int correct_background (int flag=0)
Corrects the background for each sub-image.
int correct_background (Bimage *pmask, int flag=0)
Corrects the background for each sub-image.
int subtract_background ()
Subtracts the background for each sub-image.
int shift_background (double bkg)
Sets the background for each sub-image to a given value.
long * histogram (long bins, double &scale, double &offset)
Calculates the histogram of an image.
Bplot * histogram (long bins)
Calculates the histogram of an image.
Bplot * histogram_counts (int flags=0)
Finds the peaks in a quantized image from the histogram.
Bplot * percentiles ()
Calculates the percentiles from the histogram of an image.
int histogram_thresholds (double &tmin, double &tmax)
Calculates minimum and maximum thresholds for truncation.
double otsu_threshold (long bins)
Calculates the threshold on a histogram according to Otsu.
vector< double > histogram_gauss_fit (long bins, long ngauss=1)
Fits a gaussian function to a histogram of an image.
Bplot * histogram_gauss_plot (long bins, long ngauss=1)
Fits a gaussian function to a histogram of an image.
Bplot * histogram_poisson_fit (long bins, int flag=0)
Fits a poisson function to a histogram of an image.
int resize (Vector3< long > nusize, Vector3< long > translate, int fill_type=0, double fill=0)
Resizes without interpolation or rescaling.
Bimage * resize_copy (Vector3< long > nusize, Vector3< long > translate, int fill_type=0, double fill=0)
Resizes without interpolation or rescaling.
int resize_wrap (Vector3< long > nusize, Vector3< long > translate)
Resizes without interpolation or rescaling.
Bimage * resize_wrap_copy (Vector3< long > nusize, Vector3< long > translate)
Resizes with wrapping without interpolation or rescaling.
int pad (long sz, int fill_type=0, double fill=0)
Pads an image to a new size with a given fill value.
int pad (Vector3< long > sz, int fill_type=0, double fill=0)
Pads an image to a new size with a given fill value.
Bimage * pad_copy (long sz, int fill_type=0, double fill=0)
Pads an image to a new size with a given fill value.
Bimage * pad_copy (Vector3< long > sz, int fill_type=0, double fill=0)
Pads an image to a new size with a given fill value.
int shrink_wrap (Vector3< long > nusize, Vector3< long > translate)
Shrinks an image to a new size with wrapping of the excluded edges.
int enlarge (Vector3< long > scale)
Enlarges an image by an inetger scale.
Bimage * montage (int first, int cols, int rows, int skip=0, int flipy=0)
Rearranges an image into a montage of 2D slices for display.
int shape (int type, Vector3< long > rect, Vector3< double > start, double width, int fill_type=0, double fill=0)
Creates a shape in an image and fills it with a constant value.
int shape (long nn, int type, Vector3< long > rect, Vector3< double > start, double width, int fill_type=0, double fill=0)
Creates a shape in an image and fills it with a constant value.
Bimage * edge_mask (int type, Vector3< long > rect, Vector3< double > start, double width)
Creates a mask with the edge approaching zero.
int edge (int type, Vector3< long > rect, Vector3< double > start, double width, int fill_type=0, double fill=0)
Smooths the image edge with a soft rectangular function.
int edge (long nn, int type, Vector3< long > rect, Vector3< double > start, double width, int fill_type=0, double fill=0)
Smooths the image edge with a soft rectangular function.
int hanning_taper (double fill=0)
Apply Hanning taper window to the image.
int sphere (Vector3< double > center, double radius, double width=0, int fill_type=0, double fill=0)
Fills a sphere within an image with a uniform value.
int cylinder (Vector3< double > center, double radius, double height, double width, int fill_type=0, double fill=0)
Fills a cylinder within an image with a uniform value.
int gaussian_sphere (long nn, Vector3< double > center, double sigma, double amp)
Fills a gaussian sphere within an image with a uniform value.
int shell (Vector3< double > center, double minrad, double maxrad, double width, int fill_type=0, double fill=0)
Fills a shell within an image with a uniform value.
int shell (long nn, Vector3< double > center, double minrad, double maxrad, double width, int fill_type=0, double fill=0)
Fills a shell within an image with a uniform value.
int shell_wrap (long nn, Vector3< double > center, double minrad, double maxrad, double width, int fill_type=0, double fill=0)
Fills a shell within an image with a uniform value with wrapping.
int bar (Vector3< double > start, Vector3< double > end, double width, double edge_width, int fill_type=0, double fill=0)
Generates a bar between start and end points.
int bar (long nn, Vector3< double > start, Vector3< double > end, double width, double edge_width, int fill_type=0, double fill=0)
Generates a bar between start and end points.
int quadric (double *param)
Generates a quadric surface over the whole image.
int fill_gaps (long step)
Fill the voxels that are not calculated.
int interpolate_gaps (long step)
Interpolate the voxels that are not calculated.
int transform (Vector3< double > scale, Vector3< double > origin, Vector3< double > translate, Matrix3 mat, int fill_type=0, double fill=0)
Transforms an image by translation, rotation, scaling and skewing, in place.
Bimage * transform (Vector3< long > nusize, Vector3< double > scale, Vector3< double > origin, Vector3< double > translate, Matrix3 mat, int fill_type=0, double fill=0)
Transforms an image by translation, rotation, scaling and skewing, returning a new image.
void transform_voxel (long i, Bimage *pt, long nn, Vector3< double > oldorigin, Vector3< double > nuorigin, Matrix3 affmat, double fill)
Bimage * transform (long nn, Vector3< long > nusize, Vector3< double > scale, Vector3< double > origin, Vector3< double > translate, Matrix3 mat, int fill_type=0, double fill=0)
Transforms a sub-image by translation, rotation, scaling and skewing, returning a single new image.
int rotate ()
Rotates an image using parameters defined in the image in place.
int rotate (double angle)
Rotates an image around the z-axis by the given angle in place.
int rotate (Vector3< double > axis, double angle)
Rotates an image using an axis and angle in place.
int rotate (View view)
Rotates an image to a specified view in place.
int rotate (Vector3< double > translate, View view)
Rotates an image to a specified view in place.
int rotate (Matrix3 mat)
Rotates an image using the specified matrix.
int rotate (Vector3< double > translate, Matrix3 mat)
Rotates an image using the specified shift and matrix.
Bimage * rotate (Vector3< long > nusize)
Rotates an image using parameters defined in the image.
Bimage * rotate (Vector3< long > nusize, double angle)
Rotates an image around the z-axis by the given angle.
Bimage * rotate (Vector3< long > nusize, Vector3< double > axis, double angle)
Rotates an image using an axis and angle.
Bimage * rotate (Vector3< long > nusize, View view)
Rotates an image to a specified view.
Bimage * rotate (Vector3< long > nusize, Vector3< double > translate, View view)
Rotates an image to a specified view.
Bimage * rotate (Vector3< long > nusize, Matrix3 mat)
Rotates an image using the specified matrix.
int rotate_and_add (Bimage *p, Vector3< double > origin, View view)
Rotates an image to a specified view and adds it to another image.
Bimage * orient (View *views)
Calculates multiple copies oriented according to views.
int mirror ()
Inverts/mirrors each image through its origin.
int shift (Vector3< double > vec, int fill_type=0, double fill=0)
Shifts an image.
int shift (long nn, Vector3< double > vec, int fill_type=0, double fill=0)
Shifts one sub-image.
int shift_wrap (Vector3< double > vec)
Shifts an image.
int shift_wrap (long nn, Vector3< double > vec)
Shifts one sub-image with wrapping.
int center (int fill_type=0, double fill=0)
Centers an image.
int center_wrap ()
Centers an image with wrapping.
int zero_origin ()
Shifts the origins to zero with wrapping.
Bimage * scale_to_same_size (Bimage *pref)
Scales and image to the given reference.
Bimage * scale_to_reference (Bimage *pref, Bimage *pmask, double scalemin, double scalemax, double step)
Scales and image to the given reference, searching for the correct scale.
Bimage * scale_to_reference (Bimage *pref, Bimage *pmask=NULL)
Scales and image to the given reference, searching for the correct scale.
double symmetrize (Bstring &symmetry_string, int flag)
double symmetrize (Bsymmetry *sym, int flag)
double symmetrize (Bstring &symmetry_string, View ref_view, int flag)
double symmetrize (Bsymmetry *sym, View ref_view, int flag)
Applies point group symmetry to an image.
double check_point_group (Bstring &check_string)
Checks for the requested symmetries.
double find_cyclic_point_group (Bsymmetry *sym, int binfac, double hires, double lores)
Finds the orientation for an image with a cyclic point group symmetry.
double find_point_group (Bsymmetry *sym, double angle_step, int binfac, double hires, double lores, int flags)
Finds the orientation for an image with a specific point group symmetry.
long rotate_to_axis (Bsymmetry *sym, long axis, long axis_flag)
Rotates to a symmetry axis.
int change_symmetry (Bsymmetry *symold, Bsymmetry *symnu, double radius, double z_slope)
Changes the symmetry order for cyclic and dihedral maps.
Matrix3 symmetry_equivalent (Bimage *ptemp, Bimage *pmask, Bsymmetry *sym)
Finds the symmetry equivalent orientation of a particle with respect to a template.
Matrix3 symmetry_equivalent_cyclic (Bimage *pref, Bimage *pmask, Bsymmetry *sym)
Finds the cyclic symmetry equivalent orientation of a particle with respect to a template.
Bimage * levelmask_asymmetric_units (Bsymmetry *sym, int index)
Calculates a multi-level mask to indicate asymmetric units.
int replicate_asymmetric_unit (Bsymmetry *sym)
Calculates a full map from one asymmetric unit.
Bimage * find_symmetric_view (Bimage *ptemp, Bsymmetry *sym, double phi_step, double theta_step, double alpha_step, Vector3< double > shift)
Finds the view that on symmetrizing fits best to a symmetric template.
double helix_interpolate (long i, double helix_rise, double helix_angle, int zmin, int zmax, double radius, int norm_flag=1)
double dyad_interpolate (long i, int norm_flag=1)
double tube_interpolate (long i, int h, int k, double latconst, int zmin, int zmax, double radius, int norm_flag=1)
double helix_symmetrize (double helix_rise, double helix_angle, int dyad_axis, int zmin, int zmax, double radius, int norm_flag=1)
Symmetrizes an image given helical symmetry parameters.
Bplot * seamed_helix_symmetrize (double helix_rise, double helix_angle, double seam_shift, int dyad_axis, int zmin, int zmax, double radius, int norm_flag)
Symmetrizes an image given helical symmetry parameters and seam shift parameter.
Bimage * symmetrize_cylinder (int flag)
Calculates a cylindrically symmetrized map.
int symmetrize_cylinder ()
Calculates a cylindrically symmetrized map.
double tube_symmetrize (int h, int k, double latconst, int zmin, int zmax, double radius, int norm_flag=1)
Symmetrizes an image given tubular lattice parameters.
double convert_to_helix (double helix_rise, double helix_angle, Vector3< double > offset)
Converts a map to a helix.
int distort_elliptically (double angle, double shift)
Transforms a tubular cylinder to an elliptical profile.
Bplot * find_helix_parameters (double angle_start, double angle_end, double angle_step, int bin, double hires, double lores, double radius)
Finds the best helix parameters for helical map.
Bplot * find_helix_parameters (double rise_start, double rise_end, double rise_step, double angle_start, double angle_end, double angle_step, int bin, double radius)
Finds the best helix parameters for helical map.
int helix_segment_correlation_one (long i, double angle_start, double angle_end, double angle_step, int bin, double hires, double lores, double radius, fft_plan planf, fft_plan planb, double *cc)
Bplot * helix_segment_correlation (int thickness, double angle_start, double angle_end, double angle_step, int bin, double hires, double lores, double radius)
Calculates the correlation over rotation angles between helical segments.
int transform_lines ()
Bimage * helical_cross_section (double helix_rise, double helix_angle, double scale, double hires)
Calculates a helical cross section from line transforms of a filament.
double snvariance (double snradius)
Calculates the ratio of variance inside and outside a given radius.
int extrude_cross_section (long length, double helix_rise, double helix_angle, int fill_type, double fill)
Extrudes a 2D cross section into a 3D continuous helix.
Bplot * filament_width (long width, long lim_lo, long lim_hi)
Estimates the width of a filament.
Bimage * filament_density (double width)
Estimates the density per pixel length of a filament.
Bimage * radial (long minrad, long maxrad, double rad_step=1, int wrap=0)
Calculates the radial average of an image.
Bimage * radial (long minrad, long maxrad, double rad_step, Bimage *pmask, int wrap=0)
Calculates the radial average of an image.
Bimage * radial (long minrad, long maxrad, double rad_step, double ellipticity, double angle, Bimage *pmask, int wrap=0)
Calculates the radial average of an image.
double * radial_fit (Bimage *pref)
Fits a radial profile to a reference radial profile.
Bimage * radial_to_full (Vector3< long > nusize, Vector3< double > origin)
Generates a full 2D or 3D image from a radial profile in a 1D image.
Bimage * cartesian_to_spherical (long nannuli, long nphi, long ntheta)
Calculates an image with spherical coordinates.
Bimage * cartesian_to_cylindrical (long nannuli, long nphi, int flag=0)
Calculates an image with cylindrical coordinates.
Bimage * polar_transform (long nangles, long ann_min, long ann_max, long dann, long zmin, long zmax, long zinc)
Calculates an image with cylindrical coordinates by integration.
Bimage * polar_power_spectrum (double resolution, long num_angle)
Calculates the polar power spectrum of a 2D transform amplitude or intensity image.
int line_powerspectra (fft_plan plan)
Calculates the 1D power spectrum of each line in an image.
int radial_shells ()
Calculates an image with slices representing radial shell projections.
int cylindrical_shells ()
Calculates an image with slices representing cylindrical shell projections.
Bimage * radial_sections (double rad_start, double rad_end, double rad_step, double spherical_fraction, Bsymmetry *sym)
Calculates an image with slices giving the radial section projections.
Bimage * radial_coverage (double threshold, double rad_step=1)
Calculates the coverage in each radial shell.
Bimage * topograph_to_surface (Bimage *psd, long nz, double density, double resolution)
Converts a 2D AFM image to a 3D density map.
Bimage * surface_to_topograph (double threshold, int dir=0)
Converts a 3D image to a 2D height image.
Bimage * rotate_height (Matrix3 mat, Vector3< double > translate, double threshold=0)
Rotates a 3D map and calculates the height along the z-axis.
Bimage * height (View *views, double threshold=0)
Calculates a set of height images from a 3D density map.
int integer_interpolation (int integer_factor)
int integer_interpolation (int integer_factor, int odd)
Interpolates by an integer scale with a density-preserving overlapping kernel.
int bin (long b)
int bin (Vector3< long > bk)
Bins by an integer size in place.
Bimage * bin_copy (long b)
Bimage * bin_copy (Vector3< long > bk)
Bins by an integer size and returns a new image.
Bimage * bin_around_origin (int bin)
Bins by an integer size making sure the origin falls on a binned voxel, and returns a new image.
int median_bin (int binning)
Bins by an integer size, selecting the kernel median.
int noise_uniform (double rmin, double rmax)
Generates an image with a uniform random distribution of densities.
int noise_gaussian (double ravg=0, double rstd=1)
Generates an image with a gaussian random distribution of densities.
int noise_poisson (double ravg)
Generates an image with a poisson random distribution of densities.
int noise_logistical (double ravg, double rstd)
Generates an image with a gaussian random distribution of densities.
int noise_spectral (double alpha)
Generates a noise map with a defined spectral decay.
long mask (Bimage *pmask, double fill)
Masks an image.
long to_mask ()
long to_mask (double threshold)
Change the image to a mask.
Bimage * mask_by_threshold (double threshold)
Generates a mask based on an image at a given threshold.
Bimage * mask_by_thresholds (vector< double > threshold)
Generates a mask based on an image at a given threshold.
long mask_stats ()
Calculates statistics for a mask.
long mask_invert ()
Inverts a mask.
long mask_combine (Bimage *p, int operation)
Combines two masks with different operations.
Bimage * mask_extract (Bimage *pmask)
Zeroes everything outside the mask and return the excised feature.
int max_in_kernel (long ksize)
long mask_dilate_erode (unsigned char dir)
Dilates or erodes a binary mask.
long mask_dilate (long times=1)
Dilates a binary mask.
long mask_erode (long times=1)
Erodes a binary mask.
long mask_open (int times=1)
Opens a binary mask.
long mask_close (int times=1)
Closes a binary mask.
long mask_fill (Vector3< long > voxel)
Fills an empty part of a mask indicated by the given voxel.
long mask_shell (Vector3< double > origin, double rad_min, double rad_max)
long mask_plane (Vector3< double > origin, Vector3< double > normal)
Generates a mask on one side of a plane.
long mask_rectangle (double length, double width, double rect_angle, int wrap)
Generates a mask along an axis within a 2D image.
long mask_symmetrize (Bsymmetry *sym)
Symetrizes a mask.
Vector3< double > mask_fspace_resize (Vector3< long > nusize)
Resizes a reciprocal space mask.
vector< double > fspace_default_bands (double res_lo, double res_hi)
Sets up default frequency space bands to generate a mask.
int mask_fspace_banded (vector< double > &band)
Generate reciprocal space mask based on a specification of bands.
long mask_missing_wedge (Vector3< double > origin, double tilt_axis, double tilt_neg, double tilt_pos, double resolution)
Generates a mask with a missing wedge.
long mask_missing_pyramid (Vector3< double > origin, double tilt_axis1, double tilt_axis2, double tilt_neg1, double tilt_pos1, double tilt_neg2, double tilt_pos2, double resolution)
Generates a mask with a missing pyramid.
long mask_missing_cone (Vector3< double > origin, double mis_ang, double resolution)
Generates a mask with a missing cone.
long mask_missing_find (Vector3< double > ori, double resolution, Bstring &mis_type)
Generates a missing mask from an example image.
long mask_pack_plane (Matrix3 mat, double hi_res, double scale)
Packs a 2D mask into a 3D reciprocal space volume.
double variance_threshold (double lowvar)
Calculates a threshold for a local variance image.
Bimage * variance_mask (long kernel_size, double lowvar=1e-6, int bkg_flag=0)
Calculates a mask based on local variance.
Bimage * tile_mask (long step)
Converts a mask to a tiled multilevel mask.
long mask_split (long voxels_per_level)
Converts a mask to a multilevel mask with a given number of voxels per level.
long levelmask_collapse ()
Collapse a multi-level mask to a binary mask.
long levelmask_add (Bimage *pmask, int add_level=1)
Adds a bilevel mask to a level mask.
long levelmask_dilate (int times)
Dilates a level mask.
long levelmask_dilate ()
Dilates a level mask.
long levelmask_select (Bstring &select_list)
Retains the selected levels in a multi-level mask.
long levelmask_select (long nn, Vector3< long > voxel)
Retains the selected levels in a multi-level mask.
long levelmask_select (Bimage *pmask)
Selects regions overlapping a mask.
Bimage * level_mask_extract (Bimage *pmask)
Extracts all the regions associated with a multi-level mask.
double levelmask_average_region_size ()
Calculates the average size of regions in a level mask.
long levelmask_clean ()
Removes empty levels from a multi-level mask.
long levelmask_colorize ()
Colorizes a multi-level mask with random color assignments.
Bimage * levelmask_color_by_size ()
Color a multi-level mask based on the volumes of regions.
int levelmask_region_size ()
Convert a mask to reflect region sizes.
Bplot * levelmask_size_histogram ()
Color a multi-level mask based on the volumes of regions.
Matrix mask_interface_matrix (int img_num)
Calculates the interfaces between regions.
long mask_region_interfaces (int reg_num)
Reports the whole interface matrix or interfaces for one region only.
long mask_merge_delete (long min_size, long min_if)
Calculates the interfaces between regions and deletes/merges small ones.
long apply_soft_mask (long nn, Bimage *pmask, int fill_type, double fill)
Applies a soft mask to a sub-image.
Bimage * regions (double threshold, int sign)
Segments an image into contiguous regions.
long region_assign (Bimage *pmask, long idx, long region_number, double threshold, int sign)
Finds all the pixels that are part of the same region.
int region_threshold_series (double threshold_first, double threshold_last, double threshold_step)
Segments a map through a series of thresholds and reports results.
long region_flood (Bimage *pmask, double threshold_hi, double threshold_lo, double threshold_step, int fill_borders)
Creates and expands a region map from a starting to ending threshold value.
long check_neighbors (long idx)
Check neighbors in region map and assign a value if a neighbor is assigned.
Bimage * region_peaks (long kernel_size, double threshold, int flood=0, int wrap=0)
Generates a segmented image from peaks above a threshold value.
long blobs (double threshold, double min_size, double max_size, double setvalue, int sign)
Identifies contiguous regions above a given threshold (blobs) and eliminate those less than a minimum size.
int filter_extremes ()
Filters the extremes out of a micrograph image.
int filter_extremes (int mod_flag)
Filters the extremes out of an image.
long replace_maxima (double threshold)
Replaces maxima above a threshold using local averages.
double mass_threshold (long img_num, double mol_weight, double rho)
Finds the density threshold associated with a particular molecular weight.
double mass_at_threshold (long img_num, double threshold, double rho)
Calculates the mass from the density threshold.
double internal_volume (double threshold, int mask_out_freq)
Calculates the internal volume of a shell.
Bimage * kmeans_segment (long nregion=2, double ratio=1)
Segments an image based on K-means.
Bimage * graph_segment (int type=1, Bimage *pmask=NULL, int connect_type=0, double complexity=0, long min_size=0, int return_type=0)
Graph-based segmentation of an image.
int superpixels_update (Bimage *pmask, vector< long > vstep, double colorweight, vector< Bsuperpixel > &seg)
vector< Bsuperpixel > superpixels_from_mask (long cc, long step)
Create superpixels from a multilevel mask.
vector< Bsuperpixel > superpixels (long step, double colorweight=0.2, long iterations=10, double stop=1)
Segment the image into superpixels.
int impose_superpixels (Bimage *pmask, vector< Bsuperpixel > &seg, int impose)
Impose superpixel features onto an image.

  Public Attributes
Bimage * next
Bsub_image * image

Detailed Description

General image parameter class.

All floating point coordinates are in angstroms and converted
using the voxel units parameters.

Definition at line 163 of file Bimage.h.

Constructor & Destructor Documentation

  Bimage::Bimage ()

Initializes an image.

The internal initialization function is called.

Definition at line 44 of file Bimage.cpp.

  Bimage::Bimage (const Bimage & p)

The copy constructor.

The internal copy function is called.

Definition at line 58 of file Bimage.cpp.

  Bimage::Bimage (Bstring & fn, int readdata, int img_select)

Reads an image from a file.

The internal initialization function is called.

Definition at line 70 of file Bimage.cpp.

  Bimage::Bimage (DataType type, CompoundType ctype, long nx, long ny, long nz, long nn)

Initializes an image.

Parameters:
    type data type.
    ctype compound type.
    nx x dimension.
    ny y dimension.
    nz z dimension.
    nn number of sub-images.

    The internal initialization function is called.
    The basic properties and size is set up and the data allocated.

Definition at line 92 of file Bimage.cpp.

  Bimage::Bimage (DataType type, CompoundType ctype, Vector3< long > size, long nn)

Initializes an image.

Parameters:
    type data type.
    ctype compound type.
    size image size.
    nn number of sub-images.

    The internal initialization function is called.
    The basic properties and size is set up and the data allocated.

Definition at line 113 of file Bimage.cpp.

  Bimage::Bimage (DataType type, CompoundType ctype, vector< long > size, long nn)

Initializes an image.

Parameters:
    type data type.
    ctype compound type.
    size image size.
    nn number of sub-images.

The internal initialization function is called. The basic properties and size is set up and the data allocated.

Definition at line 133 of file Bimage.cpp.

  Bimage::Bimage (DataType type, long nc, long nx, long ny, long nz, long nn)

Initializes a generic multi-channel image.

Parameters:
    type data type.
    nc number of channels.
    nx x dimension.
    ny y dimension.
    nz z dimension.
    nn number of sub-images.

    The internal initialization function is called.
    The basic properties and size is set up and the data allocated.

Definition at line 155 of file Bimage.cpp.

  Bimage::Bimage (DataType type, long nc, Vector3< long > size, long nn)

Initializes a generic multi-channel image.

Parameters:
    type data type.
    nc number of channels.
    size image size.
    nn number of sub-images.

    The internal initialization function is called.
    The basic properties and size is set up and the data allocated.

Definition at line 176 of file Bimage.cpp.

  Bimage::~Bimage ()

Image destructor.

All properties and associated data are deallocated.

Definition at line 191 of file Bimage.cpp.

Member Function Documentation

  void Bimage::add (long j, double v) [inline]

Definition at line 308 of file Bimage.h.

  void Bimage::add (long j, Complex< double > cv) [inline]

Definition at line 309 of file Bimage.h.

  void Bimage::add (double xx, double yy, double zz, long nn, double v)

Adds a value at a given location to neigboring data elements.

Parameters:
    xx x location.
    yy y location.
    zz z location.
    nn image number (4 th dimension).
    v value to add.

    Inverse of trilinear interpolation.

Definition at line 1244 of file Bimage.cpp.

  void Bimage::add (double v)

Adds a constant value to an image.

Parameters:
    v constant to be added.

Definition at line 3234 of file Bimage.cpp.

  void Bimage::add (Bimage * p)

Adds another image to an image.

Parameters:
    *p image to be added.

    Requirement: The images must have the same size.

Definition at line 3378 of file Bimage.cpp.

  void Bimage::add (long nn, Bimage * p)

Adds another image to a sub-image.

Parameters:
    nn sub-image.
    *p image to be added.

    Requirement: The images must have the same size.
    If the FOM block is defined, it is used to accumulate a sum of:
        the FOM block of the added image if it exists,
        or otherwise the square of the data added.

Definition at line 3431 of file Bimage.cpp.

  void Bimage::add (Bimage * p, double scale, double shift)

Adds another image to an image.

Parameters:
    *p image to be added.
    scale density scale to other image
    shift density shift to other image.

    Requirement: The images must have the same size.

Definition at line 3453 of file Bimage.cpp.

  void Bimage::add (long nn, Bimage * p, double scale, double shift)

Adds another image to an image.

Parameters:
    nn sub-image.
    *p image to be added.
    scale density scale to other image
    shift density shift to other image.

    Requirement: The images must have the same size.

Definition at line 3480 of file Bimage.cpp.

  JSvalue Bimage::align (long ref_num, Bimage * pmask, double hi_res, double lo_res, double shift_limit, double edge_width, double gauss_width, Vector3< long > bin)

Aligns and sums a set of sub-images, first progressively and then iteratively.

Parameters:
    ref_num reference sub-image.
    *pmask cross-correlation mask.
    hi_res high resolution limit.
    lo_res low resolution limit.
    shift_limit limit on extent of search for shift.
    edge_width width of smoothing edge.
    gauss_width decay coefficient for smoothing edge.
    bin 3-value vector indicating binning level.

Returns:
    double average shift.

    The images are first aligned using a progressive algorith starting with
    the indicated reference image.
    The images are then aligned iteratively using the average image to
    improve the average.

Definition at line 203 of file Bimage_align.cpp.

  double Bimage::align2D (Bimage * pref, double res_polar, int ann_min, int ann_max, Bimage * prs_mask, double shift_limit, double angle_limit, fft_plan planf_1D, fft_plan planb_1D, fft_plan planf_2D, fft_plan planb_2D)

Finds the best in-plane alignment for two 2D images using polar power spectra.

Parameters:
    *pref reference 2D image.
    res_polar polar resolution limit.
    ann_min minimum annulus (>=0).
    ann_max maximum annulus (< image radius).
    *prs_mask dual mask.
    shift_limit maximum shift from nominal origin of box.
    angle_limit maximum rotation from original in-plane rotation angle.
    planf_1D FFT forward plan for polar images.
    planb_1D FFT backward plan for polar images.
    planf_2D FFT forward plan for 2D images.
    planb_2D FFT backward plan for 2D images.

Returns:
    double correlation coefficient.

    Both the image and reference is converted to polar images using the
    current origins. The annuli of the polar images are cross-correlated
    to find the rotation angle. The reference is rotated and cross-correlated
    with the image to determine a new origin for the image. This is iterated
    untill the rotation angle and origin of the image does not change any more,
    or a maximum number of iterations.
    The cross-correlation is done with the provided mask..
    The correlation coefficient return is the cross-correlation peak.
    The input images must be equal-sized square 2D images.

Definition at line 886 of file Bimage_align.cpp.

  int Bimage::align2D (Bimage * pref, int ann_min, int ann_max, double res_lo, double res_hi, double shift_limit, double angle_limit)

Finds the best in-plane alignment for two 2D images using polar power spectra.

Parameters:
    *pref reference 2D image.
    ann_min minimum annulus (>=0).
    ann_max maximum annulus (< image radius).
    res_lo low resolution limit (angstrom).
    res_hi high resolution limit (angstrom).
    shift_limit maximum shift from nominal origin of box.
    angle_limit maximum rotation from original in-plane rotation angle.

Returns:
    double correlation coefficient.

    This is a simplified interface to the other function Bimage::align2D.
    All the fourier transform and rotation functions are handled internally.

Definition at line 973 of file Bimage_align.cpp.

  double Bimage::align2D_pps (Bimage * pref, double res_hi, double res_lo, double shift_limit, double angle_limit, fft_plan planf, fft_plan planb)

Finds the best in-plane alignment for two 2D images using polar power spectra.

Parameters:
    *pref reference 2D image.
    res_hi high resolution limit.
    res_lo low resolution limit.
    shift_limit maximum shift from nominal origin of box.
    angle_limit maximum rotation from original in-plane rotation angle.
    planf FFT forward plan.
    planb FFT backward plan.

Returns:
    double correlation coefficient.

    The rotation angle is found by cross-correlating the annuli
    of the polar transforms of the power spectra of the image and the
    reference image. If the full asu flag is not set, the annular cross-correlation
    is done both forwards and backwards to detect mirror images, with the sign
    of the angle indicating which direction is best (>0 => forwards, <0 => backwards).
    The resolution limit specified in the image is used to low-pass filter
    the cross-correlation. The shift is then determined by cross-correlation
    after rotating the reference image, as well as its 180° rotation to deal with
    that ambiguity in the power spectrum.
    The correlation coefficient return is the cross-correlation peak.
    The input images must be equal-sized square 2D images.
    The origin and rotation angle is returned in the image structure.

Definition at line 796 of file Bimage_align.cpp.

  JSvalue Bimage::align_fast (long ref_num, Bimage * pmask, double hi_res, double lo_res, double shift_limit, double edge_width, double gauss_width)

Aligns and sums a set of sub-images, first progressively and then iteratively.

Parameters:
    ref_num reference sub-image.
    *pmask cross-correlation mask.
    hi_res high resolution limit.
    lo_res low resolution limit.
    shift_limit limit on extent of search for shift.
    edge_width width of smoothing edge.
    gauss_width decay coefficient for smoothing edge.

Returns:
    double average shift.

    The images are first aligned using a progressive algorith starting with
    the indicated reference image.
    The images are then aligned iteratively using the average image to
    improve the average.

Definition at line 361 of file Bimage_align.cpp.

  Bimage * Bimage::align_progressive (long nref, Bimage * pmask, double hi_res, double lo_res, double shift_limit, fft_plan planf, fft_plan planb)

Aligns and sums a set of sub-images using a progressive algorithm.

Parameters:
    nref reference sub-image.
    *pmask cross-correlation mask.
    hi_res high resolution limit.
    lo_res low resolution limit.
    shift_limit limit on extent of search for shift.
    planf plan for forward Fourier transform.
    planb plan for backward Fourier transform.

Returns:
    Bimage* summed reference image.

    The images are aligned against the reference images with progressive
    addition to reference to decrease noise.

Definition at line 29 of file Bimage_align.cpp.

  Bimage * Bimage::align_progressive_fast (long nref, double shift_limit)

Aligns and sums a set of sub-images using a progressive algorithm.

Parameters:
    nref reference sub-image.
    shift_limit limit on extent of search for shift.

Returns:
    Bimage* summed reference image.

    The images are aligned against the reference images with progressive
    addition to reference to decrease noise.

Definition at line 138 of file Bimage_align.cpp.

  long Bimage::alloc_size () const [inline]

Definition at line 252 of file Bimage.h.

  long Bimage::apply_soft_mask (long nn, Bimage * pmask, int fill_type, double fill)

Applies a soft mask to a sub-image.

Parameters:
    nn sub-image.
    pmask soft mask: [0,1].
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill value of edge voxels.

Returns:
    int 0.

    The image is multiplied with the mask, filling in the remainder
    with the fill value.
    Requirement: The mask must range from 0 to 1.

Definition at line 2330 of file Bimage_mask.cpp.

  int Bimage::assemble_tiles (Bimage * pt, int flag = 0)

Assembles overlapping tiles into this image.

Parameters:
    *pt multi-image containing tiles.
    flag flag to set overlap handling.

Returns:
    int 0.

    The origin in each tile specifies the starting location.
    Where tiles overlap, the integration is determined by the flag:
    0 = simple addition with averaging afterwards.
    1 = a gradual transition from one tile to the other.
    2 = place just the central part of each tile.
    The original data in the image is overwritten.

Definition at line 432 of file Bimage_combine.cpp.

  int Bimage::auto_correlate (double hires, double lores)

Calculates an autocorrelation map by Fast Fourier transformation.

Parameters:
    hires high resolution limit.
    lores low resolution limit.

Returns:
    int 0.

    FFTW library (www.fftw.org).
    A multi-image 1D, 2D and 3D data set is transformed forward, the
    transform multiplied by its complex conjugate, followed by backward
    transformation and rescaling by 1/(N*N). Data beyond the resolution
    set in the image structure are zeroed. 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).
    The resultant image is Float.

Definition at line 265 of file Bimage_correlate.cpp.

  double Bimage::average (long cc, double xf, double yf, double zf, long nn, double iscale)

Averages in 3D when scaling is less than 1.

Parameters:
    cc channel.
    xf x location.
    yf y location.
    zf z location.
    nn image number.
    iscale inverse scale.

Returns:
    double average.

    All neighboring voxels in x, y and z are averaged and result returned.

Definition at line 1349 of file Bimage.cpp.

  double Bimage::average () [inline]

Definition at line 536 of file Bimage.h.

  void Bimage::average (double d) [inline]

Definition at line 540 of file Bimage.h.

  double Bimage::average2D (long cc, double xf, double yf, double zf, long nn, double iscale)

Averages in the xy plane when scaling is less than 1.

Parameters:
    cc channel.
    xf x location.
    yf y location.
    zf z location.
    nn image number.
    iscale inverse scale.

Returns:
    double average.

    All neighboring voxels in x and y are averaged and result returned.

Definition at line 1312 of file Bimage.cpp.

  void Bimage::average_images () [inline]

Definition at line 716 of file Bimage.h.

  Bimage * Bimage::average_images (bool sd)

Averages all sub-images and optionally calculates standard deviation image.

Parameters:
    sd flag to calculate linked standard deviation image.

Returns:
    Bimage* average image.

Definition at line 3333 of file Bimage.cpp.

  double Bimage::average_phase_difference (Bimage * p, double res_hi, double res_lo, int weighting = 1)

Calculates the average of the absolute phase difference between two images within given resolution shells.

Parameters:
    *p real space reference image.
    res_hi upper resolution limit.
    res_lo lower resolution limit.
    weighting weighting type: 0, none; 1, p1-amp; 2, p2-amp; 3, both amps

Returns:
    double average of the cosine of the phase difference.

    Both images are Fourier transformed and the absolute phase
    difference calculated and averaged.

Definition at line 1891 of file Bimage_fspace.cpp.

  int Bimage::back_project (Bimage * p, double resolution, double axis, fft_plan planf, fft_plan planb)

Definition at line 437 of file Bimage_project.cpp.

  double Bimage::background (long nn) [inline]

Definition at line 542 of file Bimage.h.

  void Bimage::background (long nn, double bkg) [inline]

Definition at line 545 of file Bimage.h.

  void Bimage::background (double bkg) [inline]

Definition at line 548 of file Bimage.h.

  int Bimage::bar (Vector3< double > start, Vector3< double > end, double width, double edge_width, int fill_type = 0, double fill = 0)

Generates a bar between start and end points.

Parameters:
    start start of bar.
    end end of bar.
    width width of bar.
    edge_width bar edge width.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill fill value.

Returns:
    int 0.

    A bar is generated with the given fill value from the start point
    to the end point and with a defined width and gaussian edge.

Definition at line 729 of file Bimage_edit.cpp.

  int Bimage::bar (long nn, Vector3< double > start, Vector3< double > end, double width, double edge_width, int fill_type = 0, double fill = 0)

Generates a bar between start and end points.

Parameters:
    nn sub-image.
    start start of bar.
    end end of bar.
    width width of bar.
    edge_width bar edge width.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill fill value.

Returns:
    int 0.

    A bar is generated with the given fill value from the start point
    to the end point and with a defined width and gaussian edge.

Definition at line 755 of file Bimage_edit.cpp.

  int Bimage::bin (long b) [inline]

Definition at line 1279 of file Bimage.h.

  int Bimage::bin (Vector3< long > bk)

Bins by an integer size in place.

Parameters:
    bk 3-value vector of integer bin factors.

Returns:
    int 0.

    An image is binned by an integer size.

Definition at line 231 of file Bimage_bin.cpp.

  Bimage * Bimage::bin_around_origin (int bin)

Bins by an integer size making sure the origin falls on a binned voxel, and returns a new image.

Parameters:
    bin integer bin factor.

Returns:
    Bimage* new image.

    An image is binned by an integer size, square in 2D and cubic in 3D.

Definition at line 327 of file Bimage_bin.cpp.

  Bimage* Bimage::bin_copy (long b) [inline]

Definition at line 1284 of file Bimage.h.

  Bimage * Bimage::bin_copy (Vector3< long > bk)

Bins by an integer size and returns a new image.

Parameters:
    bk 3-value vector of integer bin factors.

Returns:
    Bimage* new image.

    An image is binned by an integer size.

Definition at line 265 of file Bimage_bin.cpp.

  Bimage * Bimage::blend (Bimage * p, long number)

Blends the two images, creating a new set of sub-images.

Parameters:
    *p second image.
    number number of images in the series.

Returns:
    Bimage* new image structure, NULL if error.

    A number of images are created by blending the two input images in
    different ratios. The input images become the first and last sub-images of
    the new image structure, with the intermediate images changing over from
    the first to the last:
            new_data = (1-fraction)*data1 + fraction*data2
    where fraction = index/(number - 1)
    At least 3 new sub-images are packed into the new image.
    All of the header information in the first image is copied into the new image.
    Both images are converted to floating point.

Definition at line 108 of file Bimage_combine.cpp.

  long Bimage::blobs (double threshold, double min_size, double max_size, double setvalue, int sign)

Identifies contiguous regions above a given threshold (blobs) and eliminate those less than a minimum size.

Parameters:
    threshold threshold to define contiguous regions.
    min_size minimum number of voxels to keep a region.
    max_size maximum number of voxels to keep a region.
    setvalue value to assign to deleted regions (typically set to threshold).
    sign sign controlling direction of thresholding.

Returns:
    long number of voxels set to threshold.

    All contiguous regions in an image are indexed and their sizes
    calculated. Whether a region is contiguous is defined by a
    threshold. Regions smaller than a minimum number of voxels are
    set to the threshold value. The input image is modified and
    left as a floating point image.

Definition at line 551 of file Bimage_segment.cpp.

  int Bimage::calculate_background (long nn, int flag)

Calculates the background for one sub-image.

Parameters:
    nn sub-image.
    flag flag to specify where to calculate the background: [0,3]

Returns:
    int 0, <0 on error.

    The background is taken as the average of the values for:
    flag=0,1    outside the circle or sphere enclosed by the image
    flag=2      inside the circle or sphere enclosed by the image
    flag=3      inside the half-radius circle in the center of the image.

Definition at line 27 of file Bimage_background.cpp.

  int Bimage::calculate_background (int flag = 0)

Calculates the background for each sub-image.

Parameters:
    flag flag to specify where to calculate the background: [0,3]

Returns:
    int 0, <0 on error.

    The background is taken as the average of the values outside the
    circle or sphere enclosed by the image.

Definition at line 91 of file Bimage_background.cpp.

  int Bimage::calculate_background (Bimage * pmask, long nn, int flag = 0)

Calculates the background for one sub-image.

Parameters:
    *pmask foreground mask.
    nn sub-image.
    flag flag to specify where to calculate the background: [0,1]

Returns:
    int 0, <0 on error.

    If the mask is specified, it is used to define the part of the
    image to be used for background calculation (where the mask is zero).

Definition at line 124 of file Bimage_background.cpp.

  int Bimage::calculate_background (Bimage * pmask, int flag = 0)

Calculates the background for each sub-image.

Parameters:
    *pmask foreground mask.
    flag flag to specify where to calculate the background: [0,1]

Returns:
    int 0, <0 on error.

    If the mask is specified, it is used to define the part of the
    image to be used for background calculation (where the mask is zero).

Definition at line 168 of file Bimage_background.cpp.

  Bimage * Bimage::cartesian_to_cylindrical (long nannuli, long nphi, int flag = 0)

Calculates an image with cylindrical coordinates.

Parameters:
    nannuli number of annuli.
    nphi number of phi angles.
    flag switch: annulus-angle-z (0), angle-annulus-z (1), z-annulus-angle (2)

Returns:
    Bimage* cylindrical image.

    The image is converted to cylindrical form with a specified number of
    annuli and angles.
    A point vector p = {x,y,z} with respect to the image origin (typically
    the center of the image) is converted to cylindrical coordinates as follows:
        The distance from the z-origin gives the annulus:
            |p| = sqrt(x*x+y*y)
        Phi is the rotation angle around the z-axis, starting at the x-axis:
            phi = atan(y/x)
        The z-coordinate remains unchanged.
    The new dimensions are mapped as follows with their maximum ranges:
        |p|   ===> x_dimension (0 - max(x_size,y_size,z_size)
        phi   ===> y_dimension (0 - 2*PI)
        z     ===> z_dimension
    The sampling within these ranges are given by the calling function.
    The sampling must be isotropic.
    The origins within the sub-image structures are used.
    The interpolation routine actually calculates the old cartesian
    coordinates for each set of cylindrical coordinates.

Definition at line 519 of file Bimage_polar.cpp.

  Bimage * Bimage::cartesian_to_spherical (long nannuli, long nphi, long ntheta)

Calculates an image with spherical coordinates.

Parameters:
    nannuli number of annuli.
    nphi number of phi angles.
    ntheta number of theta angles.

Returns:
    Bimage* spherical image.

    The image is converted to polar form with a specified number of annuli
    and angles in one (a 2D image) or two (a 3D map) directions. The
    angular convention is consistent with the Euler angles used for 3D
    image processing.
    A point vector p = {x,y,z} with respect to the image origin (typically
    the center of the image) is converted to polar coordinates as follows:
        The size of the vector gives the annulus:
            |p| = sqrt(x*x+y*y+z*z)
        Phi is the rotation angle around the z-axis, starting at the x-axis:
            phi = atan(y/x)
        Theta is the angle between the positive z-axis and the point vector:
            theta = acos(z/|p|)
    The new dimensions are mapped as follows with their maximum ranges:
        |p|   ===> x_dimension (0 - max(x_size,y_size,z_size)
        phi   ===> y_dimension (0 - 2*PI)
        theta ===> z_dimension (0 - PI)
    The sampling within these ranges are given by the calling function.
    The sampling must be isotropic.
    The origins within the sub-image structures are used.
    The interpolation routine actually calculates the old cartesian
    coordinates for each set of spherical coordinates.

Definition at line 428 of file Bimage_polar.cpp.

  void Bimage::catenate (long m, Bimage ** p)

Catenates an array of images of the same size into a multi-image structure.

Parameters:
    m number of images in the array.
    **p array of images.

    The images must all have the same dimensions.

Definition at line 52 of file Bimage_combine.cpp.

  double Bimage::ccmap_confidence (long nn)

Calculates a confidence level to associate with a cross-correlation peak.

Author:
    Bernard Heymann and Xiange Zheng

Parameters:
    nn sub-image.

Returns:
    double P value.

    The highest two peak maxima are found and used to calculate a
    confidence level for the hypothesis that the second highest peak is
    different from the first. The two maxima are found by a kernel search
    which implicitly assumes that the values associated with a peak
    monotonically decays with distance from the peak.
    Fisher's z-transform is used to calculate the confidence level:
        P = erfc((zmax - zmax2)/(2*z_sigma))
    where
        zmax, zmax2: z-transforms of the highest two peaks.
        z_sigma: standard deviation of the z-transform of the cc map.
    The P value is returned

Definition at line 1812 of file Bimage_correlate.cpp.

  int Bimage::center (int fill_type = 0, double fill = 0)

Centers an image.

Parameters:
    fill_type fill type for filling empty regions.
    fill value to fill in empty regions.

Returns:
    int error code.

Definition at line 699 of file Bimage_transform.cpp.

  int Bimage::center_wrap ()

Centers an image with wrapping.

Returns:
    int error code.

Definition at line 713 of file Bimage_transform.cpp.

  Bimage * Bimage::central_section (Matrix3 mat, double resolution, FSI_Kernel * kernel)

Calculates a central section of a 3D fourier transform.

Parameters:
    mat 3x3 rotation or skewing matrix.
    resolution high resolution limit.
    *kernel frequency space interpolation kernel.

Returns:
    Bimage* new 2D central section.

    The orientation of the central section is defined by a rotation matrix
    and the interpolation is done with a reciprocal space kernel.
    The rotation origin is obtained from the map origin.

Definition at line 287 of file Bimage_project.cpp.

  int Bimage::change_symmetry (Bsymmetry * symold, Bsymmetry * symnu, double radius, double z_slope)

Changes the symmetry order for cyclic and dihedral maps.

Parameters:
    *symold original symmetry.
    *symnu new symmetry.
    radius radius in voxels of repeating units.
    z_slope slope along z to adjust radius.

Returns:
    int 0.

    If the radius is zero, the change in symmetry is done with proportional
    shifts that distorts the units in the map.
    If the radius is positive, it is used to determine the radial shift for
    each unit, giving much less distortion than the proportional shifts.
    Variation of the radius of the specimen along z can be handled with
    a non-zero z slope parameter.

Definition at line 583 of file Bimage_symmetry.cpp.

  Vector3< double > Bimage::change_transform_size (Vector3< long > nusize)

Resizes a 'standard' transform.

Parameters:
    nusize new image size.

Returns:
    Vector3<double> scale.

    A standard transform is resized by inserting or removing
    rows or columns in the middle of the data set.

Definition at line 239 of file Bimage_fft.cpp.

  void Bimage::change_type (char letter)

Get the data type indicated by a single letter code.

Parameters:
    letter letter indicating data type.

    This function is used in optional command-line arguments to indicate
    a new data type for an image.

Definition at line 1743 of file Bimage.cpp.

  void Bimage::change_type (char * string)

Get the data type from a string.

Parameters:
    *string string describing the data type.

Definition at line 1773 of file Bimage.cpp.

  void Bimage::change_type (DataType nutype)

Change the data to the new type.

Parameters:
    nutype new data type.

Definition at line 1808 of file Bimage.cpp.

  long Bimage::channels () [inline]

Definition at line 371 of file Bimage.h.

  void Bimage::channels (long cc) [inline]

Definition at line 372 of file Bimage.h.

  void Bimage::check ()

Checks an image for reasonable properties.

Definition at line 389 of file Bimage.cpp.

  bool Bimage::check_if_same_image_size (Bimage * p)

Check if two images are the same size.

Parameters:
    *p image to check.

Returns:
    bool 1 if yes, 0 if no.

    The function returns the answer and leaves the calling function to
    deal with the result.

Definition at line 562 of file Bimage.cpp.

  bool Bimage::check_if_same_size (Bimage * p)

Check if two images are the same size.

Parameters:
    *p image to check.

Returns:
    bool 1 if yes, 0 if no.

    The function returns the answer and leaves the calling function to
    deal with the result.

Definition at line 536 of file Bimage.cpp.

  long Bimage::check_neighbors (long idx)

Check neighbors in region map and assign a value if a neighbor is assigned.

Parameters:
    idx index in multi-image.

Returns:
    long new value assigned.

Definition at line 419 of file Bimage_segment.cpp.

  double Bimage::check_point_group (Bstring & check_string)

Checks for the requested symmetries.

Parameters:
    &check_string string with requested point groups.

Returns:
    double symmetry correlation coefficient.

    Requirement: The input map must be in standard orientation for the symmetry.
    For each different symmetry operation, the map is rotated and compared by
    real space correlation to the original.

Definition at line 112 of file Bimage_symmetry.cpp.

  void Bimage::check_resolution (double & resolution)

Checks that the resolution falls within reasonable limits.

Parameters:
    &resolution resolution (modified).

    The resolution is set to between half the real size and the Nyquist frequency.

Definition at line 605 of file Bimage.cpp.

  void Bimage::check_sampling ()

Checks that the sampling is properly specified.

If the sampling is zero or less it is set to 1.
If a dimension size is one, the sampling is set to 1.

Definition at line 586 of file Bimage.cpp.

  void Bimage::clear () [inline]

Definition at line 697 of file Bimage.h.

  CMYK< double > Bimage::cmyk (long j)

Returns a color value at the given index.

Parameters:
    j index.

Returns:
    CMYK<double> the color value.

    The index refers to compound values.

Definition at line 1061 of file Bimage.cpp.

  void Bimage::cmyk_to_rgb ()

Converts a CMYK color image to RGB.

Definition at line 206 of file Bimage_color.cpp.

  int Bimage::color_blue (double cmin, double cmax, int gray_extremes = 0)

Converts a gray-scale image to blue.

Parameters:
    cmin lower grayscale boundary.
    cmax upper grayscale boundary.
    gray_extremes keep the ranges beyond the minimum and maximum as gray.

Returns:
    int 0.

    A grayscale image is converted to blue between the given minimum and maximum.

Definition at line 325 of file Bimage_color.cpp.

  int Bimage::color_combine (Bimage * p)

Combines two colored images.

Parameters:
    *p second image.

Returns:
    int 0.

    Each pair of voxels is summed and the result truncated to 255.

Definition at line 370 of file Bimage_color.cpp.

  int Bimage::color_green (double cmin, double cmax, int gray_extremes = 0)

Converts a gray-scale image to green.

Parameters:
    cmin lower grayscale boundary.
    cmax upper grayscale boundary.
    gray_extremes keep the ranges beyond the minimum and maximum as gray.

Returns:
    int 0.

    A grayscale image is converted to green between the given minimum and maximum.

Definition at line 310 of file Bimage_color.cpp.

  int Bimage::color_red (double cmin, double cmax, int gray_extremes = 0)

Converts a gray-scale image to red.

Parameters:
    cmin lower grayscale boundary.
    cmax upper grayscale boundary.
    gray_extremes keep the ranges beyond the minimum and maximum as gray.

Returns:
    int 0.

    A grayscale image is converted to red between the given minimum and maximum.

Definition at line 295 of file Bimage_color.cpp.

  Bimage * Bimage::color_spectrum (double cmin, double cmax)

Colorizes an image to a spectrum.

Parameters:
    cmin lower grayscale boundary.
    cmax upper grayscale boundary.

Returns:
    Bimage* color scale image.

    A grayscale image is converted to RGB and colored from blue (low) to
    red (high). Only the values between the given minimum and maximum is used.

Definition at line 403 of file Bimage_color.cpp.

  void Bimage::color_to_simple ()

A color image is converted to a simple image.

The new value for each voxel is the average of the RGB color values.

Definition at line 94 of file Bimage_color.cpp.

  void Bimage::combine_channels (long nc)

The channels are composed from individual images.

Parameters:
    nc number of channels.

    The input image is replaced with a new image.

Definition at line 1965 of file Bimage.cpp.

  int Bimage::combined_complex_product ()

Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images.

Returns:
    int error code.

    Requirement: Fourier transform of two images packed into one complex
        data block with the function Bimage::pack_two_in_complex and then
        transformed with the function Bimage::fft.
    The Friedel relationships in transforms from real space images are
    exploited to transform two images simultaneously and then extract
    the individual transforms from the complex data set.
    This function extracts the individual transforms and calculates the
    complex conjugate product used in cross-correlation.
    The result is scaled by the total power of the two transforms, yielding
    the correlation coefficient when the product is backtransformed into
    the cross-correlation map.

Definition at line 813 of file Bimage_complex.cpp.

  int Bimage::combined_complex_product (Bimage * pmask)

Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images.

Parameters:
    *pmask binary mask (only 0 and 1), NULL if not desired.

Returns:
    int error code.

    Requirement: Fourier transform of two images packed into one complex
        data block with the function Bimage::pack_two_in_complex and then
        transformed with the function Bimage::fft.
    The Friedel relationships in transforms from real space images are
    exploited to transform two images simultaneously and then extract
    the individual transforms from the complex data set.
    This function extracts the individual transforms and calculates the
    complex conjugate product used in cross-correlation.
    The result is scaled by the total power of the two transforms, yielding
    the correlation coefficient when the product is backtransformed into
    the cross-correlation map.

Definition at line 901 of file Bimage_complex.cpp.

  int Bimage::combined_complex_product (double hires, double lores)

Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images.

Parameters:
    hires high resolution limit.
    lores low resolution limit.

Returns:
    int error code.

    Requirement: Fourier transform of two images packed into one complex
        data block with the function Bimage::pack_two_in_complex and then
        transformed with the function Bimage::fft.
    The Friedel relationships in transforms from real space images are
    exploited to transform two images simultaneously and then extract
    the individual transforms from the complex data set.
    This function extracts the individual transforms and calculates the
    complex conjugate product used in cross-correlation.
    The result is scaled by the total power of the two transforms within
    the resolution limits, yielding the correlation coefficient when
    the product is backtransformed into the cross-correlation map.

Definition at line 926 of file Bimage_complex.cpp.

  int Bimage::combined_complex_product (double hires, double lores, Bimage * pmask)

Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images.

Parameters:
    hires high resolution limit.
    lores low resolution limit.
    *pmask binary mask (only 0 and 1), NULL if not desired.

Returns:
    int error code.

    Requirement: Fourier transform of two images packed into one complex
        data block with the function Bimage::pack_two_in_complex and then
        transformed with the function Bimage::fft.
    The Friedel relationships in transforms from real space images are
    exploited to transform two images simultaneously and then extract
    the individual transforms from the complex data set.
    This function extracts the individual transforms and calculates the
    complex conjugate product used in cross-correlation.
    The result is scaled by the total power of the two transforms within
    the resolution limits, yielding the correlation coefficient when
    the product is backtransformed into the cross-correlation map.

Definition at line 951 of file Bimage_complex.cpp.

  int Bimage::combined_complex_product_implicit_mask (double hires, double lores)

Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images.

Parameters:
    hires high resolution limit.
    lores low resolution limit.

Returns:
    int error code.

    Requirement: Fourier transform of two images packed into one complex
        data block with the function Bimage::pack_two_in_complex and then
        transformed with the function Bimage::fft.
    The Friedel relationships in transforms from real space images are
    exploited to transform two images simultaneously and then extract
    the individual transforms from the complex data set.
    This function extracts the individual transforms and calculates the
    complex conjugate product used in cross-correlation.
    An implicit mask is assumed: Only non-zero values in both transforms are considered.
    The result is scaled by the total power of the two transforms within
    the resolution limits, yielding the correlation coefficient when
    the product is backtransformed into the cross-correlation map.

Definition at line 1085 of file Bimage_complex.cpp.

  bool Bimage::compatible (Bimage * p)

Check if this image has the same number of channels and data type as another.

Parameters:
    *p reference image.

Returns:
    bool 1 if yes, 0 if no.

    The function returns the answer and leaves the calling function to
    deal with the result.

Definition at line 623 of file Bimage.cpp.

  Complex< double > Bimage::complex (long j)

Returns a complex value at the given index.

Parameters:
    j index.

Returns:
    Complex<double> the complex floating point value.

    The index refers to compound values.

Definition at line 1005 of file Bimage.cpp.

  int Bimage::complex_apply_dual_mask (Bimage * pmask)

Applies a dual mask to a complex image.

Parameters:
    *pmask mask (converted to floating point).

Returns:
    int error code.

    The mask is applied to an image, generating two images, the first
    with values retained where the mask is positive, and the second with
    values where the mask is negative.
    The input image is replaced and the second is created and linked to
    the first.
    Requirement: The two input images must be the same size.
    No statistics are calculated.

Definition at line 581 of file Bimage_complex.cpp.

  int Bimage::complex_apply_mask (Bimage * pmask)

Applies a mask to a complex image.

Parameters:
    *pmask mask (converted to floating point).

Returns:
    int error code.

    Wherever the mask is <= 0, the data is set to zero.
    Requirement: The two images must be the same size.
    No statistics are calculated.

Definition at line 521 of file Bimage_complex.cpp.

  int Bimage::complex_apply_negative_mask (Bimage * pmask)

Applies a negative mask to a complex image.

Parameters:
    *pmask mask (converted to floating point).

Returns:
    int error code.

    Wherever the mask is >= 0, the data is set to zero.
    Requirement: The two images must be the same size.
    No statistics are calculated.

Definition at line 550 of file Bimage_complex.cpp.

  int Bimage::complex_bandpass (double hires, double lores)

Bandpasses a Fourier transform.

Parameters:
    hires high resolution limit.
    lores low resolution limit.

Returns:
    int error code.

    Requirement: a complex Fourier transform.
    All data outside the band limits are set to zero.

Definition at line 615 of file Bimage_complex.cpp.

  void Bimage::complex_conjugate ()

Calculates the complex conjugate image.

Definition at line 183 of file Bimage_complex.cpp.

  int Bimage::complex_conjugate_product (Bimage * p)

Calculates the product of a complex image with the conjugate of a second.

Parameters:
    *p complex image.

Returns:
    int error code.

    Complex conjugate product:
        (a + ib)*(c - id) = (a*c + b*d) + i(b*c - a*d).
    Requirement: The two images must be the same size.
    No statistics are calculated.

Definition at line 460 of file Bimage_complex.cpp.

  Bimage * Bimage::complex_conjugate_product_one2many (Bimage * p)

Calculates the product of a complex image with the conjugate of a second.

Parameters:
    *p complex image.

Returns:
    int error code.

    Complex conjugate product:
        (a + ib)*(c - id) = (a*c + b*d) + i(b*c - a*d).
    Requirement: The two images must be the same size.
    No statistics are calculated.

Definition at line 490 of file Bimage_complex.cpp.

  int Bimage::complex_multiply (Bimage * p)

Calculates the product of a complex image with a simple image.

Parameters:
    *p simple image.

Returns:
    int error code.

    Requirement: The two images must be the same size.
    No statistics are calculated.

Definition at line 400 of file Bimage_complex.cpp.

  double Bimage::complex_normalize ()

Normalizes the power in a complex image.

Returns:
    double power.

    The first element is set to zero.
    The image is scaled by the remaining total power, i.e., the sum of the intensities.

Definition at line 225 of file Bimage_complex.cpp.

  double Bimage::complex_power ()

Calculates the power in a complex image.

Returns:
    double power.

    The first element is set to zero.
    The image is scaled by the remaining total power, i.e., the sum of the intensities.

Definition at line 200 of file Bimage_complex.cpp.

  int Bimage::complex_product (Bimage * p)

Calculates the complex product of two complex images.

Parameters:
    *p complex image.

Returns:
    int error code.

    Complex product:
        (a + ib)*(c + id) = (a*c - b*d) + i(b*c + a*d).
    Requirement: The two images must be the same size.
    No statistics are calculated.

Definition at line 430 of file Bimage_complex.cpp.

  void Bimage::complex_to_amplitudes ()

The amplitudes from a complex image is written to a simple image.

Definition at line 114 of file Bimage_complex.cpp.

  void Bimage::complex_to_imaginary ()

The imaginary part of a complex image is written to a simple image.

Definition at line 71 of file Bimage_complex.cpp.

  void Bimage::complex_to_intensities ()

The intensities from a complex image is written to a simple image.

Definition at line 92 of file Bimage_complex.cpp.

  void Bimage::complex_to_phases ()

The phases from a complex image is written to a simple image.

Definition at line 161 of file Bimage_complex.cpp.

  void Bimage::complex_to_real ()

The real part of a complex image is written to a simple image.

Definition at line 50 of file Bimage_complex.cpp.

  void Bimage::complex_to_signed_amplitudes ()

The signed amplitudes from a complex image is written to a simple image.

Definition at line 136 of file Bimage_complex.cpp.

  CompoundType Bimage::compound_type () [inline]

Definition at line 351 of file Bimage.h.

  void Bimage::compound_type (CompoundType ct) [inline]

Definition at line 352 of file Bimage.h.

  long Bimage::compound_type_size () [inline]

Definition at line 355 of file Bimage.h.

  Bstring Bimage::compound_type_string ()

Get the string representation of a datatype.

Returns:
    Bstring string representation of a datatype.

Definition at line 1693 of file Bimage.cpp.

  double Bimage::convert_to_helix (double helix_rise, double helix_angle, Vector3< double > offset)

Converts a map to a helix.

Parameters:
    helix_rise rise per asymmetric unit
    helix_angle rotation angle per asymmetric unit.
    offset offset in the xy plane.

Returns:
    double 0.

    The data is offset from the central axis based on helical parameters along the axis.
    The data is rotated around the offset vector based on the helix rise
    and helix angle by an angle:
                      distance * (1 - cos(helix_angle))
        angle2 = atan ---------------------------------
                                helix_rise

Definition at line 721 of file Bimage_helix.cpp.

  int Bimage::convolve (Bimage * pkernel)

Convolves an image with an arbitrary size convolution filter.

Parameters:
    *pkernel kernel encoded as an image.

Returns:
    int 0, <0 on error.

    The kernel is multiplied with each area surrounding the current voxel
    with wrapping to avoid image edge effects.
    The convolution is threaded if compiled with OpenMP.

Definition at line 474 of file Bimage_filter.cpp.

  int Bimage::convolve_chunk (Bimage * pkernel, float * nudata, long i, long len)

Definition at line 393 of file Bimage_filter.cpp.

  void Bimage::coordinates (long i, long & nx, long & ny, long & nz) [inline]

Definition at line 416 of file Bimage.h.

  void Bimage::coordinates (long i, long & nx, long & ny, long & nz, long & nn) [inline]

Definition at line 423 of file Bimage.h.

  void Bimage::coordinates (long i, long & nc, long & nx, long & ny, long & nz, long & nn) [inline]

Definition at line 432 of file Bimage.h.

  Vector3<long> Bimage::coordinates (long i) [inline]

Definition at line 443 of file Bimage.h.

  Bimage * Bimage::copy ()

Copies the header information and data of an image into a new image structure.

Returns:
    Bimage* copied image, NULL if copy failed.

Definition at line 2695 of file Bimage.cpp.

  Bimage * Bimage::copy (long nu_nimg)

Copies the header information and data of an image into a new image structure.

Parameters:
    nu_nimg new number of images (if < 1, keep the old number)

Returns:
    Bimage* copied image, NULL if copy failed.

Definition at line 2721 of file Bimage.cpp.

  Bimage* Bimage::copy_header () [inline]

Definition at line 650 of file Bimage.h.

  Bimage * Bimage::copy_header (long nu_nimg)

Copy an image structure into a new one.

Parameters:
    nu_nimg new number of images (if < 1, keep the old number)

Returns:
    Bimage* the new image structure, NULL if copy failed.

    All information from an old image structure is copied into a new one.
    This takes care of the internal arrays in the structure.
    The data pointer is left to point to the original data.

Definition at line 2758 of file Bimage.cpp.

  int Bimage::correct_background (long nn, int flag)

Corrects the background for one sub-image.

Parameters:
    nn sub-image.
    flag flag to specify where to calculate the background: [0,3]

Returns:
    int 0, <0 on error.

    The background is taken as the average of the values outside the
    circle or sphere enclosed by the image.

Definition at line 202 of file Bimage_background.cpp.

  int Bimage::correct_background (int flag = 0)

Corrects the background for each sub-image.

Parameters:
    flag flag to specify where to calculate the background: [0,1]

Returns:
    int 0, <0 on error.

    The background is taken as the average of the values outside the
    circle or sphere enclosed by the image.

Definition at line 258 of file Bimage_background.cpp.

  int Bimage::correct_background (Bimage * pmask, int flag = 0)

Corrects the background for each sub-image.

Parameters:
    *pmask foreground mask.
    flag flag to specify where to calculate the background: [0,3]

Returns:
    int 0.

    The background is taken as the average of the values outside the
    circle or sphere enclosed by the image.
    If the mask is specified, it is used to define the foreground of the
    image. The correction then includes the area outside the circle or
    sphere as well as the area where the mask is zero.

Definition at line 296 of file Bimage_background.cpp.

  double Bimage::correlate (Bimage * p)

Calculates correlation coefficient between two images.

Parameters:
    *p image to correlate with.

Returns:
    double correlation coefficient, -1 if not run.

    The correlation between two images is calculated and normalized as:
                   sum((image1 - avg1)*(image2 - avg2))
        CC = -------------------------------------------------
             sqrt(sum(image1 - avg1)^2 * sum(image2 - avg2)^2)
    Both images are converted to floating point.
    Only the first image is used.

Definition at line 36 of file Bimage_correlate.cpp.

  double Bimage::correlate (Bimage * p, double rmin, double rmax, Bimage * pmask = NULL, int flag = 0)

Calculates a correlation coefficient between two images.

Parameters:
    *p second image.
    rmin minimum radius (pixel units).
    rmax maximum radius (pixel units).
    *pmask mask (can be NULL).
    flag flag to modify second image.

Returns:
    double correlation coefficient, -1 if error.

    The correlation between two images is calculated and normalized as:
                 sum((image1 - avg1)*(image2 - avg2))
        CC = -------------------------------------------------
             sqrt(sum(image1 - avg1)^2 * sum(image2 - avg2)^2)

Definition at line 90 of file Bimage_correlate.cpp.

  double Bimage::correlate_annuli (Bimage * polref, int ann_min, int ann_max, double ang_min, double ang_max, fft_plan planf, fft_plan planb, double & cc_max)

Correlate annuli of a polar image.

Parameters:
    *polref reference image polar power spectrum transform.
    ann_min low resolution cutoff (in inverse pixels).
    ann_max high resolution cutoff (in inverse pixels).
    ang_min minimum angle to test for (radians).
    ang_max maximum angle to test for (radians).
    planf FFT forward plan.
    planb FFT backward plan.
    &cc_max pointer to correlation coefficient for return.

Returns:
    double angle.

    The input images must be transformed polar images, with each annulus
    corresponding to a row in the image.
    The polar image annuli between the given limits are cross-correlated
    one by one, and a sum of all annuli calculated, weighted by annulus index.
    The maximum value in the annulus sum corresponds to the best fit angle.
    Both image and mirror image are assessed, yielding a negative angle
    when the mirror image gives a larger correlation.
    FFTW library (www.fftw.org).

Definition at line 592 of file Bimage_align.cpp.

  double Bimage::correlation_coefficient (Vector3< double > shift)

Calculates a coefficient from a Fourier correlation transform given a shift.

Parameters:
    shift real space shift.

Returns:
    double correlation coefficient.

    The input image is a cross-correlation transform.
    A brute force backtransform integration is done for the given shift to
    calculate the corresponding correlation coefficient.

Definition at line 470 of file Bimage_correlate.cpp.

  Bimage * Bimage::cross_correlate (Bimage * p, double hires, double lores, fft_plan planf, fft_plan planb)

Calculates a cross-correlation map by Fast Fourier transformation.

Parameters:
    *p second image.
    hires high resolution limit.
    lores low resolution limit.
    planf forward transform plan.
    planb backward transform plan.

Returns:
    Bimage* cross-correlation image.

    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.
    Zero-valued data in the transforms are implicitly excluded.
    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 363 of file Bimage_correlate.cpp.

  Bimage* Bimage::cross_correlate (Bimage * p, Bimage * pmask = NULL) [inline]

Definition at line 946 of file Bimage.h.

  Bimage * Bimage::cross_correlate (Bimage * p, double hires, double lores, Bimage * pmask = NULL)

Calculates a cross-correlation map by Fast Fourier transformation.

Parameters:
    *p second image.
    hires high resolution limit.
    lores low resolution limit.
    *pmask binary mask (only 0 and 1), NULL if not desired.

Returns:
    Bimage* cross-correlation image.

    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 419 of file Bimage_correlate.cpp.

  Bimage * Bimage::cross_correlate (Bimage * p, double hires, double lores, Bimage * pmask, fft_plan planf, fft_plan planb)
write_img('pccp.mrc', pc, 0);

Definition at line 603 of file Bimage_correlate.cpp.

  Bimage * Bimage::cross_correlate_fspace (Bimage * p, double hires, double lores, double shift_limit)

Calculates a cross-correlation map by Fast Fourier transformation.

Parameters:
    *p second image.
    hires high resolution limit.
    lores low resolution limit.
    shift_limit maximum real space shift.

Returns:
    Bimage* cross-correlation image.

    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 563 of file Bimage_correlate.cpp.

  Bimage * Bimage::cross_correlate_two_way (Bimage * p, double hires, double lores, fft_plan planf, fft_plan planb)

Calculates a cross-correlation map by Fast Fourier transformation.

Parameters:
    *p second image.
    hires high resolution limit.
    lores low resolution limit.
    planf FFT forward plan.
    planb FFT backward plan.

Returns:
    Bimage* cross-correlation image.

    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 bandpass filtered to the given resolution limits and unpacked.
    The two transforms are normalized, and multiplied in two ways:
        prod1 = data1 * data2.conjugate
        prod2 = data1 * data2
    The second product represents a cross-correlation with a 180 degree
    rotation of the second image.
    Both are back-transformed to obtain the two cross-correlation map in real space.
    The one with the highest maximum is selected to return.
    The resultant cross-correlation image data type is floating point.
    The angle in the cross-correlation image is set to zero if the first
    map is selected, otherwise it is set to PI.

Definition at line 670 of file Bimage_correlate.cpp.

  Bimage * Bimage::cross_correlate_validate (Bimage * p, Bimage * pmask)

Calculates a masked cross-correlation map by Fast Fourier transformation.

Parameters:
    *p second image.
    *pmask binary mask (only 0 and 1), NULL if not desired.

Returns:
    Bimage* cross-correlation image.

    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 and masked with mask image 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 mask must be composed of 0 and 1, and is converted to floating point.
    The mask can be omitted (NULL).
    The resultant cross-correlation image data type is floating point.

Definition at line 751 of file Bimage_correlate.cpp.

  int Bimage::cylinder (Vector3< double > center, double radius, double height, double width, int fill_type = 0, double fill = 0)

Fills a cylinder within an image with a uniform value.

Parameters:
    center three vector center of cylinder.
    radius cylinder radius.
    height cylinder heigth.
    width gaussian width of smoothing function.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill fill value.

Returns:
    int 0.

    All voxels within a cylinder at a given location are set to a given fill value.
    The height is along the z-direction.
    The new data replaces the old data.
    The default center is {0,0,0}.

Definition at line 465 of file Bimage_edit.cpp.

  int Bimage::cylindrical_shells ()

Calculates an image with slices representing cylindrical shell projections.

Returns:
    int 0.

    The 3D image is converted so that the sections contain 2D projections
    of cylindrical shells. The projection in slice i is defined for:
        i >= sqrt(x^2 + y^2)
    The first projection is placed at the z origin and radiates out into
    both positive and negative directions.
    Sampling in x and y is not changed.
    The sampling must be isotropic.

Definition at line 855 of file Bimage_polar.cpp.

  unsigned char* Bimage::data_alloc () [inline]

Definition at line 256 of file Bimage.h.

  unsigned char * Bimage::data_alloc (long nbytes)

Allocate image data.

Parameters:
    nbytes number of bytes to allocate.

Returns:
    unsigned char* pointer to data.

    Any old data block is deleted.

Definition at line 776 of file Bimage.cpp.

  unsigned char * Bimage::data_alloc (DataType type, CompoundType ctype, long nx, long ny, long nz, long nn)

Allocate image data with size parameters.

Parameters:
    type data type.
    ctype compound type.
    nx x dimension.
    ny y dimension.
    nz z dimension.
    nn number of sub-images.

Returns:
    unsigned char* pointer to data.

    The image parameters are set and a new data block allocated.

Definition at line 822 of file Bimage.cpp.

  unsigned char * Bimage::data_assign (unsigned char * nudata)

Assign image data.

Parameters:
    *nudata allocated data pointer.

Returns:
    unsigned char* pointer to data.

    Note: The size of the data block must correspond to the image dimensions!

Definition at line 852 of file Bimage.cpp.

  void Bimage::data_delete ()

Deallocates the image data.

Definition at line 874 of file Bimage.cpp.

  long Bimage::data_offset () [inline]

Definition at line 265 of file Bimage.h.

  void Bimage::data_offset (long doff) [inline]

Definition at line 266 of file Bimage.h.

  unsigned char* Bimage::data_pointer () [inline]

Definition at line 261 of file Bimage.h.

  unsigned char* Bimage::data_pointer (long offset) [inline]

Definition at line 262 of file Bimage.h.

  void Bimage::data_pointer (unsigned char * ptr) [inline]

Definition at line 263 of file Bimage.h.

  long Bimage::data_size () [inline]

Definition at line 255 of file Bimage.h.

  DataType Bimage::data_type () [inline]

Definition at line 349 of file Bimage.h.

  void Bimage::data_type (DataType dt) [inline]

Definition at line 350 of file Bimage.h.

  long Bimage::data_type_bits () const

Returns the size of the datatype in bits.

Returns:
    long data type size in bits.

    The Bit type returns 1.

Definition at line 1560 of file Bimage.cpp.

  double Bimage::data_type_max ()

Get the maximum of a datatype.

Returns:
    double maximum value.

    This function is used for returning the maximum value
    a data type can hold.

Definition at line 1641 of file Bimage.cpp.

  double Bimage::data_type_min ()

Get the minimum of a datatype.

Returns:
    double minimum value.

    This function is used for returning the minimum value
    a data type can hold.

Definition at line 1611 of file Bimage.cpp.

  long Bimage::data_type_size () const

Returns the size of the datatype in bytes.

Returns:
    long data type size.

    The Bit type returns 1.

Definition at line 1585 of file Bimage.cpp.

  Bstring Bimage::data_type_string ()

Get the string representation of a datatype.

Returns:
    Bstring string representation of a datatype.

Definition at line 1667 of file Bimage.cpp.

  Vector3<double> Bimage::default_origin () [inline]

Definition at line 585 of file Bimage.h.

  Bimage * Bimage::defocus_scale (long nn, double df, double df2, double iCL2, int fill_type)

Definition at line 216 of file Bimage_powerspectrum.cpp.

  long Bimage::delete_images (Bstring list, int retain = 0)

Retains or deletes sub-images from a multi-image structure.

Parameters:
    list list of sub-images to retain or delete.
    retain 0=delete list, 1=retain list.

Returns:
    long error code (<0 means failure) or number of sub-images remaining.

    Sub-images specified in a list are either retained or deleted.
    The new data replaces the old data.

Definition at line 2134 of file Bimage.cpp.

  double Bimage::density (long nn, Vector3< double > coord, double radius, double & sigma)

Calculates the density in a sphere around a coordinate in an image.

Author:
    Daniel Nemecek and Bernard Heymann

Parameters:
    nn sub-image number.
    coord position of density in map (voxels).
    radius spherical radius.
    sigma standard deviation result.

Returns:
    double average density.

    The density origin is positioned on the component.

Definition at line 3010 of file Bimage.cpp.

  double Bimage::density (long nn, Vector3< double > coord, double radius) [inline]

Definition at line 703 of file Bimage.h.

  int Bimage::distort_elliptically (double angle, double shift)

Transforms a tubular cylinder to an elliptical profile.

Parameters:
    angle angle of elliptical maximum.
    shift outward shift at elliptical maximum radius.

Returns:
    int 0.

    The density is shifted towards or away from the origin by a specific
    amount and in a direction determined by an elliptical profile.

Definition at line 779 of file Bimage_helix.cpp.

  void Bimage::divide (Bimage * p, double scale = 1, double shift = 0)

Divides the first image by the second.

Parameters:
    *p other image.
    scale density scale to apply to other image
    shift density shift to apply to other image.

    The image is divided by the other with exceptions:
        image /= other*scale + shift
    Both images are converted to floating point.

Definition at line 3579 of file Bimage.cpp.

  void Bimage::divide_one (Bimage * p, double scale = 1, double shift = 0)

Divides the first image by the first sub-image of the second.

Parameters:
    *p other image.
    scale density scale to apply to other image
    shift density shift to apply to other image.

    The image is divided by the other with exceptions:
        image /= other*scale + shift
    Both images are converted to floating point.

Definition at line 3632 of file Bimage.cpp.

  double Bimage::dyad_interpolate (long i, int norm_flag = 1)

Definition at line 56 of file Bimage_helix.cpp.

  int Bimage::edge (int type, Vector3< long > rect, Vector3< double > start, double width, int fill_type = 0, double fill = 0)

Smooths the image edge with a soft rectangular function.

Parameters:
    type type of edge: 0=rectangle, 1=oval, 2=cylinder
    rect three-value size of the area to be smoothed.
    start three-value start for smoothing.
    width gaussian width of smoothing function.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill value of edge voxels.

Returns:
    int 0.

    The edge of the image is smoothed with a function:
                        v_old(x,y,z) + fill*exp(1.618*dist/width)
        v_new(x,y,z) = ------------------------------------------
                               1 + exp(1.618*dist/width)
    where   fill is the desired edge value.
            dist is the distance to the rectangular boundary defined by
                the input size and start
            width is the gaussian width (softness)
    With very small values of the gaussian width, the edge approaches a
    step function.
    With negative width values, the area filled is outside the shape.

Definition at line 319 of file Bimage_edit.cpp.

  int Bimage::edge (long nn, int type, Vector3< long > rect, Vector3< double > start, double width, int fill_type = 0, double fill = 0)

Smooths the image edge with a soft rectangular function.

Parameters:
    nn sub-image.
    type type of edge: 0=rectangle, 1=oval, 2=cylinder
    rect three-value size of the area to be smoothed.
    start three-value start for smoothing.
    width gaussian width of smoothing function.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill value of edge voxels.

Returns:
    int 0.

    The edge of the image is smoothed with a function:
                        v_old(x,y,z) + fill*exp(1.618*dist/width)
        v_new(x,y,z) = ------------------------------------------
                               1 + exp(1.618*dist/width)
    where   fill is the desired edge value.
            dist is the distance to the rectangular boundary defined by
                the input size and start
            width is the gaussian width (softness)
    With very small values of the gaussian width, the edge approaches a
    step function.
    With negative width values, the area filled is outside the shape.

Definition at line 365 of file Bimage_edit.cpp.

  Bimage * Bimage::edge_mask (int type, Vector3< long > rect, Vector3< double > start, double width)

Creates a mask with the edge approaching zero.

Parameters:
    type type of edge: 0=rectangle, 1=oval, 2=cylinder
    rect three-value size of the area to be masked.
    start three-value start for mask.
    width gaussian width of smoothing function.

Returns:
    Bimage* new soft mask.

    The edge of the image is smoothed with a function:
                                    1
        v_new(x,y,z) =  -------------------------
                        1 + exp(1.618*dist/width)
    where   dist is the distance to the boundary defined by
                the input size and start
            width is the gaussian width (softness)
    With very small values of the gaussian width, the edge approaches a
    step function.
    With negative width values, the area filled is outside the shape.

Definition at line 231 of file Bimage_edit.cpp.

  int Bimage::enlarge (Vector3< long > scale)

Enlarges an image by an inetger scale.

Parameters:
    scale three-value scale.

Returns:
    int 0.

    An image is enlarged by integer amounts.
    The new data replaces the old data.

Definition at line 503 of file Bimage_resize.cpp.

  long Bimage::erase (string tag) [inline]

Definition at line 226 of file Bimage.h.

  Bimage * Bimage::extract (long nn)

Extracts one sub-image into new image structure.

Parameters:
    nn image number to extract.

Returns:
    Bimage* the new image structure, NULL if copy failed.

Definition at line 21 of file Bimage_extract.cpp.

  Bimage * Bimage::extract (long n1, long n2)

Extracts a set of sub-images into new image structure.

Parameters:
    n1 first sub-image to extract.
    n2 last sub-image to extract.

Returns:
    Bimage* the new image structure, NULL if copy failed.

Definition at line 40 of file Bimage_extract.cpp.

  Bimage * Bimage::extract (long nn, Vector3< long > coords, Vector3< long > size, int fill_type = 0, double fill = 0)

Extracts a region of one sub-image into new image structure.

Parameters:
    nn image number to extract.
    coords extraction start.
    size extraction size.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill fill value.

Returns:
    Bimage* the new image structure, NULL if copy failed.

Definition at line 69 of file Bimage_extract.cpp.

  Bimage* Bimage::extract (long nn, Vector3< double > loc, Vector3< long > size, Vector3< double > origin) [inline]

Definition at line 656 of file Bimage.h.

  Bimage * Bimage::extract (long nn, Vector3< double > loc, Vector3< long > size, Vector3< double > ori, Matrix3 mat)

Extracts a region of one sub-image into new image structure.

Parameters:
    nn image number to extract.
    loc extraction location.
    size extraction size.
    ori extraction origin.
    mat orientation matrix.

Returns:
    Bimage* the new image structure, NULL if copy failed.

Definition at line 111 of file Bimage_extract.cpp.

  Bimage* Bimage::extract (long nn, Vector3< double > loc, Vector3< long > size, Vector3< double > origin, View view) [inline]

Definition at line 663 of file Bimage.h.

  Bimage * Bimage::extract_filament (long img_num, double width, int axis, long nspline, Vector3< double > * spline)

Extracts a filament defined by a series of coordinates.

Parameters:
    img_num image number from which to extract filament.
    width width of filament image to extract.
    axis helical axis alignment: x=1, y=2, z=3.
    nspline number of coordinates in spline curve.
    *spline spline curve.

Returns:
    Bimage* one filament image.

    A single filament is extracted and returned.

Definition at line 1132 of file Bimage_extract.cpp.

  Bimage * Bimage::extract_line (long nn, Vector3< double > start, Vector3< double > end, long width)

Extracts a line from an image into a new image.

Parameters:
    nn image number from which to extract.
    start 3-vector start of line.
    end 3-vector end of line.
    width width of integration perpendicular to line.

Returns:
    Bimage* extracted line image (1D).

    The line values extracted are the interpolated values along the vector
    defined by start and end coordinates..

Definition at line 509 of file Bimage_extract.cpp.

  Bimage * Bimage::extract_magnify (long nn, Vector3< long > center, Vector3< long > ext_size, double scale)

Extracts a region from an image to magnify.

Parameters:
    nn image number to extract.
    center center of region to magnify.
    ext_size size of region to magnify.
    scale dimensional scaling.

Returns:
    Bimage* extracted slice for 2D and 3 slices for 3D.

    Only the desired region is extracted from the original image and
    resized based on the given scale argument.
    The dynamic range is rescaled using the image display minimum and
    maximum:
        new_data = data*255/(max-min)
    with truncation of the data below 0 and above 255.
    Bit data are converted to 0 (black) and 255 (white).
    RGB data are rescaled as for gray scale images.
    Complex data types are converted to intensities.

Definition at line 876 of file Bimage_extract.cpp.

  Bimage * Bimage::extract_shell (long nn, double minrad, double maxrad)

Extracts a shell from an image into a new image.

Parameters:
    nn image number from which to extract, -1 indicates all images.
    minrad minimum shell radius.
    maxrad maximum shell radius.

Returns:
    Bimage* extracted image.

    A single image (only one sub-image) is extracted from a given sub-image
    in an image structure, starting at a specified point and with a
    specified size.
    The old data is not affected.
    Statistics for the extracted image are calculated.

Definition at line 197 of file Bimage_extract.cpp.

  Bimage * Bimage::extract_show (int aflag)

Converts a slice from an image to a 2D plane for display.

Parameters:
    aflag averaging flag.

Returns:
    Bimage* extracted slice.

    Only the desired image slice is extracted from the original image and
    resized based on the given scale argument.
    The image, slice and scale values are encoded in the image structure.
    The dynamic range is rescaled using the image display minimum and maximum:
        new_data = data*255/(max-min)
    with truncation of the data below 0 and above 255.
    Bit data are converted to 0 (black) and 255 (white).
    RGB data are rescaled as for gray scale images.
    Complex data types are converted to intensities.

Definition at line 820 of file Bimage_extract.cpp.

  int Bimage::extract_show_chunk (Bimage * pshow, int aflag, long i, long len)

Definition at line 704 of file Bimage_extract.cpp.

  Bimage * Bimage::extract_slice (long nz)

Extracts a given slice or slices from an image.

Parameters:
    nz slice number to extract.

Returns:
    Bimage* extracted slice(s).

    Only the desired slices are extracted from the original image.
    The dynamic range is rescaled using the image display minimum and
    maximum:
        new_data = data*255/(max-min)
    with truncation of the data below 0 and above 255.
    Bit data are converted to 0 (black) and 255 (white).
    RGB data are rescaled as for gray scale images.
    Complex data types are converted to intensities.

Definition at line 1040 of file Bimage_extract.cpp.

  Bimage * Bimage::extract_tetrahedron (Vector3< double > * tet, int fill_type = 0, double fill = 0)

Extracts a tetrahedral part of the image.

Parameters:
    *tet four 3-value vectors defining the tetrahedron.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill fill value.

Returns:
    int 0.

    All voxels outside a tetrahedron defined by four points or vectors
    are set to a given fill value.
    The new data replaces the old data.

Definition at line 546 of file Bimage_extract.cpp.

  Bimage * Bimage::extract_tiles (long nn, vector< Vector3< long >> & coords, Vector3< long > tile_size)

Extracts a set of tiles at specified positions from an image into a new image.

Parameters:
    nn image number from which to extract, -1 indicates all images.
    *coords coordinates for the tile origins.
    tile_size 3-vector size of extracted image.

Returns:
    Bimage* p extracted set of sub-images.

    A set of tiles of specified size are extracted from a given sub-image
    in an image structure, using given coordinates for the tiles, which have
    to fit into the image size. The origins of the tiles are inserted into
    the sub-image origin fields.
    The old data is not affected.

Definition at line 335 of file Bimage_extract.cpp.

  Bimage * Bimage::extract_tiles (long nn, Vector3< long > start, Vector3< long > region, Vector3< long > tile_size, Vector3< long > step_size, int exceed)

Extracts a set of tiles from an image into a new image.

Parameters:
    nn image number from which to extract.
    start 3-vector start for first tile to be extracted.
    region 3-vector size of part of image to be extracted (0 = whole image).
    tile_size 3-vector size of extracted image.
    step_size 3-vector size of tile intervals.
    exceed flag to allow tiles to exceed the input image size.

Returns:
    Bimage* extracted set of sub-images.

    A set of tiles of specified size are extracted from a given sub-image
    in an image structure, starting from a point and generating
    as many tiles as would fit into the image size given. If the image size
    given is zero, then the whole image is used. The origins of the tiles
    are inserted into the sub-image origin fields.
    The old data is not affected.

Definition at line 401 of file Bimage_extract.cpp.

  Bimage * Bimage::extract_tiles (long nn, Vector3< long > tile_size, double fraction = 0.2)

Extracts a set of tiles from an image into a new image.

Parameters:
    nn image number from which to extract.
    tile_size 3-vector size of extracted image.
    fraction overlap fraction to aim for.

Returns:
    Bimage* extracted set of sub-images.

    A set of tiles of specified size are extracted from a given sub-image
    in an image structure. The tiles are located with overlap (~20% of tile width)
    with the aim of covering the whole image but not exceeding it.
    The origins of the tiles are inserted into the sub-image origin fields.
    The old data is not affected.

Definition at line 453 of file Bimage_extract.cpp.

  Bimage * Bimage::extract_wrap (long nn, Vector3< double > loc, Vector3< long > size, Vector3< double > ori, Matrix3 mat)

Extracts a region of one sub-image into new image structure with wrapping.

Parameters:
    nn image number to extract.
    loc extraction location.
    size extraction size.
    ori extraction origin.
    mat orientation matrix.

Returns:
    Bimage* the new image structure, NULL if copy failed.

Definition at line 154 of file Bimage_extract.cpp.

  Bimage* Bimage::extract_wrap (long nn, Vector3< long > size, Matrix3 mat) [inline]

Definition at line 669 of file Bimage.h.

  int Bimage::extrude_cross_section (long length, double helix_rise, double helix_angle, int fill_type, double fill)

Extrudes a 2D cross section into a 3D continuous helix.

Parameters:
    length length in z.
    helix_rise helical subunit rise in angstrom.
    helix_angle helical subunit rotation in radians.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill value of edge voxels.

Returns:
    int 0.

    The helical axis is at the origin and alongthe a axis.

Definition at line 1531 of file Bimage_helix.cpp.

  int Bimage::fft () [inline]

Definition at line 822 of file Bimage.h.

  int Bimage::fft (fft_direction dir)

Fast Fourier transforms an image.

Parameters:
    dir direction of transformation (FFTW_FORWARD or FFTW_BACKWARD)

Returns:
    int error code.

    FFTW library (www.fftw.org).
    A multi-image 1D, 2D and 3D data set is transformed forward or backward
    and rescaled by 1/sqrt(N).  The forward transformation has a negative
    signed exponent in the kernel and the backward transform a positive
    sign. The transformation is done in place and the resultant data are
    returned within the original image structure.  For forward transforms,
    the resultant data type is complex float, while for backward transforms,
    it is Float.

Definition at line 49 of file Bimage_fft.cpp.

  int Bimage::fft (fft_direction dir, bool norm_flag)

Fast Fourier transforms an image.

Parameters:
    dir direction of transformation (FFTW_FORWARD or FFTW_BACKWARD)
    norm_flag normalization: 0=none, 1=sqrtN, 2=N.

Returns:
    int error code.

    FFTW library (www.fftw.org).
    A multi-image 1D, 2D and 3D data set is transformed forward or backward
    and optionally rescaled by 1/sqrt(N) or N.  The forward transformation
    has a negative signed exponent in the kernel and the backward transform
    a positive sign. The transformation is done in place and the resultant
    data are returned within the original image structure.
    For both directions the resultant image is complex.

Definition at line 80 of file Bimage_fft.cpp.

  int Bimage::fft (fft_plan plan, bool norm_flag = 1)

Fast Fourier transforms an image.

Parameters:
    plan Fourier transform plan.
    norm_flag normalization: 0=none, 1=sqrtN, 2=N.

Returns:
    int error code.

    FFTW library (www.fftw.org).
    A multi-image 1D, 2D and 3D data set is transformed forward or backward
    and optionally rescaled by 1/sqrt(N) or N.  The forward transformation
    has a negative signed exponent in the kernel and the backward transform
    a positive sign. The transformation is done in place and the resultant
    data are returned within the original image structure.
    For both directions the resultant image is complex.
    Requirement: The plan must be derived from the same size image.

Definition at line 174 of file Bimage_fft.cpp.

  int Bimage::fft_back () [inline]

Definition at line 823 of file Bimage.h.

  int Bimage::fft_back (fft_plan plan, bool norm_flag = 1) [inline]

Definition at line 830 of file Bimage.h.

  fft_plan Bimage::fft_setup (fft_direction dir, int opt = 0)

Sets up a plan for fast Fourier transforms.

Parameters:
    dir direction of transformation (FFTW_FORWARD or FFTW_BACKWARD)
    opt optimization (0=FFTW_ESTIMATE, 1=FFTW_MEASURE, 2=FFTW_PATIENT, 3=FFTW_EXHAUSTIVE).

Returns:
    fft_plan FFTW plan.

    FFTW library (www.fftw.org).
    The size and direction determines the plan.
    Both FFTW versions 2 and 3 are supported.

Definition at line 29 of file Bimage_fft.cpp.

  Bimage * Bimage::filament_density (double width)

Estimates the density per pixel length of a filament.

Parameters:
    width filament width (pixels).

Returns:
    Bimage* one dimensional image with line integrals.

    The filament axis must be along the long axis (x or y).
    The filament width must be about half of the image width.
    The background is calculated for each line from the regions
    outside the width of the filament and subtracted from all
    values in the line.

Definition at line 1688 of file Bimage_helix.cpp.

  Bplot * Bimage::filament_width (long width, long lim_lo, long lim_hi)

Estimates the width of a filament.

Parameters:
    width window size.
    lim_lo minimum filament width.
    lim_hi maximum filament width.

Returns:
    Bplot* plot of filament widths.

    The filament axis must be along the y axis.

Definition at line 1583 of file Bimage_helix.cpp.

  void Bimage::file_name (string s) [inline]

Definition at line 230 of file Bimage.h.

  string& Bimage::file_name () [inline]

Definition at line 231 of file Bimage.h.

  void Bimage::fill (double v) [inline]

Definition at line 698 of file Bimage.h.

  int Bimage::fill_gaps (long step)

Fill the voxels that are not calculated.

Parameters:
    step step increment for voxels with proper values.

Returns:
    int 0, <0 if error.

    The step size used to calculate sparse voxels is here used to determine
    a kernel size for the filling operation. For each sparse voxel, all the
    neighbors within the kernel are filled with the center value.

Definition at line 853 of file Bimage_edit.cpp.

  TypePointer Bimage::fill_value (double v)

Definition at line 1067 of file Bimage.cpp.

  int Bimage::filter_average (long kernel_size)

Applies an averaging filter to an image.

Parameters:
    kernel_size length of kernel edge (typically 3).

Returns:
    int 0, <0 if error.

    A kernel of a given size is passed over the image and the average
    value within the kernel assigned to the central voxel.

Definition at line 208 of file Bimage_filter.cpp.

  int Bimage::filter_average (Vector3< long > k)

Definition at line 214 of file Bimage_filter.cpp.

  int Bimage::filter_bilateral (double sigma1, double sigma2, int kernel_type, long kernel_radius)

Denoise an image with combined gaussian distance and density difference kernel.

Parameters:
    sigma1 sigma for distance weighting function.
    sigma2 sigma for density difference weighting function.
    kernel_type kernel type for range filter.
    kernel_radius kernel radius.

Returns:
    int 0.

    The kernel is multiplied with each area surrounding the current voxel.
    Kernel types:
        1.  Gaussian
        2.  Lorentzian
        3.  Tukey

Definition at line 784 of file Bimage_filter.cpp.

  int Bimage::filter_bilateral_chunk (Bimage * pkernel, double sigma2, int kernel_type, float * nudata, long i, long len, int first)

Definition at line 671 of file Bimage_filter.cpp.

  int Bimage::filter_dog (double sigma1, double sigma2)

Convolves the image with a difference of gausians kernel.

Parameters:
    sigma1 sigma for the inner gaussian.
    sigma2 sigma for the outer gaussian.

Returns:
    int 0, <0 on error.

Definition at line 642 of file Bimage_filter.cpp.

  int Bimage::filter_extremes ()

Filters the extremes out of a micrograph image.

Returns:
    int 0.

    Segmentation is used to identify large contiguous regions of high
    and low values, and these regions are set to the average.

Definition at line 634 of file Bimage_segment.cpp.

  int Bimage::filter_extremes (int mod_flag)

Filters the extremes out of an image.

Parameters:
    mod_flag modification flag (0=set to avg, 1=set to min_max).

Returns:
    int 0.

    A histogram of an image is calculated.  The first minimum in the first
    quarter of the histogram and the last minimum in the last quarter
    are taken to define the small and large outliers.  Pixel outside
    these minima are then either set to average or to minimum or maximum
    (depending on the mod_flag argument) to remove the outliers.

Definition at line 663 of file Bimage_segment.cpp.

  int Bimage::filter_gaussian (long kernel_size, double sigma)

Applies a gaussian filter to an image.

Parameters:
    kernel_size length of kernel edge.
    sigma gaussian decay.

Returns:
    int 0, <0 if error.

    A kernel of a given size is passed over the image and the average
    value within the kernel assigned to the central voxel.

Definition at line 325 of file Bimage_filter.cpp.

  int Bimage::filter_ortho (int type)

Convolves the image with an orthogonal kernel with wrapping.

Parameters:
    type type of kernel: 0=gradient magnitude, 1=laplacian.

Returns:
    int 0, <0 on error.

    The gradient kernel is:
        0  0  0    0 -1  0    0  0  0
        0 -1  0   -1  0  1    0  1  0
        0  0  0    0  1  0    0  0  0
    The Laplacian filter kernel for a 3D volume is:
        0  0  0    0  1  0    0  0  0
        0  1  0    1 -6  1    0  1  0
        0  0  0    0  1  0    0  0  0
    For 1D and 2D the central value is -2 and -4 respectively.

Definition at line 545 of file Bimage_filter.cpp.

  Bimage * Bimage::filter_peak (long kernel_size)

Finds the peaks in an image.

Parameters:
    kernel_size length of kernel edge (typically 3).

Returns:
    int 0, <0 if error.

    A kernel of a given size is passed over the image and if the central
    voxel is the maximum, it is kept, otherwise it is set to background.

Definition at line 1076 of file Bimage_filter.cpp.

  int Bimage::filter_rank (long kernel_size, double rank)

Applies a median filter to an image.

Parameters:
    kernel_size length of kernel edge (typically 3).
    rank which value in the kernel to retain.

Returns:
    int 0, <0 if error.

    A kernel of a given size is passed over the image and the median
    value within the kernel assigned to the central voxel.

Definition at line 1022 of file Bimage_filter.cpp.

  int Bimage::filter_rank_chunk (long kernel_size, double rank, float * nudata, long i, long len)

Definition at line 941 of file Bimage_filter.cpp.

  int Bimage::filter_rolling_ball (long radius, double scale)

Apply a rolling ball filter.

Parameters:
    radius radius of rolling ball.
    scale density scale.

Returns:
    int 0.

Definition at line 836 of file Bimage_filter.cpp.

  int Bimage::filter_sinc ()

Weighs an image with a sinc function.

Returns:
    int 0.

    This filter compensates for trilinear interpolation during reconstruction.
    The origin must be properly defined.

Definition at line 366 of file Bimage_filter.cpp.

  int Bimage::find_center (Bimage * pmask, double hires, double lores, double radius, double sigma, int refine_flag)

Finds the center of mass of an image by cross-correlation with its inverse.

Parameters:
    *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.

Returns:
    int 0.

    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 1233 of file Bimage_correlate.cpp.

  double Bimage::find_cyclic_point_group (Bsymmetry * sym, int binfac, double hires, double lores)

Finds the orientation for an image with a cyclic point group symmetry.

Parameters:
    sym point group.
    binfac binning for faster searching (limited to 1,2,3).
    hires high resolution limit in angstroms.
    lores low resolution limit in angstroms.

Returns:
    double symmetry correlation coefficient.

    The cyclic point group symmetry operation is applied to an image using
    the reference symmetry axis, aslo the 2D rotation axis (default {0,0,1}).

Definition at line 234 of file Bimage_symmetry.cpp.

  Bplot * Bimage::find_helix_parameters (double angle_start, double angle_end, double angle_step, int bin, double hires, double lores, double radius)

Finds the best helix parameters for helical map.

Parameters:
    angle_start start value for angle.
    angle_end end value for angle.
    angle_step step size for angle.
    bin bin image for faster searching (limited to 1,2,3).
    hires high resolution limit in angstroms.
    lores low resolution limit in angstroms.
    radius radius for mask (voxels).

Returns:
    Bplot* plot with search results.

    An incremental search is done for the rotation angle, with the rise
    inferred from the cross-correlation shift.

Definition at line 848 of file Bimage_helix.cpp.

  Bplot * Bimage::find_helix_parameters (double rise_start, double rise_end, double rise_step, double angle_start, double angle_end, double angle_step, int bin, double radius)

Finds the best helix parameters for helical map.

Parameters:
    rise_start start value for rise.
    rise_end end value for rise.
    rise_step step size for rise.
    angle_start start value for angle.
    angle_end end value for angle.
    angle_step step size for angle.
    bin bin image for faster searching (limited to 1,2,3).
    radius radius for mask (voxels).

Returns:
    Bplot* plot with search results.

    An incremental search is done for the rise and rotation angle.

Definition at line 998 of file Bimage_helix.cpp.

  int Bimage::find_peak (double radius = 1e30, double sigma = 0)

Finds the peak in an image to the nearest voxel.

Parameters:
    radius search radius (if < 1, default 1e30).
    sigma attenuation around radius.

Returns:
    int error code.

    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 1338 of file Bimage_correlate.cpp.

  Bimage * Bimage::find_peaks (long kernelsize)

Finds peaks in a map with periodic boundaries.

Parameters:
    kernelsize size of kernel side (must be ≥3).

Returns:
    Bimage* image with peaks.

    A peak is defined as the local maximum within a specified kernel, where the
    maximum is also larger than a given threshold. This assumes that the region
    around a peak decreases monotonically on the scale length of the size of
    the kernel. With kernel edge of 3 (+-1 in all directions), the values around
    the peak shows a strict monotonicity with distance from the peak maximum.
    The peak positions and values are returned in the new image.

Definition at line 1601 of file Bimage_correlate.cpp.

  Vector3< double > * Bimage::find_peaks (double excl_dist, long & ncoor, double & threshold_min, double & threshold_max, double pix_min = 2, double pix_max = 10)

Finds the peaks in a cross-correlation map to find template matches.

Parameters:
    excl_dist exclusion distance between peaks.
    &ncoor number of coordinates.
    &threshold_min minimum threshold to choose peaks.
    &threshold_max maximum threshold to choose peaks.
    pix_min minimum peak width.
    pix_max maximum peak width.

Returns:
    Vector3<double>* list of coordinates.

    The map is searched in increments of the particle radius to identify
    peaks above the threshold and within a box the size of the
    particle radius. The identified peaks are further examined to eliminate
    ones that are too close to a higher scoring peak. The acceptable distance
    between peaks is set to 1.8 times the particle radius.

Definition at line 1690 of file Bimage_correlate.cpp.

  double Bimage::find_point_group (Bsymmetry * sym, double angle_step, int binfac, double hires, double lores, int flags)

Finds the orientation for an image with a specific point group symmetry.

Parameters:
    sym point group.
    angle_step angular step size for search.
    binfac binning for faster searching (limited to 1,2,3).
    hires high resolution limit in angstroms.
    lores low resolution limit in angstroms.
    flags flag to search only for minor axes.

Returns:
    double symmetry correlation coefficient.

    The point group symmetry operations are applied to an image with an
    orientation defined by the reference symmetry axis (default {0,0,1}).

Definition at line 299 of file Bimage_symmetry.cpp.

  int Bimage::find_shift (Bimage * pref, 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.

Parameters:
    *pref reference image.
    *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.

Returns:
    int error code.

    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 932 of file Bimage_correlate.cpp.

  Vector3< double > Bimage::find_shift (Bimage * pref, Bimage * pmask, double hires, double lores, double radius, double sigma, int refine_flag, double & cc)

Definition at line 971 of file Bimage_correlate.cpp.

  Vector3< double > Bimage::find_shift (Bimage * pref, double hires, double lores, double radius, double sigma, int refine_flag, fft_plan planf, fft_plan planb)

Calculates a cross-correlation map to find the shift for the pair of images.

Parameters:
    *pref reference image.
    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.
    planf forward Fourier transform plan.
    planb backward Fourier transform plan.

Returns:
    Vector3<double> shift.

    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.
    Only the first sub-image shift is calculated.

Definition at line 1031 of file Bimage_correlate.cpp.

  Vector3< double > Bimage::find_shift (Bimage * pref, Bimage * pmask, double hires, double lores, double radius, double sigma, int refine_flag, fft_plan planf, fft_plan planb, double & cc)

Calculates a cross-correlation map to find the shift for the pair of images.

Parameters:
    *pref reference image.
    *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.
    planf forward Fourier transform plan.
    planb backward Fourier transform plan.
    &cc correlation coefficient

Returns:
    Vector3<double> shift.

    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.
    Only the first sub-image shift is calculated.

Definition at line 1094 of file Bimage_correlate.cpp.

  Vector3< double > Bimage::find_shift (long nn, Bimage * pref, Bimage * pmask, double hi_res, double lo_res, double shift_limit, fft_plan planf, fft_plan planb)

Calculates a cross-correlation map to find the shift for the pair of images.

Parameters:
    nn sub-image to align.
    *pref reference image.
    *pmask binary mask for cross-correlation (only 0 and 1).
    hi_res high resolution limit.
    lo_res low resolution limit.
    shift_limit search radius (if < 1, default 1e30).
    planf forward Fourier transform plan.
    planb backward Fourier transform plan.

Returns:
    double correlation coefficient.

    The shift is returned as the origin of each sub-image relative to
    the reference origin.

Definition at line 1142 of file Bimage_correlate.cpp.

  Vector3< double > Bimage::find_shift_in_transform (double shift_limit)

Finds the shift by brute force backtransformation for selected shifts.

Parameters:
    shift_limit maximum real space shift.

Returns:
    Vector3<double> best shift.

    The input image is a cross-correlation transform.
    A brute force integration is done for the given shift to calculate
    the corresponding correlation coefficient.
    The correlation coefficient is return in the FOM field of the sub-image.

Definition at line 505 of file Bimage_correlate.cpp.

  Vector3< double > Bimage::find_shift_in_transform (long nn, Bimage * pref, double shift_limit)

Definition at line 81 of file Bimage_align.cpp.

  Bimage * Bimage::find_symmetric_view (Bimage * ptemp, Bsymmetry * sym, double phi_step, double theta_step, double alpha_step, Vector3< double > shift)

Finds the view that on symmetrizing fits best to a symmetric template.

Parameters:
    *ptemp symmetric template.
    &sym symmetry.
    phi_step phi angle step size (radians).
    theta_step theta angle step size (radians).
    alpha_step rotation angle step size (radians).
    shift shift to impose before symmetrization.

Returns:
    Bimage* image rotated to the best view.

    The orientation parameters, view vector, angle of rotation and origin,
    of each image is packed into 3D reciprocal space.
    An image is used in the reconstruction if its selection flag has been set.
    The fill value is taken from image's background value.

Definition at line 1042 of file Bimage_symmetry.cpp.

  Bimage * Bimage::find_template (Bimage * ptemp, Bimage * pmask, double hires, double lores, int bin, fft_plan planf, fft_plan planb)

Finds one or more matches to a template.

Parameters:
    *ptemp template image.
    *pmask reciprocal space mask.
    hires high resolution limit.
    lores low resolution limit.
    bin level of image binning.
    planf forward Fourier transform plan.
    planb backward Fourier transform plan.

Returns:
    Bimage* cross-correlation map.

    A template is cross-correlated with the input image including
    bandpass filtering to target the size of the template particle.

Definition at line 1175 of file Bimage_correlate.cpp.

  Vector3< double > Bimage::fit_peak ()

Fits an elliptic parabole to locate the position of the peak to sub-voxel resolution.

Returns:
    Vector3<double> shift from input origin.

    The peak is expected to be near the middle of the image, close to the input origin.
    The function fits a 10-parameter parabola to the image.
    The shift is retrieved from the parameters by matrix inversion.
    The refined peak returned is the offset from the input origin.

Definition at line 1423 of file Bimage_correlate.cpp.

  void Bimage::fix_type ()

Determines the replacement data type.

Returns:
    DataType replacement data type.

    An integer data type is switched between signed and unsigned.

Definition at line 1718 of file Bimage.cpp.

  FourierType Bimage::fourier_type () [inline]

Definition at line 367 of file Bimage.h.

  void Bimage::fourier_type (FourierType tf) [inline]

Definition at line 368 of file Bimage.h.

  int Bimage::friedel_apply ()

Applies Friedel symmetry.

Returns:
    int 0.

    The Friedel-related voxels are converted to polar form and the
    in difference in amplitude and phase calculated (taking into account
    the phases should differ by sign). The voxels are then set to the
    average and its conjugate.

Definition at line 1711 of file Bimage_fspace.cpp.

  double Bimage::friedel_check ()

Checks Friedel symmetry.

Returns:
    double overall RMSD or residual.

    The differences between the complex and polar forms of Friedel-related
    voxels are calculated and accumulated as squared sums weighted by their
    average intensities. The residuals are then calculated as
    root-mean-square-deviations.

Definition at line 1649 of file Bimage_fspace.cpp.

  Bplot * Bimage::fsc (double hi_res, double sampling_ratio = 1)

Definition at line 250 of file Bimage_resolution.cpp.

  Bplot * Bimage::fsc (Bimage * p, double hi_res, double sampling_ratio = 1)

Definition at line 330 of file Bimage_resolution.cpp.

  Bplot * Bimage::fsc_dpr (double hi_res, double sampling_ratio = 1, int flag = 0)

Calculates an FSC and DPR curves from two images.

Parameters:
    hi_res high resolution limit.
    sampling_ratio radial sampling ratio (1 for per voxel sampling).
    flag if 1 calculate only the FSC.

Returns:
    Bplot* FSC curve.

    FRC: Fourier ring/shell correlation
    -----------------------------------
    Saxton & Baumeister (1982) J. Microscopy 127, 127-138
    de la Fraga et al. (1995) Ultramicroscopy 60, 385-391
               sum(|F1|*|F2|)
    FRC/FSC = ---------------------------------
              sqrt( sum(|F1|^2) * sum(|F2|^2) )

Definition at line 92 of file Bimage_resolution.cpp.

  Bimage * Bimage::fsc_local (Bimage * p, Bimage * pmask, double hi_res, double * cutoff, int mask_level, int size, int pad, Vector3< long > vedge, int step = 1, int taper = 1, double fill = 0)

Determine the local resolution at each masked voxel in a map.

Author:
    Giovanni Cardone and Bernard Heymann

Parameters:
    *p second image.
    *pmask mask.
    hi_res high resolution limit.
    *cutoff correlation threshold(s).
    mask_level mask level index.
    size kernel size.
    pad padding factor.
    vedge edge size.
    step voxel step size.
    taper kernel tapering function.
    fill background fill value.

Returns:
    Bimage* local resolution image.

    For each voxel specified in the mask, within the edge limits, and at
    the step size given, two kernels are extracted from the two input maps.
    These kernels are then compared to determine the resolution based FSC.
    The resultant resolution value is then written into a new map.

Definition at line 597 of file Bimage_resolution.cpp.

  Bimage * Bimage::fsc_shell (Bimage * p, double hi_res, double * cutoff, int thickness, int step, int minrad, int maxrad, int pad = 1, int smooth = 0, double fill = 0)

Determine the resolution for each concentric shell in a map.

Parameters:
    *p second image.
    hi_res high resolution limit.
    *cutoff correlation threshold(s).
    thickness shell thickness.
    step step size between shells.
    minrad minimum radius.
    maxrad maximum radius.
    pad padding factor.
    smooth flag for edge smooting.
    fill background fill value.

Returns:
    Bimage* a 1D image containing the shell resolutions.

Definition at line 420 of file Bimage_resolution.cpp.

  int Bimage::fspace_2D_interpolate (Complex< float > cv, Vector3< double > m, double part_weight, int interp_type, Vector3< double > vscale)

Interpolates a 2D image for packing ito a 3D reciprocal space volume.

Parameters:
    cv complex value from 2D transform.
    m location in 3D relative to origin.
    part_weight weight to assign to value (usually 1).
    interp_type interpolation type (0=nearest neighbor, 1=weighted nearest neigbor, 2=trilinear).
    vscale scale of reconstruction and particle magnification.

Returns:
    int 0, <0 on error.

Definition at line 26 of file Bimage_reconstruct.cpp.

  int Bimage::fspace_amp_one ()

Sets all amplitudes to one.

Returns:
    int 0.

    If the image is a not a Fourier transform, it is transformed, modified,
    and backtransformed. If the image is a Fourier transform, it is just
    modified. The resultant image is floating point for real space or
    complex for reciprocal space.

Definition at line 326 of file Bimage_fspace.cpp.

  int Bimage::fspace_amp_threshold (double threshold)

Filters the amplitudes of the Fourier transform of an image.

Parameters:
    threshold Miminum amplitude to accept.

Returns:
    int 0.

    If the image is a not a Fourier transform, it is transformed, filtered,
    and backtransformed. If the image is a Fourier transform, it is just
    filtered. The filtering sets all amplitudes below the given threshold
    to zero. The resultant image is floating point for real space or
    complex for reciprocal space.

Definition at line 371 of file Bimage_fspace.cpp.

  int Bimage::fspace_background ()

Calculates the background for a Fourier transform.

Returns:
    int 0. The background is taken to be the area outside Nyquest.

Definition at line 49 of file Bimage_fspace.cpp.

  int Bimage::fspace_bandpass (double res_hi, double res_lo = 0, double width = 0)

Applies a bandpass filter to an image.

Parameters:
    res_hi high resolution limit.
    res_lo low resolution limit.
    width gaussian width of edge.

Returns:
    int 0.

    If the image is a not a Fourier transform, it is transformed, filtered,
    and backtransformed. If the image is a Fourier transform, it is just
    filtered. The filtering sets all values with frequencies above the
    given high resolution limit and below the given low resolution limit
    to zero.

Definition at line 499 of file Bimage_fspace.cpp.

  int Bimage::fspace_bandpass (double res_hi, double res_lo, double width, fft_plan planf, fft_plan planb)

Applies a bandpass filter to an image.

Parameters:
    res_hi high resolution limit.
    res_lo low resolution limit.
    width gaussian width of edge.
    planf forward Fourier transform plan.
    planb backward Fourier transform plan.

Returns:
    int 0.

    If the image is a not a Fourier transform, it is transformed, filtered,
    and backtransformed. If the image is a Fourier transform, it is just
    filtered. The filtering sets all values with frequencies above the
    given high resolution limit and below the given low resolution limit
    to zero.

Definition at line 528 of file Bimage_fspace.cpp.

  vector< double > Bimage::fspace_default_bands (double res_lo, double res_hi)

Sets up default frequency space bands to generate a mask.

Parameters:
    res_lo low resolution limit (angstrom).
    res_hi high resolution limit (angstrom).

Returns:
    vector<double> array of band specifications.

    The band argument is a list of pairs of values, each pair indicating
    a resolution shell (in angstrom) and a flag indicating whether the
    following shells should be:
        0: excluded - also the high resolution limit
        1: included in the FOM
        -1: included in the cross-validation FOM
    The high resolution limit for the mask is set in the image structure.

Definition at line 772 of file Bimage_mask.cpp.

  double Bimage::fspace_fit_B_factor (double res_hi = 0)

Determines the overall B-factor of an image.

Parameters:
    res_hi high resolution limit.

Returns:
    double B-factor.

    The input image must a real space image. A radial power spectrum
    is calculated and fitted to the linearized version of the function:
        f^2 = scale * F^2 * exp(-B_factor/2 * s^2)
    where:
        f:  scattering profile for carbon
        F:  radial average amplitude
        s:  reciprocal space distance
        scale:  arbitrary scale
    The linear form of the function is:
        4*(log(f) - log(F)) = 2*log(scale) - B * s^2

Definition at line 996 of file Bimage_fspace.cpp.

  Complex< double > Bimage::fspace_interpolate (long img_num, Vector3< double > m, FSI_Kernel * kernel)

Calculates the complex value at an image location by kernel-based interpolation.

Parameters:
    img_num sub-image number.
    m location in image.
    kernel interpolation kernel.

Returns:
    Complex<double> interpolated value. The kernel lookup table must be precalculated.

Definition at line 88 of file Bimage_fspace.cpp.

  long Bimage::fspace_maximum_radius (double resolution)

Calculates the maximum radius in frequency space from a given resolution.

Parameters:
    resolution high resolution limit.

Returns:
    long maximum radius.

    The maximum radius is either the physical image size divided by the resolution,
    or Nyquist frequency.

Definition at line 25 of file Bimage_fspace.cpp.

  int Bimage::fspace_normalize ()

Normalizes an image's amplitudes.

Returns:
    int 0.

Definition at line 1539 of file Bimage_fspace.cpp.

  int Bimage::fspace_normalize_radial (Bimage * pmask, double resolution = 0, int flag = 0)

Normalizes an image's amplitudes.

Parameters:
    *pmask reciprocal space mask (0 & 1, indicating inclusion of structure factors).
    resolution high resolution limit.
    flag flag to calculate power (0) or amplitude (1).

Returns:
    int 0.

Definition at line 1567 of file Bimage_fspace.cpp.

  int Bimage::fspace_pack_2D (Bimage * p, Matrix3 mat, double hi_res = 0, double lo_res = 0, double scale = 1, double part_weight = 1, int interp_type = 0)

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

Parameters:
    *p 2D particle image transform.
    mat rotation matrix.
    hi_res high resolution limit.
    lo_res low resolution limit (infinite if 0).
    scale scale of reconstruction and particle magnification.
    part_weight weight of particle (usually 1).
    interp_type interpolation type (0=nearest neighbor, 1=weighted nearest neigbor, 2=trilinear).

Returns:
    int 0, <0 on error.

    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 orientation parameters must be written
    into the image structure.

Definition at line 109 of file Bimage_reconstruct.cpp.

  int Bimage::fspace_pack_2D (Bimage * p, View asu_view, Bsymmetry * sym, double hi_res = 0, double lo_res = 0, double scale = 1, double part_weight = 1, int interp_type = 0)

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

Parameters:
    *p 2D particle image transform.
    asu_view view of asymmetric unit.
    *sym point group symmetry.
    hi_res high resolution limit.
    lo_res low resolution limit (infinite if 0).
    scale scale of reconstruction and particle magnification.
    part_weight weight of particle (usually 1).
    interp_type interpolation type (0=nearest neighbor, 1=weighted nearest neigbor, 2=trilinear).

Returns:
    int 0, <0 on error.

    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 orientation parameters must be written
    into the image structure.

Definition at line 180 of file Bimage_reconstruct.cpp.

  long Bimage::fspace_pack_2D_into_central_section (Bimage * p, long ft_size, double scale, double hi_res, double lo_res, Matrix3 matr, Matrix3 mat)

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

Parameters:
    *p 2D particle image transform.
    ft_size Fourier transform size.
    scale scale of reconstruction and particle magnification.
    hi_res high resolution limit.
    lo_res low resolution limit (infinite if 0).
    matr central section orientation matrix.
    mat image orientation matrix.

Returns:
    int 0, <0 on error.

    The rotation matrix is used to determine the plane in reciprocal space
    to which the 2D transform data is added in reference to the rotation
    matrix of the central section. The map is assumed to be cubic
    and the 2D transform square. The orientation parameters must be written
    into the image structure.

Definition at line 218 of file Bimage_reconstruct.cpp.

  int Bimage::fspace_pack_3D (Bimage * p, double hi_res = 0, double threshold = 0)

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

Parameters:
    *p 3D particle image transform.
    hi_res high resolution limit.
    threshold threshold to exclude low intensities.

Returns:
    int 0, <0 on error.

    The image is added up to the high resolution limit and excluding
    low intensities as defined by the threshold.

Definition at line 309 of file Bimage_reconstruct.cpp.

  int Bimage::fspace_positive ()

Sets the image to positive definite.

Returns:
    int 0. Scales the amplitudes to give a zero (DC) value of one.

Definition at line 1608 of file Bimage_fspace.cpp.

  double * Bimage::fspace_radial (long nn, long maxrad, int flag = 0)

Calculates the radial power spectrum from a Fourier transform.

Parameters:
    nn sub-image number.
    maxrad maximum radius (i.e., high resolution limit).
    flag flag to calculate power (0) or amplitude (1).

Returns:
    double* radial power spectrum in the form of a 1D image.

A radial average of a 2D or 3D Fourier transform is calculated. An interpolative method is used where the value of a voxel is distributed between the two nearest radial annuli. The final sum in an annulus is normalized by the number of voxels contributing to the annulus sum.

Definition at line 734 of file Bimage_fspace.cpp.

  Bimage * Bimage::fspace_radial_power (double resolution)

Calculates the radial power spectrum from a Fourier transform.

Parameters:
    resolution high resolution limit.

Returns:
    Bimage* radial power spectrum in the form of a 1D image.

    A radial average of a 2D or 3D Fourier transform is calculated.
    An interpolative method is used where the value of
    a voxel is distributed between the two nearest radial annuli.
    The final sum in an annulus is normalized by the number of voxels
    contributing to the annulus sum.

Definition at line 612 of file Bimage_fspace.cpp.

  long Bimage::fspace_reconstruction_add (Bimage * p)

Adds all components to a reconstruction.

Parameters:
    *p frequency space reconstruction to add.

Returns:
    long 0.

    The FOM block contains the sum of powers, the next image conatins the
    weight sum, and the next image FOM block contains the sum of the
    weight squared.

Definition at line 384 of file Bimage_reconstruct.cpp.

  long Bimage::fspace_reconstruction_snr ()

Calculates the SNR map.

Returns:
    long coverage.

    The FOM block contains the sum of powers, the next image conatins the
    weight sum, and the next image FOM block contains the sum of the
    weight squared.

Definition at line 529 of file Bimage_reconstruct.cpp.

  int Bimage::fspace_reconstruction_stats (double resolution)

Calculates Fourier shell statistics.

Parameters:
    resolution high resolution limit.

Returns:
    int 0.

    The average FOM and number of FOM values in each resolution shell is determined.

Definition at line 451 of file Bimage_reconstruct.cpp.

  int Bimage::fspace_reconstruction_stats2 (double resolution)

  long Bimage::fspace_reconstruction_weigh ()

Weighs a reconstruction.

Returns:
    long coverage.

    The FOM block contains the sum of powers, the next image conatins the
    weight sum, and the next image FOM block contains the sum of the
    weight squared.

Definition at line 412 of file Bimage_reconstruct.cpp.

  int Bimage::fspace_resize (double scale, double res_hi, double res_lo)

Resizes an image in frequency space to avoid interpolation.

Parameters:
    scale isotropic scaling.
    res_hi high resolution limit.
    res_lo low resolution limit.

Returns:
    int 0.

Definition at line 205 of file Bimage_fspace.cpp.

  Bimage * Bimage::fspace_resize (Bimage * pref)

Resizes an image in frequency space to avoid interpolation.

Parameters:
    pref reference.

Returns:
    Bimage* resized image. The image is first resized to approximate the real size of the reference map.

Definition at line 256 of file Bimage_fspace.cpp.

  int Bimage::fspace_scale (long maxrad, double * scale, Bimage * pmask = NULL)

Definition at line 844 of file Bimage_fspace.cpp.

  int Bimage::fspace_scale (long nn, long maxrad, double * scale, Bimage * pmask = NULL)

Definition at line 862 of file Bimage_fspace.cpp.

  int Bimage::fspace_scale (vector< double > & scale, Bimage * pmask = NULL)

Definition at line 911 of file Bimage_fspace.cpp.

  int Bimage::fspace_scale (long nn, vector< double > & scale, Bimage * pmask = NULL)

Definition at line 929 of file Bimage_fspace.cpp.

  int Bimage::fspace_sqrt_amp ()

Change the amlitudes to their square roots.

Returns:
    int 0.

Definition at line 427 of file Bimage_fspace.cpp.

  int Bimage::fspace_square_amp ()

Change the amlitudes to their squares.

Returns:
    int 0.

Definition at line 458 of file Bimage_fspace.cpp.

  int Bimage::fspace_translate (Vector3< double > shift)

Translates an image in frequency space to avoid interpolation.

Parameters:
    shift 3-value real space shift vector.

Returns:
    int error code.

Definition at line 150 of file Bimage_fspace.cpp.

  int Bimage::fspace_translate (long nn, Vector3< double > shift)

Translates an image in frequency space to avoid interpolation.

Parameters:
    nn sub-image to transform.
    shift 3-value real space shift vector.

Returns:
    int 0.

Definition at line 178 of file Bimage_fspace.cpp.

  int Bimage::fspace_weigh (long maxrad, double * curve, int flag = 0)

Definition at line 797 of file Bimage_fspace.cpp.

  int Bimage::fspace_weigh (vector< double > & curve, int flag = 0)

Definition at line 820 of file Bimage_fspace.cpp.

  int Bimage::fspace_weigh (Bimage * pref, Bimage * pmask, double resolution = 0)

Weighs an image's amplitudes with the radial power spectrum of another.

Parameters:
    *pref reference image.
    *pmask reciprocal space mask (0 & 1, indicating inclusion of structure factors).
    resolution high resolution limit.

Returns:
    int 0.

    The two images must be of the same dimensions.
    The radial power spectra of the two images are calculated
    and used to calculate the ratio of the second to the first in each shell.
    This ratio is then used to rescale the amplitudes of the first image.

Definition at line 1490 of file Bimage_fspace.cpp.

  int Bimage::fspace_weigh_B_factor (double B, double resolution = 0)

Weighs an image's amplitudes with B-factor (gaussian) curve.

Parameters:
    B B factor.
    resolution high resolution limit.

Returns:
    int 0.

    The image is Fourier transformed and weighed with a gaussian curve:
        Fnew = F*exp(-B*s2/4)

Definition at line 1185 of file Bimage_fspace.cpp.

  int Bimage::fspace_weigh_C_curve (double resolution = 0)

Weighs an image's amplitudes with the carbon scattering curve.

Parameters:
    resolution high resolution limit.

Returns:
    int 0.

    The image is Fourier transformed and the radial power spectrum calculated.
    The ratio between the C curve and the average amplitudes in each shell
    is calculated and used to rescale the amplitudes of the image.

Definition at line 1228 of file Bimage_fspace.cpp.

  int Bimage::fspace_weigh_dose (long nn, double dose_per_frame, vector< double > critdose)

Definition at line 1398 of file Bimage_fspace.cpp.

  int Bimage::fspace_weigh_dose (double dose_per_frame)

Weighs an image's amplitudes with the accumulated dose.

Parameters:
    dose_per_frame electron dose per frame.

Returns:
    int 0.

    The image is Fourier transformed and the amplitudes weighed using
    the formula of Grant and Grigorieff (2015).

Definition at line 1433 of file Bimage_fspace.cpp.

  int Bimage::fspace_weigh_FSC_curve (Bplot * plot, double resolution = 0)

Weighs an image's amplitudes with a given FSC curve.

Parameters:
    *plot FSC plot.
    resolution high resolution limit.

Returns:
    int 0.

    The image is Fourier transformed and the radial power spectrum calculated.
    The ratio between the square root of the FSC curve and the average
    amplitudes in each shell is calculated and used to rescale the amplitudes
    of the image.

Definition at line 1367 of file Bimage_fspace.cpp.

  int Bimage::fspace_weigh_LoG (double resolution, double sigma)

Weighs an image's amplitudes with a Laplacian-of-Gaussian function.

Parameters:
    resolution high resolution limit.
    sigma gaussian sigma.

Returns:
    int 0.

    The image is Fourier transformed and the radial power spectrum calculated.
    The ratio between the C curve and the average amplitudes in each shell
    is calculated and used to rescale the amplitudes of the image.

Definition at line 1263 of file Bimage_fspace.cpp.

  int Bimage::fspace_weigh_ramp (double resolution, fft_plan planf, fft_plan planb)

Weighs a transform with a ramp.

Parameters:
    resolution high resolution limit.
    planf 2D forward Fourier transform plan.
    planb 2D backward Fourier transform plan.

Returns:
    int 0.

    Requirements:
        The data must be complex float and the FOM block must be allocated.

Definition at line 1064 of file Bimage_fspace.cpp.

  int Bimage::fspace_weigh_ramp (double resolution, double axis, fft_plan planf, fft_plan planb)

Weighs a transform with a ramp.

Parameters:
    resolution high resolution limit.
    axis tilt axis for single tilt series (radians).
    planf 2D forward Fourier transform plan.
    planb 2D backward Fourier transform plan.

Returns:
    int 0.

    Requirements:
        The data must be complex float and the FOM block must be allocated.

Definition at line 1126 of file Bimage_fspace.cpp.

  int Bimage::fspace_weigh_RPS_curve (Bplot * plot, double resolution = 0)

Weighs an image's amplitudes with a given RPS curve.

Parameters:
    *plot RPS plot.
    resolution high resolution limit.

Returns:
    int 0.

    The image is Fourier transformed and the radial power spectrum calculated.
    The ratio between the square root of the RPS curve and the average
    amplitudes in each shell is calculated and used to rescale the amplitudes
    of the image.

Definition at line 1310 of file Bimage_fspace.cpp.

  int Bimage::gaussian_sphere (long nn, Vector3< double > center, double sigma, double amp)

Fills a gaussian sphere within an image with a uniform value.

Parameters:
    nn sub-image.
    center center of sphere.
    sigma Gaussian sigma value.
    amp amplitude.

Returns:
    int 0.

    All voxels within a sphere at a given location and with a given radius
    are increased by a given fill value.
    The new data replaces the old data.
    The default center is {0,0,0}.

Definition at line 492 of file Bimage_edit.cpp.

  double Bimage::get (long nn, long xx, long yy, long zz, long cc = 0)

Returns the data value at the given coordinates.

Parameters:
    nn image index.
    xx x coordinate.
    yy y coordinate.
    zz z coordinate.
    cc channel index.

Returns:
    double value.

    The elemental data value is returned in double precision.

Definition at line 937 of file Bimage.cpp.

  double Bimage::get (long nn, Vector3< double > vox, long cc = 0)

Returns the data value at the given coordinates.

Parameters:
    nn image index.
    vox voxel coordinates.
    cc channel index.

Returns:
    double value.

    The elemental data value is returned in double precision.

Definition at line 959 of file Bimage.cpp.

  void Bimage::get (Bstring tag)

Prints out header information associated with a tag string.

Parameters:
    tag tag string.

Definition at line 2671 of file Bimage.cpp.

  tm* Bimage::get_localtime () [inline]

Definition at line 245 of file Bimage.h.

  time_t Bimage::get_time () [inline]

Definition at line 241 of file Bimage.h.

  int Bimage::gradient_correction ()

Calculates and corrects for a linear gradient across an image.

Returns:
    int 0.

    The linear gradient across an image is calculated as:
        density(x,y,z) = b0 + b1*x + b2*y + b3*z
    The image is converted to floating point and corrected for the gradient.

Definition at line 752 of file Bimage_rescale.cpp.

  Bimage * Bimage::graph_segment (int type = 1, Bimage * pmask = NULL, int connect_type = 0, double complexity = 0, long min_size = 0, int return_type = 0)

Graph-based segmentation of an image.

Parameters:
    type segmentation type: 1=threshold, 2=statistical region merging.
    *pmask mask to limit areas for segmentation.
    connect_type connection type: 0=direct neighbors, 1=all neighbors.
    complexity a value determining the number of segments.
    min_size minimum segment size.
    return_type 1=indexed segments, 2=average-imposed segments.

Returns:
    long number of segments.

    An array of edges between neighboring voxels is set up and sorted in
    non-decreasing order. The voxels are then aggregated into regions based
    on two selectable criteria:
    simple      edge difference with adjustable threshold.
    srm         statistical region merging.
    Regions below a given cutoff size are merged.
    Only the first sub-image is segmented.
    IEEE Trans. Pattern Anal. Mach. Intell. 26(11): 1452-1458 (2004)

     Reference: R. Nock, F. Nielsen: Statistical Region Merging.

Definition at line 1383 of file Bimage_segment.cpp.

  int Bimage::hanning_taper (double fill = 0)

Apply Hanning taper window to the image.

Parameters:
    fill value of edge voxels.

Returns:
    int 0.

    Along each dimension, the image is multiplied with a function:
        v_new(i) = fill + ( v_old(i) - fill )* 0.5 * ( 1 - cos( 2*PI*i/(n-1) )) i=0,...,n-1
    where   fill is the desired edge value.
            n is the size of the image

Definition at line 386 of file Bimage_edit.cpp.

  Bimage * Bimage::height (View * views, double threshold = 0)

Calculates a set of height images from a 3D density map.

Parameters:
    *views linked list of views.
    threshold density threshold to consider as object.

Returns:
    Bimage* 2D height images as sub-images.

    A set of height images is calculated according to a list of views.

Definition at line 230 of file Bimage_topo.cpp.

  Bimage * Bimage::helical_cross_section (double helix_rise, double helix_angle, double scale, double hires)

Calculates a helical cross section from line transforms of a filament.

Parameters:
    helix_rise helical subunit rise in angstrom.
    helix_angle helical subunit rotation in radians.
    scale scale of cross section.
    hires high resolution limit.

Returns:
    Bimage* 2D cross section image.

    The filament image must be oriented with the helical axis coinciding with
    the y axis. Each row of pixels is transformed and written into a
    2D transform based on an orientation calculated from given helical
    parameters.

Definition at line 1356 of file Bimage_helix.cpp.

  double Bimage::helix_interpolate (long i, double helix_rise, double helix_angle, int zmin, int zmax, double radius, int norm_flag = 1)

Definition at line 18 of file Bimage_helix.cpp.

  Bplot * Bimage::helix_segment_correlation (int thickness, double angle_start, double angle_end, double angle_step, int bin, double hires, double lores, double radius)

Calculates the correlation over rotation angles between helical segments.

Parameters:
    thickness segment thickness.
    angle_start start value for angle.
    angle_end end value for angle.
    angle_step step size for angle.
    bin bin image for faster searching (limited to 1,2,3).
    hires high resolution limit in angstroms.
    lores low resolution limit in angstroms.
    radius radius for mask (voxels).

Returns:
    Bplot* plot with coefficients over all rotations results.

    The image is split up into segments in the z direction. Every adjacent pair
    of segments are cross-correlated over an angular range to find the best
    rotation. The cross-correlation can be resolution-limited. The image may
    also be masked beyond a radius and binned to speed up execution.

Definition at line 1175 of file Bimage_helix.cpp.

  int Bimage::helix_segment_correlation_one (long i, double angle_start, double angle_end, double angle_step, int bin, double hires, double lores, double radius, fft_plan planf, fft_plan planb, double * cc)

Definition at line 1133 of file Bimage_helix.cpp.

  double Bimage::helix_symmetrize (double helix_rise, double helix_angle, int dyad_axis, int zmin, int zmax, double radius, int norm_flag = 1)

Symmetrizes an image given helical symmetry parameters.

Parameters:
    helix_rise rise per asymmetric unit (angstrom).
    helix_angle rotation angle per asymmetric unit (radians).
    dyad_axis dyad axis indicator: 2=dyad axis on x-axis, otherwise none.
    zmin mimimum z slice to include.
    zmax maximum z slice to include.
    radius radius to do symmetrizing over (pixels).
    norm_flag if 1, normalize

Returns:
    double R factor.

    The data between the z limits are replicated along the helical axis
    according to the helical rise and rotation to fill the new volume.

Definition at line 133 of file Bimage_helix.cpp.

  long * Bimage::histogram (long bins, double & scale, double & offset)

Calculates the histogram of an image.

Parameters:
    bins number of bins in the histogram.
    &scale scale.
    &offset offset.

Returns:
    long* histogram.

    A histogram of an image is calculated with a given number of bins.
    Multiple channels are output as successive one-dimensional arrays.
    The image data is not affected.
    The statistics for the input image must be correctly calculated.

Definition at line 32 of file Bimage_histogram.cpp.

  Bplot * Bimage::histogram (long bins)

Calculates the histogram of an image.

Parameters:
    bins number of bins in the histogram.

Returns:
    Bplot* 0.

    A histogram of an image is calculated with a given number of bins.
    Multiple channels are output as successive one-dimensional arrays.
    The image data is not affected.
    The statistics for the input image must be correctly calculated.
    If the postscript file name is given, a postscript plot is produced.

Definition at line 78 of file Bimage_histogram.cpp.

  Bplot * Bimage::histogram_counts (int flags = 0)

Finds the peaks in a quantized image from the histogram.

Parameters:
    flags 1=plot, 2=convert image.

Returns:
    Bplot* plot of fits.

    A histogram of an image with quantized data is calculated.
    The peaks are determined and the image converted.

Definition at line 206 of file Bimage_histogram.cpp.

  vector< double > Bimage::histogram_gauss_fit (long bins, long ngauss = 1)

Fits a gaussian function to a histogram of an image.

Parameters:
    bins number of bins in the histogram.
    ngauss number of gaussians.

Returns:
    vector<double> array with 3 values for each gaussian.

    A histogram of an image is calculated with a given number of bins.
    The return has (in order) the gaussian amplitude, the offset, and the sigma value.

Definition at line 583 of file Bimage_histogram.cpp.

  Bplot * Bimage::histogram_gauss_plot (long bins, long ngauss = 1)

Fits a gaussian function to a histogram of an image.

Parameters:
    bins number of bins in the histogram.
    ngauss number of gaussians.

Returns:
    Bplot* plot of the histogram and the gaussian fit.

    A histogram of an image is calculated with a given number of bins.

Definition at line 695 of file Bimage_histogram.cpp.

  Bplot * Bimage::histogram_poisson_fit (long bins, int flag = 0)

Fits a poisson function to a histogram of an image.

Parameters:
    bins number of bins in the histogram.
    flag 1=plot.

Returns:
    Bplot* plot of the histogram and the poisson fit.

    A histogram of an image is calculated with a given number of bins.
    The histogram is fit to the Poisson function:
                   lambda * exp(-lambda)
        f(x) = Amp ---------------------
                            x!
    by first converting it to a linear form:
        ln(f(x)) = ln(Amp) + x*ln(lambda) - lambda - lgamma(x+1)
    and then using the downhill simplex method to find the solution.

Definition at line 965 of file Bimage_histogram.cpp.

  int Bimage::histogram_thresholds (double & tmin, double & tmax)

Calculates minimum and maximum thresholds for truncation.

Parameters:
    &tmin minumum threshold.
    &tmax maxumum threshold.

Returns:
    int 0.

    A histogram of an image is calculated.  The first minimum in the first
    quarter of the histogram and the last minimum in the last quarter
    are taken to define the small and large outliers.

Definition at line 414 of file Bimage_histogram.cpp.

  int Bimage::histomatch (Bimage * p, long bins)

Fits two images by matching the histogram of the second to the first.

Parameters:
    *p second image.
    bins number of bins in the histograms.

Returns:
    int 0, <0 if error.

    Both images are converted to floating point.

Definition at line 614 of file Bimage_combine.cpp.

  void Bimage::identifier (Bstring s) [inline]

Definition at line 216 of file Bimage.h.

  Bstring& Bimage::identifier () [inline]

Definition at line 217 of file Bimage.h.

  long Bimage::image_size () [inline]

Definition at line 267 of file Bimage.h.

  long Bimage::images () [inline]

Definition at line 491 of file Bimage.h.

  void Bimage::images (long nn)

Definition at line 297 of file Bimage.cpp.

  int Bimage::images_to_slices ()

Changes the 2D images to slices in a 3D image.

Returns:
    int error code (<0 means failure).

Definition at line 2093 of file Bimage.cpp.

  int Bimage::impose_superpixels (Bimage * pmask, vector< Bsuperpixel > & seg, int impose)

Impose superpixel features onto an image.

Parameters:
    *pmask mask defining superpixels.
    seg array of superpixels.
    impose flag to select feature

Returns:
    0 .

    Features to select:
    0   none
    1   segment average
    2   lowest neighboring segment
    3   difference from lowest neighbor
    4   higest neigboring segment
    5   difference from highest neighbor

Definition at line 1872 of file Bimage_segment.cpp.

  long Bimage::index (long nx, long ny) const [inline]

Definition at line 383 of file Bimage.h.

  long Bimage::index (long nx, long ny, long nz) const [inline]

Definition at line 386 of file Bimage.h.

  long Bimage::index (long nx, long ny, long nz, long nn) const [inline]

Definition at line 389 of file Bimage.h.

  long Bimage::index (long nc, long nx, long ny, long nz, long nn) const [inline]

Definition at line 392 of file Bimage.h.

  long Bimage::index (Vector3< long > vox, long nn) const [inline]

Definition at line 395 of file Bimage.h.

  long Bimage::index (vector< long > vox, long nn) const [inline]

Definition at line 398 of file Bimage.h.

  long Bimage::index_wrap (long nx, long ny, long nz) const [inline]

Definition at line 401 of file Bimage.h.

  long Bimage::index_wrap (Vector3< long > coor) const [inline]

Definition at line 410 of file Bimage.h.

  long Bimage::index_wrap (vector< long > coor) const [inline]

Definition at line 413 of file Bimage.h.

  int Bimage::information ()

Prints out header information for an image.

Returns:
    int error code (<0 means failure).

Definition at line 2489 of file Bimage.cpp.

  int Bimage::integer_interpolation (int integer_factor)

Definition at line 16 of file Bimage_bin.cpp.

  int Bimage::integer_interpolation (int integer_factor, int odd)

Interpolates by an integer scale with a density-preserving overlapping kernel.

Parameters:
    integer_factor integer interpolation factor.
    odd flag to ensure the dimensions are odd.

Returns:
    int 0.

    An image is interpolated by integer scaling (i.e., 2, 3, 4-fold or
    more) sometimes referred to as a form of binning.  A kernel is used
    such that it overlaps with its neighbouring positions.  Voxels where
    neighbouring kernel positions overlap contribute to 2, 4 or 8 new
    voxels based on the number of overlapping kernel positions.  Only
    the central voxel is unique to a kernel position.  The kernel is
    calculated as:
        w(i,j,k) = (1/s^2n)*(s-|s-1-i|)*(s-|s-1-j|)*(s-|s-1-k|)
    where   s is the integer interpolation factor.
            n is the number of dimensions (1D, 2D or 3D).
    The flag determines whether the dimensions are forced to be even or odd:
        0       No forcing
        1       x odd
        2       x even
        4       y odd
        8       y even
        16      z odd
        32      z even
        21      all odd
        42      all even
    and any other combination.

Definition at line 50 of file Bimage_bin.cpp.

  Bimage * Bimage::intensities_phase_colored (double scale)

Generates a power spectrum with phases colored according to a color wheel.

Parameters:
    scale amplitude scaling.

Returns:
    Bimage* color power spectrum.

    A polar data type image (such as a Fourier transform) is converted
    to indicate the phases as colors. The primary colors are located
    0 degrees (red), 120 degrees (green) and -120 degrees (blue). All
    three color values are down-weighted based on the amplitude. The
    weighting is calculated as:
        weight = amplitude/(average+2*standard_deviation)
    The origin specified in the image is used to shift the phases.
    The scale is multiplied with the amplitude and cut off at one
    to give the user the ability to enhance the image.
    Default:
        scale = 1/(average_amplitude + standard_deviation_of_amplitude)

Definition at line 1358 of file Bimage_complex.cpp.

  double Bimage::internal_volume (double threshold, int mask_out_freq)

Calculates the internal volume of a shell.

Parameters:
    threshold threshold to define density.
    mask_out_freq mask output frequency.

Returns:
    double internal volume in Å3.

Definition at line 950 of file Bimage_segment.cpp.

  double Bimage::interpolate (long cc, double xx, double yy = 0, double zz = 0, long nn = 0, double fill = 0) const

Interpolates using a given location.

Parameters:
    cc channel.
    xx x location.
    yy y location.
    zz z location.
    nn image number.
    fill fill value if outside boundaries.

Returns:
    double interpolated value.

    Trilinear interpolation.

Definition at line 1392 of file Bimage.cpp.

  double Bimage::interpolate (double xx, double yy = 0, double zz = 0, long nn = 0, double fill = 0) const [inline]

Definition at line 319 of file Bimage.h.

  double Bimage::interpolate (long cc, Vector3< double > vec, long nn = 0, double fill = 0) const [inline]

Definition at line 323 of file Bimage.h.

  double Bimage::interpolate (Vector3< double > vec, long nn = 0, double fill = 0) const [inline]

Definition at line 327 of file Bimage.h.

  double Bimage::interpolate (vector< double > vec, long nn = 0, double fill = 0) const [inline]

Definition at line 331 of file Bimage.h.

  int Bimage::interpolate_gaps (long step)

Interpolate the voxels that are not calculated.

Parameters:
    step step increment for voxels with proper values.

Returns:
    int 0, <0 if error.

    Sparse voxels calculated on a regular grid with the given step size are
    used to fill intermediate voxels with linearly interpolated values.

Definition at line 931 of file Bimage_edit.cpp.

  double Bimage::interpolate_wrap (long cc, double xx, double yy = 0, double zz = 0, long nn = 0) const

Interpolates using a given location with wrapping.

Parameters:
    cc channel.
    xx x location.
    yy y location.
    zz z location.
    nn image number.

Returns:
    double interpolated value.

    Trilinear interpolation with wrapping around periodic image boundaries.

Definition at line 1502 of file Bimage.cpp.

  double Bimage::interpolate_wrap (double xx, double yy = 0, double zz = 0, long nn = 0) const [inline]

Definition at line 337 of file Bimage.h.

  double Bimage::interpolate_wrap (long cc, Vector3< double > vec, long nn = 0) const [inline]

Definition at line 341 of file Bimage.h.

  double Bimage::interpolate_wrap (Vector3< double > vec, long nn = 0) const [inline]

Definition at line 345 of file Bimage.h.

  void Bimage::inverse (double minval = 0)

Calculates the inverse of the image.

Parameters:
    minval the minimum absolute value considered not zero.

    The inverse of every pixel is calculated.
    If the minumum value is given as zero, zero pixels are retained.

Definition at line 3682 of file Bimage.cpp.

  void Bimage::invert ()

Inverts the data in the image.

The Bit data type is negated.
An unsigned data type is subtracted from its type maximum.
A signed data type is negated.

Definition at line 3108 of file Bimage.cpp.

  int Bimage::kernel_gaussian (double sigma, double max)

Generates a gaussian kernel image.

Parameters:
    sigma gaussian width.
    max kernel maximum.

Returns:
    int 0.

Definition at line 34 of file Bimage_filter.cpp.

  Vector3<long> Bimage::kernel_high (long i, long k = 1) [inline]

Definition at line 463 of file Bimage.h.

  Vector3<long> Bimage::kernel_high (long i, Vector3< long > k) [inline]

Definition at line 473 of file Bimage.h.

  int Bimage::kernel_laplacian_of_gaussian (double sigma, double max)

Generates a laplacian-of-gaussian kernel.

Parameters:
    sigma gaussian width.
    max kernel maximum.

Returns:
    Bimage* kernel image.

Definition at line 77 of file Bimage_filter.cpp.

  Vector3<long> Bimage::kernel_low (long i, long k = 1) [inline]

Definition at line 457 of file Bimage.h.

  Vector3<long> Bimage::kernel_low (long i, Vector3< long > k) [inline]

Definition at line 467 of file Bimage.h.

  long Bimage::kernel_max (long idx, long ksize)

Finds the highest value in a kernel.

Parameters:
    idx index in multi-image.
    ksize kernel edge half size

Returns:
    long index of highest value.

Definition at line 2897 of file Bimage.cpp.

  long Bimage::kernel_max_neigbor (long idx, long ksize)

Finds the highest value in a kernel excluding the central voxel.

Parameters:
    idx index in multi-image.
    ksize kernel edge half size

Returns:
    long index of highest value.

Definition at line 2929 of file Bimage.cpp.

  long Bimage::kernel_max_wrap (long idx, long ksize)

Finds the highest value in a kernel with wrapping.

Parameters:
    idx index in multi-image.
    ksize kernel edge half size

Returns:
    long index of highest value.

Definition at line 2963 of file Bimage.cpp.

  Bimage * Bimage::kmeans_segment (long nregion = 2, double ratio = 1)

Segments an image based on K-means.

Parameters:
    nregion number of regions.
    ratio balance between density and distance.

Returns:
    Bimage* segmentation mask.

    The metric to choose region membership is based on the minimum of:
        d = |<c>-c|/s + r|<v>-v|
    for:
        c:      coordinates
        <c>:    region average coordinates.
        s:      image size.
        v:      density.
        <v>:    region average density.
        r:      ratio.

Definition at line 1067 of file Bimage_segment.cpp.

  void Bimage::label (string s) [inline]

Definition at line 235 of file Bimage.h.

  string& Bimage::label () [inline]

Definition at line 236 of file Bimage.h.

  void Bimage::largest (Bimage * p)

Selects the largest of each pixel from two images.

Parameters:
    *p other image.

Definition at line 3706 of file Bimage.cpp.

  Bimage * Bimage::level_mask_extract (Bimage * pmask)

Extracts all the regions associated with a multi-level mask.

Parameters:
    *pmask multi-level mask map.

Returns:
    Bimage* image with excised regions.

    The feature index is found in a feature map and the corresponding voxels
    in the density maps are extracted.
    An image is assumed to have density represented by higher (white) values.

Definition at line 1785 of file Bimage_mask.cpp.

  long Bimage::levelmask_add (Bimage * pmask, int add_level = 1)

Adds a bilevel mask to a level mask.

Parameters:
    pmask bilevel mask to add.
    add_level the level index to add.

Returns:
    long number of selected regions.

    Where the bilevel mask is one, the level mask is set to given level value.

Definition at line 1541 of file Bimage_mask.cpp.

  Bimage * Bimage::levelmask_asymmetric_units (Bsymmetry * sym, int index)

Calculates a multi-level mask to indicate asymmetric units.

Parameters:
    *sym symmetry structure.
    index asu index (<1 means all).

Returns:
    Bimage* multi-level mask.

    A reference view for each point group is generated such that it is
    located close to the center of the canonical asymmetric unit.
    A set of symmetry-related reference views are then generated from
    the original reference.
    The distance of each voxel is then calculated to each reference
    view, and assigned to asymmetric unit with the closest reference view.
    If the given index is larger than one, a mask is generated only for the
    asymmetric unit with that index.

Definition at line 898 of file Bimage_symmetry.cpp.

  double Bimage::levelmask_average_region_size ()

Calculates the average size of regions in a level mask.

Returns:
    double average feature size.

Definition at line 1809 of file Bimage_mask.cpp.

  long Bimage::levelmask_clean ()

Removes empty levels from a multi-level mask.

Returns:
    long 0.

    The mask is converted to an integer mask.

Definition at line 1849 of file Bimage_mask.cpp.

  long Bimage::levelmask_collapse ()

Collapse a multi-level mask to a binary mask.

Returns:
    long number of voxels retained.

    All non-zero segments are converted to ones.

Definition at line 1503 of file Bimage_mask.cpp.

  Bimage * Bimage::levelmask_color_by_size ()

Color a multi-level mask based on the volumes of regions.

Returns:
    Bimage* new colored image.

Definition at line 1924 of file Bimage_mask.cpp.

  long Bimage::levelmask_colorize ()

Colorizes a multi-level mask with random color assignments.

Returns:
    long number of levels.

    A lookup table (LUT) is calculated for the range of gray-scale values
    and random colors assigned to each value.
    The image is then converted to RGB using the LUT.

Definition at line 1887 of file Bimage_mask.cpp.

  long Bimage::levelmask_dilate (int times)

Dilates a level mask.

Parameters:
    times number of dilation operations.

Returns:
    long 0.

    Traditional 3^dim kernel dilation.  Any pixel with a value of 1 turns
    all of its neighbors to a value of 1.

Definition at line 1565 of file Bimage_mask.cpp.

  long Bimage::levelmask_dilate ()

Dilates a level mask.

Returns:
    long 0.

    Traditional 3^dim kernel dilation.  Any pixel with a value of 1 turns
    all of its neighbors to a value of 1.

Definition at line 1583 of file Bimage_mask.cpp.

  int Bimage::levelmask_region_size ()

Convert a mask to reflect region sizes.

Returns:
    int 0.

Definition at line 1981 of file Bimage_mask.cpp.

  long Bimage::levelmask_select (Bstring & select_list)

Retains the selected levels in a multi-level mask.

Parameters:
    &select_list comma_separated list of levels to select.

Returns:
    long number of voxels retained.

    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 1650 of file Bimage_mask.cpp.

  long Bimage::levelmask_select (long nn, Vector3< long > voxel)

Retains the selected levels in a multi-level mask.

Parameters:
    nn image number.
    voxel voxel with level to select.

Returns:
    long number of voxels retained.

    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 1698 of file Bimage_mask.cpp.

  long Bimage::levelmask_select (Bimage * pmask)

Selects regions overlapping a mask.

Parameters:
    pmask overlap template mask.

Returns:
    long number of selected regions.

    The input mask can be of any form. All non-zero parts of this mask is used.

Definition at line 1733 of file Bimage_mask.cpp.

  Bplot * Bimage::levelmask_size_histogram ()

Color a multi-level mask based on the volumes of regions.

Returns:
    Bplot* region size histogram.

Definition at line 2018 of file Bimage_mask.cpp.

  int Bimage::limit_levels (int nlevels)

Converts a full gray scale image to a limited level image.

Parameters:
    nlevels number of levels.

Returns:
    int 0.

    The dynamic range of the image is decreased to a given number of gray
    scale levels.
    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 426 of file Bimage_rescale.cpp.

  int Bimage::line_powerspectra (fft_plan plan)

Calculates the 1D power spectrum of each line in an image.

Parameters:
    plan fft plan.

Returns:
    int 0.

    Each line is transformed to a power spectrum in place.

Definition at line 741 of file Bimage_polar.cpp.

  double Bimage::linear_fit (Bimage * p, Bimage * pmask, double max_exclude)

Linear least squares fit of two images.

Parameters:
    *p second image.
    *pmask mask to limit calculation to a certain region.
    max_exclude maximum percentage of outlying points to exclude.

Returns:
    double first R factor.

    The data blocks from two images are fit by a simple linear least squares
    regression algorithm with exclusion of a percentage of outliers:
        image2 = intercept + slope * image1
    The first image is modified to return the difference:
        difference = intercept + slope * image1 - image2
    The residual returned is:
        R = sqrt(sum(difference^2) / sum((image2-avg2)^2))
    Note: A linear fit is not symmetric with respect to the two input
    data sets - the order of the input images determine the output.
    The two data blocks must have the same size and are converted to
    floating point.

Definition at line 476 of file Bimage_combine.cpp.

  Bimage * Bimage::local_filter (Bimage * pmask, int mask_level, Bimage * resmap, int size, Vector3< long > vedge)

Applies a local resolution filter to a map.

Author:
    Giovanni Cardone and Bernard Heymann

Parameters:
    *pmask mask of areas to generate.
    mask_level mask level.
    *resmap local resolution map.
    size kernel size.
    vedge edge size.

Returns:
    Bimage* filtered image, NULL on error.

    At each voxel, a kernel/small box is extracted and lowpass filtered
    to the resolution limit for that voxel in the local resolution map.
    A mask may be used to limit the region of application.

Definition at line 787 of file Bimage_resolution.cpp.

  void Bimage::logarithm ()

Calculates the logarithm of the image data.

Returns:
    int 0.

    The image is first converted to floating point, or complex floating point
    for complex data. The logarithm is calculated to ensure that the whole
    range of values are included and that the average is at zero:
                       data - min + fudge
        new_data = log ------------------
                       avg - min + fudge
    where:
        fudge = (avg - min) / 1000
    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 728 of file Bimage_rescale.cpp.

  long Bimage::mask (Bimage * pmask, double fill)

Masks an image.

Author:
    Samuel Payne

Parameters:
    *pmask binary mask.
    fill value to use where mask is zero.

Returns:
    long 0.

    If the mask value for that pixel is 0, the image pixel is changed
    to the fill value.  Otherwise it is left alone.

Definition at line 26 of file Bimage_mask.cpp.

  Bimage * Bimage::mask_by_threshold (double threshold)

Generates a mask based on an image at a given threshold.

Author:
    Samuel Payne & Bernard Heymann

Parameters:
    threshold gray scale level.

Returns:
    Bimage* unsigned char mask.

    A binary mask is generated using the given threshold.
    Image statistics are recalculated.

Definition at line 93 of file Bimage_mask.cpp.

  Bimage * Bimage::mask_by_thresholds (vector< double > threshold)

Generates a mask based on an image at a given threshold.

Parameters:
    threshold array of gray scale levels.

Returns:
    Bimage* unsigned char mask.

    A binary mask is generated using the given threshold.
    Image statistics are recalculated.

Definition at line 129 of file Bimage_mask.cpp.

  long Bimage::mask_close (int times = 1)

Closes a binary mask.

Parameters:
    times the number of times to dilate and erode the mask.

Returns:
    long masked voxels.

    Closing a mask is a dilation followed by an erosion.

Definition at line 482 of file Bimage_mask.cpp.

  long Bimage::mask_combine (Bimage * p, int operation)

Combines two masks with different operations.

Parameters:
    *p second mask.
    operation combining operation.

Returns:
    Bimage* unsigned char mask.

    The input images are assumed to be a masks of 0's and 1's and are
    modified according to the operation requested:
        0   val1 = val2
        1   val1 = val1 and val2
        2   val1 = val1 or  val2
        3   val1 = val1 xor val2
    where val1 and val2 are the data in the two images.
    Image statistics of the first image are recalculated.

Definition at line 256 of file Bimage_mask.cpp.

  long Bimage::mask_dilate (long times = 1)

Dilates a binary mask.

Author:
    Samuel Payne & Bernard Heymann

Parameters:
    times the number of times to dilate the mask.

Returns:
    long masked voxels.

    Traditional 3^dim kernel dilation.  Any pixel with a value of 1 turns
    all of its neighbors to a value of 1.

Definition at line 424 of file Bimage_mask.cpp.

  long Bimage::mask_dilate_erode (unsigned char dir)

Dilates or erodes a binary mask.

Author:
    Samuel Payne & Bernard Heymann

Parameters:
    dir 0=erode, 1=dilate.

Returns:
    long masked voxels.

    Traditional 3^dim kernel dilation.  Any pixel with a value of 1 turns
    all of its neighbors to a value of 1.

Definition at line 367 of file Bimage_mask.cpp.

  long Bimage::mask_erode (long times = 1)

Erodes a binary mask.

Author:
    Samuel Payne & Bernard Heymann

Parameters:
    times the number of times to erode the mask

Returns:
    long masked voxels.

    Traditional 3^dim kernel erosion.  If all the neighboring pixels have
    value of 1, then that pixel is left at 1. Otherwise it is changed to 0.

Definition at line 444 of file Bimage_mask.cpp.

  Bimage * Bimage::mask_extract (Bimage * pmask)

Zeroes everything outside the mask and return the excised feature.

Parameters:
    *pmask mask.

Returns:
    Bimage* excised feature.

    The mask must be the same size as the image.

Definition at line 294 of file Bimage_mask.cpp.

  long Bimage::mask_fill (Vector3< long > voxel)

Fills an empty part of a mask indicated by the given voxel.

Parameters:
    voxel point from which to fill the mask.

Returns:
    long masked voxels.

Definition at line 500 of file Bimage_mask.cpp.

  int Bimage::mask_fspace_banded (vector< double > & band)

Generate reciprocal space mask based on a specification of bands.

Parameters:
    &band array of number pairs, each a shell and value.

Returns:
    int 0.

    The band argument is a list of pairs of values, each pair indicating
    a resolution shell (in angstrom) and a flag indicating whether the
    following shells should be:
        0: excluded - also the high resolution limit
        1: included in the FOM
        -1: included in the cross-validation FOM
    The high resolution limit for the mask is set in the image structure.

Definition at line 814 of file Bimage_mask.cpp.

  Vector3< double > Bimage::mask_fspace_resize (Vector3< long > nusize)

Resizes a reciprocal space mask.

Parameters:
    nusize new mask size.

Returns:
    Vector3<double> scale.

    The mask is assumed to be centered at (0,0,0).
    The image is resized by inserting or removing
    rows or columns in the middle of the data set.

Definition at line 683 of file Bimage_mask.cpp.

  Matrix Bimage::mask_interface_matrix (int img_num)

Calculates the interfaces between regions.

Parameters:
    img_num sub-image number.

Returns:
    Matrix interface matrix.

    The mask must be an integer image.
    An interface matrix is calculated to count the number of connected
    voxels between every pair of regions.
    Each value i in a row j gives the number of voxels of the region j that
    are adjacent to one or more voxels in region i.
    Row 0 and column 0 are excluded from the calculation.

Definition at line 2106 of file Bimage_mask.cpp.

  long Bimage::mask_invert ()

Inverts a mask.

Returns:
    long number of mask voxels.

    The mask is assumed to be in range [0,1].
        new_mask = 1 - old_mask.
    Image statistics of the mask are recalculated.

Definition at line 221 of file Bimage_mask.cpp.

  long Bimage::mask_merge_delete (long min_size, long min_if)

Calculates the interfaces between regions and deletes/merges small ones.

Parameters:
    min_size minimum size to accept regions, small ones are deleted/merged.
    min_if minimum interface size to consider a small region connected.

Returns:
    long 0.

    The mask is converted to an integer mask.
    An interface matrix is calculated to count the number of connected
    voxels between every pair of regions.
    Regions that are smaller than the minimum size are either deleted or
    merged with other regions.
    If the maximum interface size for a small region is less than the minimum
    specified, the region is deleted, otherwise, it is added to that
    neighboring region with which it shares the biggest interface.

Definition at line 2226 of file Bimage_mask.cpp.

  long Bimage::mask_missing_cone (Vector3< double > ori, double mis_ang, double resolution)

Generates a mask with a missing cone.

Parameters:
    ori image origin.
    mis_ang cone angle from xy plane.
    resolution high resolution limit.

Returns:
    long number of mask voxels.

    The given image is used to generate a binary mask of the same size.
    If the input origin is {0,0,0}, the origin in the image is used as
    the center for the missing part.

Definition at line 1068 of file Bimage_mask.cpp.

  long Bimage::mask_missing_find (Vector3< double > ori, double resolution, Bstring & mis_type)

Generates a missing mask from an example image.

Parameters:
    ori image origin.
    resolution high resolution limit.
    mis_type missing region type: wedge.

Returns:
    long number of mask voxels.

    The given image is used to generate a binary mask of the same size.
    If the input origin is {0,0,0}, the origin in the image is used as
    the center for the missing part.

Definition at line 1140 of file Bimage_mask.cpp.

  long Bimage::mask_missing_pyramid (Vector3< double > ori, double tilt_axis1, double tilt_axis2, double tilt_neg1, double tilt_pos1, double tilt_neg2, double tilt_pos2, double resolution)

Generates a mask with a missing pyramid.

Parameters:
    ori image origin.
    tilt_axis1 tilt axis angle 1.
    tilt_axis2 tilt axis angle 2.
    tilt_neg1 negative tilt angle for axis 1.
    tilt_pos1 positive tilt angle for axis 1.
    tilt_neg2 negative tilt angle for axis 2.
    tilt_pos2 positive tilt angle for axis 2.
    resolution high resolution limit.

Returns:
    long number of mask voxels.

    The given image is used to generate a binary mask of the same size.
    If the input origin is {0,0,0}, the origin in the image is used as
    the center for the missing part.

Definition at line 981 of file Bimage_mask.cpp.

  long Bimage::mask_missing_wedge (Vector3< double > ori, double tilt_axis, double tilt_neg, double tilt_pos, double resolution)

Generates a mask with a missing wedge.

Parameters:
    ori image origin.
    tilt_axis tilt axis angle.
    tilt_neg negative tilt angle.
    tilt_pos positive tilt angle.
    resolution high resolution limit.

Returns:
    long number of mask voxels.

    The given image is used to generate a binary mask of the same size.
    If the input origin is {0,0,0}, the origin in the image is used as
    the center for the missing part.

Definition at line 899 of file Bimage_mask.cpp.

  long Bimage::mask_open (int times = 1)

Opens a binary mask.

Parameters:
    times the number of times to erode and dilate the mask.

Returns:
    long masked voxels.

    Opening a mask is an erosion followed by a dilation.

Definition at line 462 of file Bimage_mask.cpp.

  long Bimage::mask_pack_plane (Matrix3 mat, double hi_res, double scale)

Packs a 2D mask into a 3D reciprocal space volume.

Parameters:
    mat affine orientation matrix.
    hi_res high resolution limit.
    scale scale.

Returns:
    long 0.

    The rotation matrix is used to determine the plane in reciprocal space
    to set as one.
    Both the high resolution limit and the scale must correspond to the
    associated reconstruction.

Definition at line 1247 of file Bimage_mask.cpp.

  long Bimage::mask_plane (Vector3< double > origin, Vector3< double > normal)

Generates a mask on one side of a plane.

Parameters:
    origin any point on plane.
    normal plane normal.

Returns:
    long 0.

    The given image is used to generate a binary mask of the same size.

Definition at line 514 of file Bimage_mask.cpp.

  long Bimage::mask_rectangle (double length, double width, double rect_angle, int wrap)

Generates a mask along an axis within a 2D image.

Parameters:
    length length along axis (pixels).
    width width perpendicular to axis (pixels).
    rect_angle angle from x-axis (radians).
    wrap flag to wrap around boundaries.

Returns:
    long 0.

    The input image is assumed to be a mask of 0's and 1's and is modified
    according to the operation requested.
    Only an axis in the xy plane is used, generating a rectangular mask
    of given length and width around the axis, with its center at the
    origins given in the image structure.

Definition at line 569 of file Bimage_mask.cpp.

  long Bimage::mask_region_interfaces (int reg_num)

Reports the whole interface matrix or interfaces for one region only.

Parameters:
    reg_num region to report for (<0 whole interface matrix).

Returns:
    long 0.

    The mask is converted to an integer mask.
    An interface matrix is calculated to count the number of connected
    voxels between every pair of regions.

Definition at line 2175 of file Bimage_mask.cpp.

  long Bimage::mask_shell (Vector3< double > origin, double rad_min, double rad_max) [inline]

Definition at line 1314 of file Bimage.h.

  long Bimage::mask_split (long voxels_per_level)

Converts a mask to a multilevel mask with a given number of voxels per level.

Parameters:
    voxels_per_level number of voxels per level.

Returns:
    long number of voxels retained.

    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 1453 of file Bimage_mask.cpp.

  long Bimage::mask_stats ()

Calculates statistics for a mask.

Returns:
    long voxels in positive levels.

    The mask can be any type, but the regions in the mask are rounded to
    the nearest integer for counting statistics.

Definition at line 165 of file Bimage_mask.cpp.

  long Bimage::mask_symmetrize (Bsymmetry * sym)

Symetrizes a mask.

Parameters:
    sym point group symmetry.

Returns:
    long 0.

Definition at line 621 of file Bimage_mask.cpp.

  double Bimage::mass_at_threshold (long img_num, double threshold, double rho)

Calculates the mass from the density threshold.

Parameters:
    img_num sub-image number (first = 0).
    threshold density threshold.
    rho protein density in Da/A3.

Returns:
    double threshold.

    An image is assumed to have density represented by higher (white) values.

Definition at line 918 of file Bimage_segment.cpp.

  double Bimage::mass_threshold (long img_num, double mol_weight, double rho)

Finds the density threshold associated with a particular molecular weight.

Parameters:
    img_num sub-image number (first = 0,).
    mol_weight molecular weight.
    rho protein density in Da/A3.

Returns:
    float threshold.

    A threshold value is determined which contour a density such that
    it corresponds to 100% of the given molecular weight.
    An image is assumed to have density represented by higher (white) values.

Definition at line 834 of file Bimage_segment.cpp.

  int Bimage::max_in_kernel (long ksize)

Definition at line 309 of file Bimage_mask.cpp.

  double Bimage::maximum () [inline]

Definition at line 535 of file Bimage.h.

  void Bimage::maximum (double d) [inline]

Definition at line 539 of file Bimage.h.

  double Bimage::maximum_included_radius ()

Returns the radius of the enclosed sphere or circle.

Returns:
    double radius of largest sphere that will fit in an image.

    Returns the radius of the largest sphere or circle that will fit
    inside a three- or two-dimensional image, respectively, or the
    midpoint of a one-dimensional image.
    Assumes that the x, y, and z dimensions are the number of data points
    in those respective directions, and that the length (in pixels)
    of the respective dimensions is x, y, or z minus one.  The minimum
    length is two times the radius of the largest sphere that will fit
    inside the image.

Definition at line 2036 of file Bimage.cpp.

  int Bimage::median_bin (int binning)

Bins by an integer size, selecting the kernel median.

Parameters:
    binning integer bin factor.

Returns:
    int 0.

    An image is binned by an integer size, square in 2D and cubic in 3D.

Definition at line 388 of file Bimage_bin.cpp.

  double Bimage::merge_amplitudes_and_phases (Bimage * pamp)

Merges the amplitudes from one map with the phases of another.

Parameters:
    *pamp amplitude image (simple or complex).

Returns:
    double RMSD of amplitudes.

    The amplitude image can be a floating point image or a complex image.
    The phase image must be complex and its amplitudes are replaced by
    the values from the amplitude image.
    No statistics are calculated.

Definition at line 1218 of file Bimage_complex.cpp.

  double Bimage::merge_amplitudes_and_phases (Bimage * pref, double res_hi, double res_lo)

Keeps selected phases and replaces amplitudes and other phases from a reference transform.

Parameters:
    *pref reference Fourier transform.
    res_hi high resolution limit.
    res_lo low resolution limit.

Returns:
    double RMSD of amplitudes.

    The input transform is considered to be modified in some way (such as solvent flattening).
    Only the phases in the specified resolution shell are kept, while all
    the other phases and amplitudes within the high resolution limit is
    retrieved from the reference transform.
    No statistics are calculated.

Definition at line 1266 of file Bimage_complex.cpp.

  JSvalue& Bimage::meta_data () [inline]

Definition at line 219 of file Bimage.h.

  void Bimage::meta_data_retain_one_image (long img_num)

Erases all sub-image records from the meta data except one.

Parameters:
    img_num sub-image number.

Definition at line 748 of file Bimage.cpp.

  void Bimage::meta_data_update ()

Update metadata from the sub-image information.

The sub-image information is encoded in the metadata in JSON format.

Definition at line 648 of file Bimage.cpp.

  double Bimage::minimum () [inline]

Definition at line 534 of file Bimage.h.

  void Bimage::minimum (double d) [inline]

Definition at line 538 of file Bimage.h.

  int Bimage::mirror ()

Inverts/mirrors each image through its origin.

Returns:
    int number of images.

    Each image in a Bimage structure is inverted.

Definition at line 561 of file Bimage_transform.cpp.

  int Bimage::moments (long max_order)

Prints out moments for all sub-images.

Returns:
    int error code (<0 means failure).

Definition at line 2600 of file Bimage.cpp.

  int Bimage::moments (long max_order, long nn)

Prints out moments for one sub-image.

Parameters:
    max_order maximum order.
    nn sub-image.

Returns:
    int error code (<0 means failure).

Definition at line 2617 of file Bimage.cpp.

  Bimage * Bimage::montage (int first, int cols, int rows, int skip = 0, int flip = 0)

Rearranges an image into a montage of 2D slices for display.

Parameters:
    cols columns in montage.
    rows rows in montage.
    first first slice in montage.
    skip number of slices to skip.
    flip flip the order of panels on: 1=x axis, 2=y axis.

Returns:
    Bimage* montaged image.

    The slices of a 3D image are packed into a 2D montage.
    The background value for the image is used for empty regions.

Definition at line 49 of file Bimage_montage.cpp.

  void Bimage::multiply (long j, Complex< double > cv) [inline]

Definition at line 312 of file Bimage.h.

  void Bimage::multiply (double v)

Multiplies an image with a constant value.

Parameters:
    v constant multiplier.

Definition at line 3250 of file Bimage.cpp.

  void Bimage::multiply (long nn, double v)

Multiplies a sub-image with a constant value.

Parameters:
    nn sub-image.
    v constant multiplier.

Definition at line 3271 of file Bimage.cpp.

  void Bimage::multiply (Bimage * p, double scale, double shift = 0)

Multiplies an image with another image.

Parameters:
    *p image multiplier.
    scale density scale to other image
    shift density shift to other image.

    Requirement: The images must have the same size.

Definition at line 3502 of file Bimage.cpp.

  void Bimage::multiply (long nn, Bimage * p)

Multiplies a sub-image with another image.

Parameters:
    nn sub-image to multiply.
    *p image multiplier.

    Requirement: The images must have the same size.

Definition at line 3527 of file Bimage.cpp.

  void Bimage::multiply (Bimage * p)

Multiplies all sub-images with the first sub-image of the other image.

Parameters:
    *p image multiplier.

    The other image is multiplied with the first.
    Both images are converted to floating point.

Definition at line 3547 of file Bimage.cpp.

  Bimage * Bimage::nad (double ht, long zw, double lambda, double C, double alpha)

Denoises a 3D density map by non-linear anisotropic diffusion.

Parameters:
    ht time step size, 0 < ht <= 0.25.
    zw slab size for piece-wise denoising.
    lambda lamda parameter for EED.
    C coherence parameter for CED.
    alpha .

Returns:
    Bimage* new image.

    The diffusion tensor is calculated with the aim of enhancing edges (EED)
    or planes (CED).

Definition at line 578 of file Bimage_nad.cpp.

  Bimage * Bimage::nad_2D (double ht, double lambda, double C, double alpha)

Denoises a 2D image by non-linear anisotropic diffusion.

Parameters:
    ht time step size, 0 < ht <= 0.25.
    lambda lamda parameter for EED.
    C coherence parameter for CED.
    alpha .

Returns:
    Bimage* new image.

    The diffusion tensor is calculated with the aim of enhancing edges (EED)
    or planes (CED).

Definition at line 552 of file Bimage_nad.cpp.

  int Bimage::noise_gaussian (double ravg = 0, double rstd = 1)

Generates an image with a gaussian random distribution of densities.

Parameters:
    ravg average.
    rstd standard deviation.

Returns:
    int 0.

    An image with a given datatype, number of subimages, and size is
    generated with densities with a gaussian distribution with a given
    average and standard deviation:
        density = average + std_dev*sqrt(-2*log(random_value))*
                        cos(2*PI*random_value);
    where random_value is between 0 and 1.
    The output image is floating point.
    Statistics are calculated before returning.

Definition at line 72 of file Bimage_noise.cpp.

  int Bimage::noise_logistical (double ravg, double rstd)

Generates an image with a gaussian random distribution of densities.

Parameters:
    ravg average.
    rstd standard deviation.

Returns:
    int 0.

    An image with a given datatype, number of subimages, and size is
    generated with densities with a logistical differential distribution
    with a given average and standard deviation:
        density = average + (std_dev/golden)*ln(1/random_value - 1)
    where random_value is between 0 and 1 and:
        golden  = (sqrt(5) + 1)/2
    The output image is floating point.
    Statistics are calculated before returning.

     Reference: Press W.H. et al (1992) Numerical Recipes in C.

Definition at line 156 of file Bimage_noise.cpp.

  int Bimage::noise_poisson (double ravg)

Generates an image with a poisson random distribution of densities.

Parameters:
    ravg average.

Returns:
    int 0.

    Algorithm taken from Numerical Recipes in C.
    The poisson distribution is given for j = 0,1,... by:
                avg^j * exp(-avg)
        P(j) = -----------------
                       j!
    Note that only positive integer values are defined for j and sum(P(j)) = 1.
    An array of floating point numbers is generated with a poisson
    distribution with a given average. The standard deviation is:
        std = sqrt(avg)
    If the average <= 0, the function exits.
    Statistics are calculated before returning.

     Reference: Press W.H. et al (1992) Numerical Recipes in C.

Definition at line 115 of file Bimage_noise.cpp.

  int Bimage::noise_spectral (double alpha)

Generates a noise map with a defined spectral decay.

Parameters:
    alpha spectral decay.

Returns:
    int 0.

    Uniform random phases are generated and the amplitudes are set to:
        amp = s^(-alpha/2).

Definition at line 184 of file Bimage_noise.cpp.

  int Bimage::noise_uniform (double rmin, double rmax)

Generates an image with a uniform random distribution of densities.

Parameters:
    rmin minimum density value.
    rmax maximum density value.

Returns:
    int 0.

    An image with a given datatype, number of subimages, and size is
    generated with densities distributed uniformly in the range of the
    given minimum and maximum:
        density = random_value*(max - min) + min
    where random_value is between 0 and 1.
    The average and standard deviation are:
        average = (max + min)/2
        standard deviation = 0.5*sqrt(1/3)*(max - min).
    The output image is floating point.
    Statistics are calculated before returning.

Definition at line 34 of file Bimage_noise.cpp.

  int Bimage::normalize (long imgnum, double average, double stdev, int norm_type, long bins)

Normalizes a sub-image to a desired average and standard deviation.

Parameters:
    imgnum sub-image number.
    average desired average.
    stdev desired standard deviation (if 0, use defaults).
    norm_type type of determining the effective average and standard deviation: 0=simple, 1=Gaussian, 2=Poisson.
    bins number of histogram bins required to fit distributions.

Returns:
    int 0.

    The effective average and standard deviation for each image is obtained
    in one of three ways:
        0.      The simple avergae and standard devaition for the image.
        1.      Gaussian fit of the histogram.
        2.      Poisson fit of the histogram.
    A histogram of an image is calculated with a given number of bins.
    The histogram is fit to a Gaussian or Poisson function with exclusion of a
    small number of bins in the histogram (defined as outliers).
    The effective average and standard deviation are used to
    rescale the data for each image.

Definition at line 481 of file Bimage_rescale.cpp.

  int Bimage::normalize (double average, double stdev, int norm_type)

Normalizes a set of images to a desired average and standard deviation.

Parameters:
    average desired average.
    stdev desired standard deviation (if 0, use defaults).
    norm_type type of determining the effective average and standard deviation: 0=simple, 1=Gaussian, 2=Poisson.

Returns:
    int 0.

    The effective average and standard deviation for each image is obtained
    in one of three ways:
        0.      The simple avergae and standard devaition for the image.
        1.      Gaussian fit of the histogram.
        2.      Poisson fit of the histogram.
    A histogram of an image is calculated with a given number of bins.
    The histogram is fit to a Gaussian or Poisson function with exclusion of a
    small number of bins in the histogram (defined as outliers).
    The effective average and standard deviation are used to
    rescale the data for each image.

Definition at line 536 of file Bimage_rescale.cpp.

  int Bimage::normalize_local (long kernel_size)

Normalizes by subtracting local average and dividing by local standard deviation.

Parameters:
    kernel_size size of kernel edge.

Returns:
    int 0.

    The local average and standard deviation within a kernel is calculated
    and used to normalize the image.
    The convolution is threaded if compiled with GCD or OpenMP.

Definition at line 608 of file Bimage_rescale.cpp.

  int Bimage::normalize_local (Vector3< long > kernel)

Normalizes by subtracting local average and dividing by local standard deviation.

Parameters:
    kernel size of kernel edge.

Returns:
    int 0.

    The local average and standard deviation within a kernel is calculated
    and used to normalize the image.
    The convolution is threaded if compiled with GCD or OpenMP.

Definition at line 625 of file Bimage_rescale.cpp.

  int Bimage::one_color (int color, double cmin, double cmax, int gray_extremes = 0)

Converts a gray-scale image to a single color.

Parameters:
    color color selection (0=red, 1=green, 2=blue).
    cmin lower grayscale boundary.
    cmax upper grayscale boundary.
    gray_extremes keep the ranges beyond the minimum and maximum as gray.

Returns:
    int 0.

    A grayscale image is converted to a selected color between the given minimum and maximum.

Definition at line 244 of file Bimage_color.cpp.

  Bimage * Bimage::operator+ (Bimage & p)

Adds two images together, adjusting for size difference.

Parameters:
    &p image to add.

Returns:
    Bimage* summed image, NULL on error.

    The second image is added to the first:
        image1 = image1 + image2*scale + shift
    The resultant image size is the bigger of the two.

Definition at line 3759 of file Bimage.cpp.

  Bimage & Bimage::operator= (const Bimage & p)

Assigns an image.

The internal copy function is called.

Definition at line 888 of file Bimage.cpp.

  JSvalue& Bimage::operator[] (string tag) [inline]

Definition at line 220 of file Bimage.h.

  double Bimage::operator[] (long j) const

Returns the data value at the given index.

Parameters:
    j index.

Returns:
    double value.

    The elemental data value is returned in double precision.

Definition at line 905 of file Bimage.cpp.

  Bimage * Bimage::orient (View * views)

Calculates multiple copies oriented according to views.

Parameters:
    views orientations for new images.

Returns:
    Bimage* new set of images.

    Each image in a Bimage structure is rotated to the corresponding view.

Definition at line 527 of file Bimage_transform.cpp.

  void Bimage::origin (double ox, double oy, double oz) [inline]

Definition at line 563 of file Bimage.h.

  void Bimage::origin (vector< double > vec) [inline]

Definition at line 567 of file Bimage.h.

  void Bimage::origin (Vector3< double > vec) [inline]

Definition at line 571 of file Bimage.h.

  void Bimage::origin (long nn, Vector3< double > vec) [inline]

Definition at line 575 of file Bimage.h.

  void Bimage::origin (long nn, vector< double > ori) [inline]

Definition at line 578 of file Bimage.h.

  void Bimage::origin (long nn, double ox, double oy, double oz) [inline]

Definition at line 582 of file Bimage.h.

  Bimage * Bimage::orthogonal_slices (long nn, Vector3< long > voxel, Vector3< long > ext_size)

Extracts orthogonal views around a voxel.

Parameters:
    nn image number to extract.
    voxel voxel of intersection.
    ext_size size of slices to extract.

Returns:
    Bimage* extracted slice for 2D and 3 slices for 3D.

    Only the desired region is extracted from the original image.
    The fill value is taken from the image background.

Definition at line 620 of file Bimage_extract.cpp.

  double Bimage::otsu_threshold (long bins)

Calculates the threshold on a histogram according to Otsu.

Parameters:
    bins number bins in histogram.

Returns:
    double threshold.

    Reference: NOBUYUKI OTSU, IEEE TRANSACTIONS ON SYSTEMS, MAN, AND CYBERNETICS, VOL. SMC-9, NO. 1, JANUARY 1979

Definition at line 516 of file Bimage_histogram.cpp.

  int Bimage::pack_transform (unsigned char * data, FourierType tf)

Definition at line 2422 of file Bimage.cpp.

  int Bimage::pack_transform (int img_select, unsigned char * data, FourierType tf)

Definition at line 2427 of file Bimage.cpp.

  Bimage * Bimage::pack_two_in_complex (Bimage * p)

Packs two real images into one complex image.

Parameters:
    *p second image.

Returns:
    Bimage* the new complex image, NULL on error.

    Two real space images are packed into the real and imaginary parts
    of a new data block with conversion from the original non-complex type.
    The header values of the first image are adopted for the new image.
    No statistics are calculated.

Definition at line 679 of file Bimage_complex.cpp.

  int Bimage::pad (long sz, int fill_type = 0, double fill = 0)

Pads an image to a new size with a given fill value.

Parameters:
    sz new size.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill value to use when padding the image.

Returns:
    int 0.

    The image is enlarged with padding only on one side in each
    dimension with an input size greater than one.
    The data type is preserved.

Definition at line 351 of file Bimage_resize.cpp.

  int Bimage::pad (Vector3< long > sz, int fill_type = 0, double fill = 0)

Pads an image to a new size with a given fill value.

Parameters:
    sz new size.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill value to use when padding the image.

Returns:
    int 0.

The image is enlarged with padding only on one side in each dimension with an input size greater than one. The data type is preserved.

Definition at line 374 of file Bimage_resize.cpp.

  Bimage * Bimage::pad_copy (long sz, int fill_type = 0, double fill = 0)

Pads an image to a new size with a given fill value.

Parameters:
    sz new size.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill value to use when padding the image.

Returns:
    Bimage* resized image.

    The image is enlarged with padding only on one side in each
    dimension with an input size greater than one.
    The data type is preserved.

Definition at line 392 of file Bimage_resize.cpp.

  Bimage * Bimage::pad_copy (Vector3< long > sz, int fill_type = 0, double fill = 0)

Pads an image to a new size with a given fill value.

Parameters:
    sz new size.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill value to use when padding the image.

Returns:
    Bimage* resized image.

The image is enlarged with padding only on one side in each dimension with an input size greater than one. The data type is preserved.

Definition at line 415 of file Bimage_resize.cpp.

  Vector3<long> Bimage::page_size () [inline]

Definition at line 480 of file Bimage.h.

  void Bimage::page_size (long nx, long ny, long nz) [inline]

Definition at line 481 of file Bimage.h.

  void Bimage::page_size (Vector3< long > vec) [inline]

Definition at line 485 of file Bimage.h.

  void Bimage::page_size (vector< long > vec) [inline]

Definition at line 486 of file Bimage.h.

  double Bimage::peak_sigma (long nn, Vector3< long > coor, long kernel_size)

Calculates a sigma value for a cross-correlation peak.

Parameters:
    nn sub-image.
    coor coordinates in the image.
    kernel_size kernel size to fit the gaussian.

Returns:
    double sigma value.

    The peak is assumed to be close to a gaussian.
    The sigma is calculated for each kernel location and averaged:
        sigma = sqrt(rad^2/2(ln(vmax)-ln(v)))

Definition at line 1868 of file Bimage_correlate.cpp.

  Bplot * Bimage::percentiles ()

Calculates the percentiles from the histogram of an image.

Returns:
    Bplot* plot of the percentiles.

    A histogram of an image is calculated with 10000 bins.
    The percentiles are calculated from the running sum of the histogram
    and returned in a plot.

Definition at line 337 of file Bimage_histogram.cpp.

  Bimage * Bimage::periodic_averaging (Vector3< double > period)

Calculates an average within a periodic frame.

Parameters:
    period size of periodic frame.

Returns:
    Bimage* new image.

Definition at line 1145 of file Bimage_filter.cpp.

  int Bimage::phase_colour_wheel ()

Generates a phase color wheel.

Returns:
    int 0.

    The image is filled with a color wheel where the location (x,y)
    is converted to polar form:
        a = arctan(y/x)
        r = sqrt(x^2+y^2)
    The color is a function of the angle a and saturation is a function
    of the distance from the origin.

Definition at line 562 of file Bimage_color.cpp.

  Bimage * Bimage::phase_difference (Bimage * p, int type = 0, double res_hi = 0, double res_lo = 0)

Calculates the cosine of the phase difference between two images.

Parameters:
    *p real space reference image.
    type 0=phase angle, 1=cos(phase angle), 2=scale by amplitude product
    res_hi upper resolution limit.
    res_lo lower resolution limit.

Returns:
    Bimage* phase difference image.

    Both images are Fourier transformed and the cosine of the phase
    difference calculated.

Definition at line 1793 of file Bimage_fspace.cpp.

  int Bimage::phase_flip (Bimage * pd)

Flips the phases of an image based on a phase difference map.

Parameters:
    *pd reciprocal space phase difference map.

Returns:
    int 0.

Definition at line 1978 of file Bimage_fspace.cpp.

  int Bimage::phase_shift (Vector3< double > shift)

Phase shifts a complex image.

Parameters:
    shift three-value real space shift vector.

Returns:
    int error code.

    A real space translation with wrapping is equivalent to phase shifting
    in reciprocal space.

Definition at line 256 of file Bimage_complex.cpp.

  int Bimage::phase_shift (long nn, Vector3< double > shift)

Phase shifts a complex sub-image.

Parameters:
    nn sub-image to transform.
    shift three-value real space shift vector.

Returns:
    int error code.

    A real space translation with wrapping is equivalent to phase shifting
    in reciprocal space.

Definition at line 280 of file Bimage_complex.cpp.

  int Bimage::phase_shift_to_center ()

Phase shifts a set of reflections to the nominal center of the image origin.

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 382 of file Bimage_complex.cpp.

  int Bimage::phase_shift_to_origin ()

Phase shifts a set of reflections to the image origin.

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 327 of file Bimage_complex.cpp.

  int Bimage::place (long nn, Bimage * p, Vector3< double > loc, double radius = 0, double scale = 1, double shift = 0, int operation = 0)

Places a small image into a large image.

Parameters:
    nn sub-image.
    *p image to place.
    loc location in large image of small image origin.
    radius radial mask to transfer small image.
    scale density scale to apply to second image.
    shift density shift to apply to second image.
    operation operation to apply.

Returns:
    int 0, <0 if error.

    The small image is placed with its origin at given origin in the large image.
    The second image is scaled and shifted before placing into the first:
        image1 = image1 + image2*scale + shift
    Both images are converted to floating point.
    The operation can be selected:
        0   simple addition.
        1   replace if smaller.
        2   replace if larger.
    Requirement: Both images must have the same pixel size.

Definition at line 178 of file Bimage_combine.cpp.

  int Bimage::place_central_part (Bimage * p, long nn)

Packs a tile with overlap into a new composite image.

Parameters:
    *p image = tiles.
    nn tile image (can be a sub-image).

Returns:
    int 0.

    The overlaps between tiles are divided between the neighboring tiles.
    The tile placement is in the sub-image origins.

Definition at line 358 of file Bimage_combine.cpp.

  int Bimage::place_with_addition (Bimage * p, long nn)

Packs a tile with overlap into a new composite image.

Parameters:
    *p image = tiles.
    nn tile image (can be a sub-image).

Returns:
    int 0.

    The tiles are added to the image.
    The contributions at each voxel are counted in a linked image.
    The tile placement is in the sub-image origins.

Definition at line 242 of file Bimage_combine.cpp.

  int Bimage::place_with_overlap (Bimage * p, long nn)

Packs a tile with overlap into a new composite image.

Parameters:
    *p image = tiles.
    nn tile image (can be a sub-image).

Returns:
    int 0.

    The overlaps between tiles are filled in with a weighted average based
    on a linear transition from one to the other.
    The tile placement is in the sub-image origins.

Definition at line 284 of file Bimage_combine.cpp.

  Bplot * Bimage::plot ()

Converts a one-dimensional image into a plot.

Returns:
    Bplot* plot structure.

Each image generates one plot with each channel converted to a curve.

Definition at line 3836 of file Bimage.cpp.

  Bimage * Bimage::polar_power_spectrum (double resolution, long num_angle)

Calculates the polar power spectrum of a 2D transform amplitude or intensity image.

Parameters:
    resolution high resolution limit.
    num_angle number of angles to use for interpolation.

Returns:
    Bimage* polar power spectrum.

    The length of each annulus is number of angles times the radial offset.
    The samples on each annulus are calculated by bilinear interpolation.
    The maximum annulus calculated depends on the resolution limit specified
    in the input image.

Definition at line 701 of file Bimage_polar.cpp.

  Bimage * Bimage::polar_transform (long nangles, long ann_min, long ann_max, long dann, long zmin, long zmax, long zinc)

Calculates an image with cylindrical coordinates by integration.

Parameters:
    nangles number of angles in each annulus.
    ann_min minimum annulus (pixels).
    ann_max maximum annulus (pixels).
    dann width of annulus (pixels).
    zmin minimum z (pixels).
    zmax maximum z (pixels).
    zinc increment in z (pixels).

Returns:
    Bimage* cylindrical image.

    The image is converted to cylindrical form by integrating blocks
        with a defined annular width and thickness in z at each angle.
    The resultant image contains lines corresponding to integrated blocks
        covering 360° of angle.
    The sampling must be isotropic.
    The origins within the sub-image structures are used.
    The interpolation routine actually calculates the old cartesian
    coordinates for each set of cylindrical coordinates.

Definition at line 626 of file Bimage_polar.cpp.

  void Bimage::power (double v)

Calculates the power of an image.

Parameters:
    v power value.

Definition at line 3288 of file Bimage.cpp.

  int Bimage::power_spectrum (int flags = 0)

Calculates a power spectrum.

Parameters:
    flags 1=norm, 2=avg, 4=shift, 8=log.

Returns:
    int error code.

    All the sub-images are Fourier transformed.
    The flags variable controls options base don which bits are set:
        1   normalize image before transformation
        2   average all power spectra
        4   shift the origin to the center
        8   calculate the logarithm of the power spectrum

Definition at line 48 of file Bimage_powerspectrum.cpp.

  Bimage * Bimage::powerspectrum_tiled (long img_num, Vector3< long > tile_size, int flags = 0)

Prepares a tiled power spectrum from an image for determining CTF parameters.

Parameters:
    img_num sub-image to transform.
    tile_size tile size (if (0,0,0) don't tile).
    flags 1=norm, 2=avg, 4=shift, 8=log.

Returns:
    Bimage* power spectrum.

    A large single image (a micrograph) is converted to a number of tiles
    packed into a multi-image structure.
    All the sub-images are Fourier transformed and the power spectra calculated.
    The flag indicates if the images are normalized, averaged, shifted and
    the logarithm calculated

Definition at line 97 of file Bimage_powerspectrum.cpp.

  Bimage * Bimage::powerspectrum_tiled_and_tilted (Vector3< long > tile_size, double tilt_axis, double tilt_angle, double tilt_offset, double defocus, double iCL2, int flags = 0)

Prepares a tiled powerspectrum from a tilted image for determining CTF parameters.

Parameters:
    tile_size tile size (if (0,0,0) don't tile).
    tilt_axis tilt axis angle (in radians).
    tilt_angle tilt angle (in radians).
    tilt_offset offset perpendicular to tilt axis (in pixels).
    defocus average defocus to adjust for change in focus.
    iCL2 inverse of product of spherical aberration and wavelenght squared.
    flags 1=norm, 2=avg, 4=shift, 8=log, 16=add.

Returns:
    Bimage* power spectrum.

    A large single image (a micrograph) is converted to a number of tiles
    packed into a multi-image structure.
    All the sub-images are Fourier transformed and the power spectra calculated.
    The power spectra are scaled based on the tilt and average defocus of the image.
    The flag indicates if the images are normalized, averaged, shifted and
    the logarithm calculated

Definition at line 354 of file Bimage_powerspectrum.cpp.

  Bimage * Bimage::powerspectrum_tilt_axis (long img_num, Vector3< long > tile_size, double tilt_axis, double tilt_offset, int flags = 0)

Prepares a tiled powerspectrum from a tilted image for determining CTF parameters.

Parameters:
    img_num sub-image to transform.
    tile_size tile size (if (0,0,0) don't tile).
    tilt_axis tilt axis angle (in radians).
    tilt_offset offset perpendicular to tilt axis (in pixels).
    flags 1=norm, 2=avg, 4=shift, 8=log.

Returns:
    Bimage* power spectrum.

    A large single image (a micrograph) is converted to a number of tiles
    along the tilt axis packed into a multi-image structure.
    All the sub-images are Fourier transformed and the power spectra calculated.
    The flag indicates if the images are normalized, averaged, shifted and
    the logarithm calculated

Definition at line 154 of file Bimage_powerspectrum.cpp.

  Bimage * Bimage::powerspectrum_tilted (long img_num, Vector3< long > tile_size, double tilt_axis, double tilt_angle, double defocus, double iCL2, int flags = 0)

Prepares a tiled powerspectrum from a tilted image for determining CTF parameters.

Parameters:
    img_num sub-image to transform.
    tile_size tile size (if (0,0,0) don't tile).
    tilt_axis tilt axis angle (in radians).
    tilt_angle tilt angle (in radians).
    defocus average defocus to adjust for change in focus.
    iCL2 inverse of product of spherical aberration and wavelenght squared.
    flags 1=norm, 2=avg, 4=shift, 8=log.

Returns:
    Bimage* power spectrum.

    A large single image (a micrograph) is converted to a number of tiles
    packed into a multi-image structure.
    All the sub-images are Fourier transformed and the power spectra calculated.
    The power spectra are scaled based on the tilt and average defocus of the image.
    The flag indicates if the images are normalized, averaged, shifted and
    the logarithm calculated

Definition at line 272 of file Bimage_powerspectrum.cpp.

  double * Bimage::pps_angular_correlation (Bimage * pref, double res_hi, double res_lo, long nang, fft_plan planf)

Definition at line 720 of file Bimage_align.cpp.

  Bimage * Bimage::project (char axis, int flags = 1)

Projects a 3D image to a 2D image down one of the three major axes.

Parameters:
    axis axis of projection.
    flags 1=scale projection, 2=minimum, 4=maximum.

Returns:
    Bimage* projection image (floating point).

    The sums of the z-planes are accumulated into a new floating point data
    block.  This block is then rescaled and converted back to the original
    data type.
    The new data replaces the old data.

Definition at line 31 of file Bimage_project.cpp.

  Bimage * Bimage::project (View * view, int norm_flag = 1)

Calculates a set of projections from a 3D density map.

Parameters:
    *view linked list of views.
    norm_flag flag to normalize projection.

Returns:
    Bimage* projections as sub-images.

    A set of projections is calculated according to a list of views.

Definition at line 207 of file Bimage_project.cpp.

  Bimage * Bimage::project (View * view, double resolution, FSI_Kernel * kernel)

Calculates a set of projections as central sections from a 3D fourier transform.

Parameters:
    *view linked list of views.
    resolution high resolution limit.
    *kernel frequency space interpolation kernel.

Returns:
    Bimage* projections as sub-images.

    The map is Fourier transformed and shifted to its phase origin.
    For each view, a central section is calculated using reciprocal space interpolation.
    All the projections are phase shifted to a central origin and back-transformed.

Definition at line 343 of file Bimage_project.cpp.

  int Bimage::pure_color ()

Generates a pure color image without intensity.

Returns:
    int 0.

    Pure color is defined as:
                col
        col = --------
              sum(col)

Definition at line 340 of file Bimage_color.cpp.

  int Bimage::quadric (double * param)

Generates a quadric surface over the whole image.

Parameters:
    param 7-value array of parameters.

Returns:
    int 0.

Definition at line 819 of file Bimage_edit.cpp.

  int Bimage::quadric_correct (vector< double > param)

Corrects for a quadric surface.

Parameters:
    param 7-value array of parameters.

Returns:
    int error code.

Definition at line 826 of file Bimage_rescale.cpp.

  vector< double > Bimage::quadric_fit ()

Fits the whole image to a quadric surface.

Returns:
    vector<double> 7-value array of parameters.

    A quadric surface is defined as:
    v = a0 + a1*dx + a2*dy + a3*dz + a4*dx^2 + a5*dy^2 + a6*dz^2

Definition at line 862 of file Bimage_rescale.cpp.

  vector<JSvalue*> Bimage::query (string & path) [inline]

Definition at line 223 of file Bimage.h.

  double Bimage::R_factor (Bimage * p)

Calculates an R factor between two images.

Parameters:
    *p second image.

Returns:
    double R factor, -1 if not run.

    The difference between two images is calculated and normalized as:
                              sum(image1 - image2)^2
        R = sqrt(-------------------------------------------------)
                 sqrt(sum(image1 - avg1)^2 * sum(image2 - avg2)^2)
    Both images are converted to floating point.

Definition at line 218 of file Bimage_correlate.cpp.

  Bimage * Bimage::radial (long minrad, long maxrad, double rad_step = 1, int wrap = 0)

Calculates the radial average of an image.

Parameters:
    minrad minimum radius in voxels.
    maxrad maximum radius in voxels.
    rad_step step size in voxels.
    wrap flag to wrap the data.

Returns:
    Bimage* radial average in the form of a 1D image.

    A radial average of a 2D or 3D image is calculated between a minimum
    and maximum radius.  An interpolative method is used where the value of
    a voxel is distributed between the two nearest radial annuli.
    The final sum in an annulus is normalized by the number of voxels
    contributing to the annulus sum.
    The origins within the sub-image structures are used.

Definition at line 33 of file Bimage_polar.cpp.

  Bimage * Bimage::radial (long minrad, long maxrad, double rad_step, Bimage * pmask, int wrap = 0)

Calculates the radial average of an image.

Parameters:
    minrad minimum radius in voxels.
    maxrad maximum radius in voxels.
    rad_step step size in voxels.
    *pmask mask to limit calculation.
    wrap flag to wrap the data.

Returns:
    Bimage* radial average in the form of a 1D image.

    A radial average of a 2D or 3D image is calculated between a minimum
    and maximum radius.  An interpolative method is used where the value of
    a voxel is distributed between the two nearest radial annuli.
    The final sum in an annulus is normalized by the number of voxels
    contributing to the annulus sum.
    The origins within the sub-image structures are used.

Definition at line 55 of file Bimage_polar.cpp.

  Bimage * Bimage::radial (long minrad, long maxrad, double rad_step, double ellipticity, double angle, Bimage * pmask, int wrap = 0)

Calculates the radial average of an image.

Parameters:
    minrad minimum radius in voxels.
    maxrad maximum radius in voxels.
    rad_step step size in voxels.
    ellipticity ratio of major and minor axes.
    angle angle of major axis.
    *pmask mask to limit calculation.
    wrap flag to wrap the data.

Returns:
    Bimage* radial average in the form of a 1D image.

    A radial average of a 2D or 3D image is calculated between a minimum
    and maximum radius.  An interpolative method is used where the value of
    a voxel is distributed between the two nearest radial annuli.
    The final sum in an annulus is normalized by the number of voxels
    contributing to the annulus sum.
    The origins within the sub-image structures are used.

Definition at line 79 of file Bimage_polar.cpp.

  Bimage * Bimage::radial_coverage (double threshold, double rad_step = 1)

Calculates the coverage in each radial shell.

Parameters:
    threshold density threshold to distinguish for- and background.
    rad_step radial step size (voxels).

Returns:
    int 0.

Definition at line 1079 of file Bimage_polar.cpp.

  double * Bimage::radial_fit (Bimage * pref)

Fits a radial profile to a reference radial profile.

Parameters:
    *pref reference radial profile as a 1D image.

Returns:
    double* 3-value result vector: dimension scale, amplitude scale and amplitude shift.

    A radial profile is fitted to a reference profile using an iterative
    simplex down-hill method.  The equations solved are:
        x(new) = x(old)*m
        y(new) = y(old)*a + b
    where   m is the dimension scaling (or magnification).
            a is the amplitude scaling.
            b is the amplitude shift.

Definition at line 254 of file Bimage_polar.cpp.

  Bimage * Bimage::radial_sections (double rad_start, double rad_end, double rad_step, double spherical_fraction, Bsymmetry * sym)

Calculates an image with slices giving the radial section projections.

Parameters:
    rad_start starting radius (voxels).
    rad_end ending radius (voxels).
    rad_step radial step size (voxels).
    spherical_fraction fraction of spherical section (requires symmetry).
    *sym symmetry for non-spherical sections.

Returns:
    Bimage* image with radial sections.

    The 3D image is converted so that the sections contain 2D projections
    of radial shells. The projection in slice i is defined for:
        i >= sqrt(x^2 + y^2)
    Non-spherical sections can be generated by specifying the symmetry and
    the fraction of spherical nature (1=spherical, 0=based on symmetry).
    Sampling in x and y is not changed.
    The sampling in the input map must be isotropic.

Definition at line 1027 of file Bimage_polar.cpp.

  int Bimage::radial_shells ()

Calculates an image with slices representing radial shell projections.

Returns:
    int 0.

    The 3D image is converted so that the sections contain 2D projections
    of radial shells. The projection in slice z is defined for:
        z >= sqrt((x-xo)^2 + (y-yo)^2) + zo
    The first projection is placed at the z origin and radiates out into
    both positive and negative directions.
    Sampling in x and y is not changed.
    The sampling must be isotropic.

Definition at line 783 of file Bimage_polar.cpp.

  Bimage * Bimage::radial_to_full (Vector3< long > nusize, Vector3< double > origin)

Generates a full 2D or 3D image from a radial profile in a 1D image.

Parameters:
    nusize size of image to expand to.
    origin origin for radial profile.

Returns:
    Bimage* new 2D or 3D image.

    It assumes the resultant image is square or cubic.

Definition at line 338 of file Bimage_polar.cpp.

  unsigned char * Bimage::read_data (ifstream * fimg, int img_select, int sb, int vax, long pad)

Read image data in a generalized style.

Parameters:
    *fimg file descriptor: file opened in calling function.
    img_select image selection: if -1, all images, if >= 0, one image.
    sb flag activates byte swapping.
    vax indicate vax style floating point - activates conversion.
    pad any interspersed control or separation bytes.

Returns:
    unsigned char* data pointer, NULL if reading failed. The whole file or a single image from a file may be read. The data is read in the largest blocks possible for efficiency. Any interspersed padding and page sizes not matching the data size contribute to inefficiency in reading. Swapping: sb = 1: swap bytes the size of the data type sb > 1: swap these number of bytes regardless of the data type

Definition at line 2188 of file Bimage.cpp.

  Vector3<double> Bimage::real_size () [inline]

Definition at line 487 of file Bimage.h.

  Bimage * Bimage::red_white_blue (double red_min, double white_min, double white_max, double blue_max)

Colorizes an image with blue positive and red negative.

Parameters:
    red_min beginning of red gradient (most negative).
    white_min end of red gradient (fade into white).
    white_max beginning of blue gradient (start with white).
    blue_max end of blue gradient (most positive)

Returns:
    Bimage* color scale image.

    A grayscale image is converted to RGB and colored with blue positive,
    red negative, and white in between.

Definition at line 466 of file Bimage_color.cpp.

  int Bimage::refine_peak ()

Refines the position of a peak to sub-voxel resolution.

Returns:
    int error code.

    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 1556 of file Bimage_correlate.cpp.

  long Bimage::region_assign (Bimage * pmask, long idx, long region_number, double threshold, int sign)

Finds all the pixels that are part of the same region.

Author:
    Bernard Heymann and Samuel Payne

Parameters:
    *pmask a mask holding region assignments.
    idx the first voxel of a region.
    region_number the region number that voxels are assigned.
    threshold the level to define background.
    sign sign controlling direction of thresholding.

Returns:
    int 0.

    This method uses a list to keep track of voxels assigned to a region.
    In subsequent iterations the non-assigned voxels next to those in
    the list are assigned if they exceed the threshold, and their indices
    are kept in a new list. The new list is transferred to the old list
    and the process iteratively continued until the new list contains
    no more voxels.

Definition at line 121 of file Bimage_segment.cpp.

  long Bimage::region_flood (Bimage * pmask, double threshold_hi, double threshold_lo, double threshold_step, int fill_borders)

Creates and expands a region map from a starting to ending threshold value.

Parameters:
    *pmask region map (if NULL, generate from high threshold).
    threshold_hi the level to pick initial regions.
    threshold_lo the lowest level to include voxels in regions.
    threshold_step the incremental change in threshold.
    fill_borders flag to assign borders between regions (default not).

Returns:
    long number of regions.

    A region map is calculated at the threshold furthest from the average.
    The region map is then expanded by lowering the threshold gradually
    and assigning newly included voxels to neighboring regions (i.e., flooding).
    Voxels with neighbours assigned to two or more different regions are tagged
    as indeterminate to indicate borders between regions. These border voxels
    are counted and can be used to estimate the extent of interfaces.
    The indices of all the final regions are packed into an integer data block
    within a new image.

Definition at line 257 of file Bimage_segment.cpp.

  Bimage * Bimage::region_peaks (long kernel_size, double threshold, int flood = 0, int wrap = 0)

Generates a segmented image from peaks above a threshold value.

Parameters:
    kernel_size size of kernel to determine peaks.
    threshold the lowest level to include voxels in regions.
    flood flag to flood to the threshold.
    wrap flag to wrap the kernel around image boundaries.

Returns:
    Bimage* integer image containing region index numbers.

    Every voxel with a value above the threshold is tagged by a pointer
    pointing to the highest value within a kernel.
    A peak is defined as pointing to itself, while every other voxel
    points towards a peak.
    The voxels in the mask are then iteratively assigned to the peaks
    they point to.
    The indices of all the final regions are packed into an integer data block
    within a new image.

Definition at line 470 of file Bimage_segment.cpp.

  int Bimage::region_threshold_series (double threshold_first, double threshold_last, double threshold_step)

Segments a map through a series of thresholds and reports results.

Parameters:
    threshold_first the level to pick initial regions.
    threshold_last the lowest level to include voxels in regions.
    threshold_step the incremental change in threshold.

Returns:
    int 0.

Definition at line 202 of file Bimage_segment.cpp.

  Bimage * Bimage::regions (double threshold, int sign)

Segments an image into contiguous regions.

Parameters:
    threshold the level at which things are ignored.
    sign sign controlling direction of thresholding.

Returns:
    Bimage* level mask with indexed regions.

    The image is segmented into contiguous regions where a region is
    defined as all those voxels exceeding the given threshold and
    adjacent to each other.
    This method uses a list to keep track of voxels assigned to a region.
    In subsequent iterations the non-assigned voxels next to those in
    the list are assigned if they exceed the threshold, and their indices
    are kept in a new list. The new list is transferred to the old list
    and the process iteratively continued until the new list contains
    no more voxels. The indices of all the regions are packed into
    an integer data block within a new image.
    The new image maps the indices of the regions starting from one to as
    many regions as were found (the maximum gives the number of regions).
    The new image has zeroes for all voxels outside the regions.

Definition at line 58 of file Bimage_segment.cpp.

  double Bimage::relative_density (Bimage * pmask)

Calculates the relative density in a region defined by a mask.

Parameters:
    *pmask a 4 level mask.

Returns:
    double relative density.

    The mask is assumed to have 4 levels:
    0       region of no interest
    1       region to estimate relative density
    2       reference region
    3       background region

Definition at line 3069 of file Bimage.cpp.

  int Bimage::replace (Bimage * img)

Replaces the data with that from the given image.

Parameters:
    *img source image.

Returns:
    int 0.

    The input image must be the same size as the receiving image.

Definition at line 2828 of file Bimage.cpp.

  int Bimage::replace (long nn, Bimage * img, long nr = 0)

Replaces one sub-image in an image structure.

Parameters:
    nn image number to replace.
    *img source image.
    nr source sub-image number.

Returns:
    int 0.

    The input image must be the same size as the receiving image.

Definition at line 2847 of file Bimage.cpp.

  int Bimage::replace (long nn, Bimage * img, long nr, double fill)

Replaces one sub-image in an image structure.

Parameters:
    nn image number to replace.
    *img source image.
    nr source sub-image number.
    fill fill vlue.

Returns:
    int 0.

    The input image may have a different size as the receiving image.

Definition at line 2869 of file Bimage.cpp.

  long Bimage::replace_maxima (double threshold)

Replaces maxima above a threshold using local averages.

Parameters:
    threshold threshold.

Returns:
    long number of voxels replaced.

    The image is first segemented into regions, each defined as a
    contiguous cluster of voxels with values above the threshold.
    Each region is encoded in an integer image, with all the values
    in this image set to the indices of the regions, or zero elsewhere.
    The regions are iteratively filled in, where in every iteration,
    the border values of the regions are replaced by the average
    of the neighbouring voxels outside the region. After each iteration,
    every region is shrunk by excluding the newly replaced voxels.

Definition at line 692 of file Bimage_segment.cpp.

  int Bimage::replicate_asymmetric_unit (Bsymmetry * sym)

Calculates a full map from one asymmetric unit.

Parameters:
    *sym symmetry structure.

Returns:
    int 0.

    A reference view for each point group is generated such that it is
    located close to the center of the canonical asymmetric unit.
    For each voxel in the target map, a set of symmetry-related views
    are generated and the one closest to the reference view used
    to determine the corresponding voxels within the asymmetric unit.
    The new voxel value is calculated by trilinear interpolation of the
    voxels in the asymmetric unit.

Definition at line 971 of file Bimage_symmetry.cpp.

  int Bimage::rescale (double scale, double shift)

Rescales the image data with a given multiplier and offset.

Parameters:
    scale multiplier.
    shift addition or offset.

Returns:
    int error code.

    The new data is calculated as:
        new_datum = datum*scale + shift
    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 27 of file Bimage_rescale.cpp.

  int Bimage::rescale (long nn, double scale, double shift)

Rescales the image data with a given multiplier and offset.

Parameters:
    nn sub-image.
    scale multiplier.
    shift addition or offset.

Returns:
    int error code.

    Requirement: The images must have the same size.

Definition at line 62 of file Bimage_rescale.cpp.

  int Bimage::rescale_to_avg_std (double nuavg, double nustd)

Rescales the image data to a given average and standard deviation.

Parameters:
    nuavg new average.
    nustd new standard deviation.

Returns:
    int error code.

    The new data is calculated as:
                                    new_std_dev
        new_datum = (datum - avg) * ----------- + new_avg
                                      std_dev
    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 163 of file Bimage_rescale.cpp.

  int Bimage::rescale_to_avg_std (long nn, double nuavg, double nustd)

Rescales the image data to a given average and standard deviation.

Parameters:
    nn sub-image.
    nuavg new average.
    nustd new standard deviation.

Returns:
    int error code.

    The new data is calculated as:
                                    new_std_dev
        new_datum = (datum - avg) * ----------- + new_avg
                                      std_dev
    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 199 of file Bimage_rescale.cpp.

  int Bimage::rescale_to_avg_std (double nuavg, double nustd, Bimage * pmask)

Rescales the image data to a given average and standard deviation.

Parameters:
    nuavg new average.
    nustd new standard deviation.
    *pmask statistical calculations limited to the masked region.

Returns:
    int error code.

    The new data is calculated as:
                                    new_std_dev
        new_datum = (datum - avg) * ----------- + new_avg
                                      std_dev
    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 235 of file Bimage_rescale.cpp.

  int Bimage::rescale_to_min_max (double numin, double numax)

Rescales the image data to a given minimum and maximum.

Parameters:
    numin new minimum.
    numax new maximum.

Returns:
    int error code.

    The new data is calculated as:
                                    new_max - new_min
        new_datum = (datum - min) * ----------------- + new_min
                                        max - min
    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 100 of file Bimage_rescale.cpp.

  int Bimage::rescale_to_min_max (long nn, double numin, double numax)

Rescales the image data to a given minimum and maximum.

Parameters:
    nn sub-image.
    numin new minimum.
    numax new maximum.

Returns:
    int error code.

    The new data is calculated as:
                                    new_max - new_min
        new_datum = (datum - min) * ----------------- + new_min
                                        max - min
    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 132 of file Bimage_rescale.cpp.

  int Bimage::resize (Vector3< long > nusize, Vector3< long > translate, int fill_type = 0, double fill = 0)

Resizes without interpolation or rescaling.

Parameters:
    nusize new image size three-value vector.
    translate three-value translation vector.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER
    fill value to fill in new regions.

Returns:
    int 0.

    An image is resized with translation and filling of new regions with
    a given value.

Definition at line 28 of file Bimage_resize.cpp.

  Bimage * Bimage::resize_copy (Vector3< long > nusize, Vector3< long > translate, int fill_type = 0, double fill = 0)

Resizes without interpolation or rescaling.

Parameters:
    nusize new image size three-value vector.
    translate three-value translation vector.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER
    fill value to fill in new regions.

Returns:
    Bimage* resized image.

    An image is resized with translation and filling of new regions with
    a given value.

Definition at line 126 of file Bimage_resize.cpp.

  int Bimage::resize_wrap (Vector3< long > nusize, Vector3< long > translate)

Resizes without interpolation or rescaling.

Parameters:
    nusize new image size three-value vector.
    translate three-value translation vector.

Returns:
    int 0.

    An image is resized with translation and filling of new regions with
    a given value.

Definition at line 205 of file Bimage_resize.cpp.

  Bimage * Bimage::resize_wrap_copy (Vector3< long > nusize, Vector3< long > translate)

Resizes with wrapping without interpolation or rescaling.

Parameters:
    nusize new image size three-value vector.
    translate three-value translation vector.

Returns:
    Bimage* resized image.

    An image is resized with translation and filling of new regions with
    a given value.

Definition at line 283 of file Bimage_resize.cpp.

  void Bimage::reslice (const char * order) [inline]

Definition at line 709 of file Bimage.h.

  void Bimage::reslice (Bstring order)

Switches axes of an image.

Parameters:
    order string encoding the reslicing order.

    Reslicing refers to switching the axes of a multidimensional image.
    The equivalent is rotation around angles that are multiples of pi/2.
    The reslicing is encoded as a string of x, y and z, with the order
    and sign indicating the type of reslicing to be done.
    The new data replaces the old data.

Definition at line 3134 of file Bimage.cpp.

  Bimage * Bimage::resolution_prepare (Bimage * p)

Definition at line 17 of file Bimage_resolution.cpp.

  Bimage * Bimage::resolution_prepare (Bimage * p, fft_plan plan)

Definition at line 46 of file Bimage_resolution.cpp.

  RGB< double > Bimage::rgb (long j)

Returns a color value at the given index.

Parameters:
    j index.

Returns:
    RGB<double> the color value.

    The index refers to compound values.

Definition at line 1033 of file Bimage.cpp.

  void Bimage::rgb_to_cmyk ()

Converts an RGB color image to CMYK.

Definition at line 176 of file Bimage_color.cpp.

  void Bimage::rgb_to_rgba ()

An alpha channel is added to a RGB color image.

The alpha channel value is set to 255.

Definition at line 122 of file Bimage_color.cpp.

  RGBA< double > Bimage::rgba (long j)

Returns a color value at the given index.

The index refers to compound values.

Parameters:
    j index.

Returns:
    RGBA<double> the color value.

Definition at line 1047 of file Bimage.cpp.

  void Bimage::rgba_to_rgb ()

The alpha channel is delete from an RGBA color image.

Definition at line 149 of file Bimage_color.cpp.

  int Bimage::rotate ()

Rotates an image using parameters defined in the image in place.

Returns:
    0 error code.

    The image is rotated according to the view and origin encoded
    for the sub-image.

Definition at line 253 of file Bimage_transform.cpp.

  int Bimage::rotate (double angle)

Rotates an image around the z-axis by the given angle in place.

Parameters:
    angle rotation angle in radians.

Returns:
    0 error code.

    The image is rotated according to the axis and angle given.

Definition at line 272 of file Bimage_transform.cpp.

  int Bimage::rotate (Vector3< double > axis, double angle)

Rotates an image using an axis and angle in place.

Parameters:
    axis 3-value rotation axis.
    angle rotation angle in radians.

Returns:
    0 error code.

    The image is rotated according to the axis and angle given.

Definition at line 292 of file Bimage_transform.cpp.

  int Bimage::rotate (View view)

Rotates an image to a specified view in place.

Parameters:
    *view view vector and angle.

Returns:
    0 error code.

    An image is rotated according to the input view vector and angle.
    The input image origin is the rotation center.
    The rotated image is translated to the input origin.

Definition at line 312 of file Bimage_transform.cpp.

  int Bimage::rotate (Vector3< double > translate, View view)

Rotates an image to a specified view in place.

Parameters:
    translate translation after rotation.
    *view view vector and angle.

Returns:
    0 error code.

    An image is rotated according to the input view vector and angle.
    The input image origin is the rotation center.
    The rotated image is translated to the input origin.

Definition at line 330 of file Bimage_transform.cpp.

  int Bimage::rotate (Matrix3 mat)

Rotates an image using the specified matrix.

Parameters:
    mat 3x3 rotation matrix.

Returns:
    0 error code.

    An image is rotated according to the input matrix.
    The input image origin is the rotation center.

Definition at line 349 of file Bimage_transform.cpp.

  int Bimage::rotate (Vector3< double > translate, Matrix3 mat)

Rotates an image using the specified shift and matrix.

Parameters:
    translate translation after rotation.
    mat 3x3 rotation matrix.

Returns:
    0 error code.

    An image is rotated according to the input view vector and angle.
    The input image origin is the rotation center.
    The rotated image is translated to the input origin.

Definition at line 369 of file Bimage_transform.cpp.

  Bimage * Bimage::rotate (Vector3< long > nusize)

Rotates an image using parameters defined in the image.

Parameters:
    nusize 3-value new image size.

Returns:
    Bimage* rotated image.

    The image is rotated according to the view and origin encoded
    for the sub-image.

Definition at line 387 of file Bimage_transform.cpp.

  Bimage * Bimage::rotate (Vector3< long > nusize, double angle)

Rotates an image around the z-axis by the given angle.

Parameters:
    nusize 3-value new image size.
    angle rotation angle in radians.

Returns:
    Bimage* rotated image.

    The image is rotated according to the axis and angle given.

Definition at line 407 of file Bimage_transform.cpp.

  Bimage * Bimage::rotate (Vector3< long > nusize, Vector3< double > axis, double angle)

Rotates an image using an axis and angle.

Parameters:
    nusize 3-value new image size.
    axis 3-value rotation axis.
    angle rotation angle in radians.

Returns:
    Bimage* rotated image.

    The image is rotated according to the axis and angle given.

Definition at line 428 of file Bimage_transform.cpp.

  Bimage * Bimage::rotate (Vector3< long > nusize, View view)

Rotates an image to a specified view.

Parameters:
    nusize 3-value new image size.
    *view view vector and angle.

Returns:
    Bimage* rotated image.

    An image is rotated according to the input view vector and angle.
    The input image origin is the rotation center.
    The rotated image is translated to the input origin.

Definition at line 449 of file Bimage_transform.cpp.

  Bimage * Bimage::rotate (Vector3< long > nusize, Vector3< double > translate, View view)

Rotates an image to a specified view.

Parameters:
    nusize 3-value new image size.
    translate translation after rotation.
    *view view vector and angle.

Returns:
    Bimage* rotated image.

    An image is rotated according to the input view vector and angle.
    The input image origin is the rotation center.
    The rotated image is translated to the input origin.

Definition at line 468 of file Bimage_transform.cpp.

  Bimage * Bimage::rotate (Vector3< long > nusize, Matrix3 mat)

Rotates an image using the specified matrix.

Parameters:
    nusize new image size.
    mat 3x3 rotation matrix.

Returns:
    Bimage* rotated image.

    An image is rotated according to the input matrix.
    The input image origin is the rotation center.

Definition at line 488 of file Bimage_transform.cpp.

  int Bimage::rotate_and_add (Bimage * p, Vector3< double > origin, View view)

Rotates an image to a specified view and adds it to another image.

Parameters:
    *p the image to rotate and add (modified).
    origin origin in input image.
    *view view vector and angle.

Returns:
    int 0.

    An image is rotated according to the input view vector and angle.
    The input image origin is the rotation center.
    The rotated image is translated to the input origin.
    The result is added to the current image.

Definition at line 510 of file Bimage_transform.cpp.

  double Bimage::rotate_correlate (Vector3< double > axis, double angle)

Rotates a copy of an image and correlates it with the original.

Parameters:
    axis rotation axis.
    angle rotation angle.

Returns:
    double correlation coefficient, -1 if error.

    This mainly used to determine the symmetry of a map.

Definition at line 195 of file Bimage_correlate.cpp.

  Vector3< double > Bimage::rotate_cross_correlate (Bimage * pref, View view, double hires, double lores, double search_radius, Bimage * pmask, double & cc, fft_plan planf, fft_plan planb)

Definition at line 804 of file Bimage_correlate.cpp.

  double Bimage::rotate_cross_correlate_two_way (Bimage * pref, double angle, double res_hi, double res_lo, double shift_limit, fft_plan planf, fft_plan planb)

Definition at line 862 of file Bimage_correlate.cpp.

  Vector3< double > Bimage::rotate_find_shift (Matrix3 mat, double hires, double lores, double radius, double sigma, int refine_flag, fft_plan planf, fft_plan planb, double & cc)

Rotates and find shift by cross-correlation.

Parameters:
    mat rotation matrix.
    hires high resolution limit in angstroms.
    lores low resolution limit in angstroms.
    radius search radius.
    sigma soften search radius cutoff.
    refine_flag refine shift.
    planf forward Fourier transform plan.
    planb backward Fourier transform plan.k
    &cc correlation coefficient

Returns:
    Vector3<double> origin.

    The point group symmetry operations are applied to an image with an
    orientation defined by the reference symmetry axis (default {0,0,1}).

Definition at line 1306 of file Bimage_correlate.cpp.

  Bimage * Bimage::rotate_height (Matrix3 mat, Vector3< double > translate, double threshold = 0)

Rotates a 3D map and calculates the height along the z-axis.

Parameters:
    mat 3x3 rotation or skewing matrix.
    translate 3-value vector for translation after transformation.
    threshold density threshold to consider as object.

Returns:
    Bimage* new 2D height image.

    The 3D map is rotated around its center as origin and the height
    calculated along the z-direction.
    The resultant 2D image is translated if the translation vector is
    non-zero.
    The rotation origin is obtained from the map origin.

Definition at line 164 of file Bimage_topo.cpp.

  Bimage * Bimage::rotate_project (Matrix3 mat, Vector3< double > translate, double radial_cutoff, int norm_flag = 1)

Rotates a 3D map and projects it along the z-axis.

Parameters:
    mat 3x3 rotation or skewing matrix.
    translate 3-value vector for translation after transformation.
    radial_cutoff spherical cutoff to apply.
    norm_flag flag to normalize projection.

Returns:
    Bimage* new 2D projection image.

    The 3D map is rotated around its center as origin and the data
    integrated along the z-direction after subtraction of the
    background (which must be calculated before this function).
    The resultant 2D image is translated if the translation vector is
    non-zero. A radial cutoff can be applied to decrease the computation
    time. A value of zero or less sets the default to the length of the
    x-axis (i.e., no effective cutoff).
    The rotation origin is obtained from the map origin.

Definition at line 118 of file Bimage_project.cpp.

  long Bimage::rotate_to_axis (Bsymmetry * sym, long axis, long axis_flag)

Rotates to a symmetry axis.

Parameters:
    *sym symmetry structure.
    axis desired symmetry axis order.
    axis_flag view modifier.

Returns:
    long 0.

Definition at line 558 of file Bimage_symmetry.cpp.

  Vector3<double> Bimage::sampling () [inline]

Definition at line 505 of file Bimage.h.

  void Bimage::sampling (long nn, Vector3< double > u) [inline]

Definition at line 518 of file Bimage.h.

  void Bimage::sampling (long nn, double ux, double uy, double uz) [inline]

Definition at line 521 of file Bimage.h.

  void Bimage::sampling (Vector3< double > u) [inline]

Definition at line 524 of file Bimage.h.

  void Bimage::sampling (double ux, double uy, double uz) [inline]

Definition at line 527 of file Bimage.h.

  Vector3<double> Bimage::sampling (long nn) [inline]

Definition at line 530 of file Bimage.h.

  Bimage * Bimage::scale_to_reference (Bimage * pref, Bimage * pmask, double scalemin, double scalemax, double step)

Scales and image to the given reference, searching for the correct scale.

Parameters:
    pref reference/template image.
    pmask mask to limit correlation calculation (can be NULL).
    scalemin minimum scaling to start search.
    scalemax maximum scaling to end search.
    step scaling search step size.

Returns:
    Bimage* scaled image.

Definition at line 764 of file Bimage_transform.cpp.

  Bimage * Bimage::scale_to_reference (Bimage * pref, Bimage * pmask = NULL)

Scales and image to the given reference, searching for the correct scale.

Parameters:
    pref reference/template image.
    pmask mask to limit correlation calculation (can be NULL).

Returns:
    Bimage* scaled image.

Definition at line 822 of file Bimage_transform.cpp.

  Bimage * Bimage::scale_to_same_size (Bimage * pref)

Scales and image to the given reference.

Parameters:
    pref reference/template image.

Returns:
    Bimage* scaled image.

Definition at line 740 of file Bimage_transform.cpp.

  Bplot * Bimage::seamed_helix_symmetrize (double helix_rise, double helix_angle, double seam_shift, int dyad_axis, int zmin, int zmax, double radius, int norm_flag)

Symmetrizes an image given helical symmetry parameters and seam shift parameter.

Parameters:
    helix_rise rise per asymmetric unit (angstrom).
    helix_angle rotation angle per asymmetric unit (radians).
    seam_shift translation along the seam (subunit height units).
    dyad_axis dyad axis indicator: 2=dyad axis on x-axis, otherwise none.
    zmin mimimum z slice to include.
    zmax maximum z slice to include.
    radius radius to do symmetrizing over (pixels).
    norm_flag if 1, normalize

Returns:
    Bplot* plot.

    The data between the z limits are replicated along the helical axis
    according to the helical rise and rotation and the seam to fill the new volume.

Definition at line 280 of file Bimage_helix.cpp.

  double Bimage::search_views (Bimage * ptemp, View * views, double hires, double lores, double search_radius, Bimage * pmask, View & currview, Vector3< double > & currshift)

Searches a 2D/3D density map for a template.

Parameters:
    *ptemp the template to be searched for.
    *views list of views to search.
    hires high resolution limit.
    lores low resolution limit.
    search_radius radius for shift search.
    *pmask mask for cross-correlation (ignored if NULL).
    &currview best current view to return.
    &currshift best current shift to return.

Returns:
    double the best correlation coefficient.

    The template is rotated and cross-correlated to find the best fit.
    The views must be calculated externally to allow for custom sets.

Definition at line 34 of file Bimage_search.cpp.

  Bimage * Bimage::search_volume (Bimage * ptemp, View * view, double alpha, double alpha_step, double hires, double lores, Bimage * pmask, double threshold)

Searches a 2D/3D density map for a template.

Parameters:
    *ptemp the template to be searched for.
    *view views.
    alpha rotation around view vector, <0 = use 2*PI (radians).
    alpha_step angular step size around view vector (radians).
    hires high resolution limit.
    lores low resolution limit.
    *pmask mask for cross-correlation (ignored if NULL).
    threshold threshold value, if 0, threshold = FOMmax/2.

Returns:
    Bimage* image with the best view at each voxel and FOM block.

    The template is rotated and cross-correlated to find the best fit.
    The views must be calculated externally to allow for custom sets.

Definition at line 208 of file Bimage_search.cpp.

  double Bimage::search_volume_view (Bimage * ptemp, View view, double hires, double lores, Bimage * pmask, double threshold, Bimage * pfit)

Searches a 2D/3D density map for a template using a specific view.

Parameters:
    *ptemp the template to be searched for.
    view view.
    hires high resolution limit.
    lores low resolution limit.
    *pmask mask for cross-correlation (ignored if NULL).
    threshold threshold value, if 0, threshold = FOMmax/2.
    *pfit view image with FOM block to hold results.

Returns:
    double maximum FOM.

    The template is rotated to the view and cross-correlated.
    A view image is updated with the results where the correlation coefficients are higher.
    The views must be calculated externally to allow for custom sets.

Definition at line 151 of file Bimage_search.cpp.

  long Bimage::select_images (Bstring list)

Definition at line 2168 of file Bimage.cpp.

  void Bimage::set (long j, double v)

Sets a single value at the given index.

Parameters:
    j index.
    v value.

Definition at line 1096 of file Bimage.cpp.

  void Bimage::set (long j, Complex< double > cv)

Sets a complex value at the given index.

Parameters:
    j index.
    cv complex value.

    The index refers to compound values.

Definition at line 1129 of file Bimage.cpp.

  void Bimage::set (long j, RGB< double > color)

Sets a color value at the given index.

Parameters:
    j index.
    color color value.

    The index refers to compound values.

Definition at line 1145 of file Bimage.cpp.

  void Bimage::set (long j, RGBA< double > color)

Sets a color value at the given index.

Parameters:
    j index.
    color color value.

    The index refers to compound values.

Definition at line 1164 of file Bimage.cpp.

  void Bimage::set (long j, CMYK< double > color)

Sets a color value at the given index.

Parameters:
    j index.
    color color value.

    The index refers to compound values.

Definition at line 1184 of file Bimage.cpp.

  void Bimage::set (long j, Vector3< double > vec)

Sets a 3-value vector at the given index.

Parameters:
    j index.
    vec 3-value vector.

    The index refers to compound values.

Definition at line 1204 of file Bimage.cpp.

  void Bimage::set (long j, View view)

Sets a 3-value vector at the given index.

Parameters:
    j index.
    view 4-value view.

    The index refers to compound values.

Definition at line 1222 of file Bimage.cpp.

  void Bimage::set_max (double xx, double yy, double zz, long nn, double v)

Sets a value at a given location to neigboring data elements if it is larger.

Parameters:
    xx x location.
    yy y location.
    zz z location.
    nn image number (4 th dimension).
    v value to assess and set.

    All neighboring voxels are checked and set to the given value if it is larger.

Definition at line 1281 of file Bimage.cpp.

  void Bimage::set_time (time_t t) [inline]

Definition at line 249 of file Bimage.h.

  void Bimage::set_time (tm * t) [inline]

Definition at line 250 of file Bimage.h.

  int Bimage::shape (int type, Vector3< long > rect, Vector3< double > start, double width, int fill_type = 0, double fill = 0)

Creates a shape in an image and fills it with a constant value.

Parameters:
    type type of shape: 0=rectangle, 1=oval, 2=cylinder
    rect three-value size of the area to be filled.
    start three-value start of area.
    width gaussian width of smoothing function.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill fill value.

Returns:
    int 0.

    The edge of the area is smoothed with a function:
                        v_old(x,y,z) + fill*exp(1.618*dist/width)
        v_new(x,y,z) = ------------------------------------------
                               1 + exp(1.618*dist/width)
    where   fill is the constant fill value.
            dist is the distance to the rectangular boundary defined by
                the input size and start
            width is the gaussian width (softness)
    With very small values of the gaussian width, the edge approaches a
    step function.

Definition at line 103 of file Bimage_edit.cpp.

  int Bimage::shape (long nn, int type, Vector3< long > rect, Vector3< double > start, double width, int fill_type = 0, double fill = 0)

Creates a shape in an image and fills it with a constant value.

Parameters:
    type type of edge: 0=rectangle, 1=oval, 2=cylinder
    nn sub-image.
    rect three-value size of the area to be filled.
    start three-value start of area.
    width gaussian width of smoothing function.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill fill value.

Returns:
    int 0.

    The edge of the area is smoothed with a function:
                        v_old(x,y,z) + fill*exp(1.618*dist/width)
        v_new(x,y,z) = ------------------------------------------
                               1 + exp(1.618*dist/width)
    where   fill is the constant fill value.
            dist is the distance to the rectangular boundary defined by
                the input size and start
            width is the gaussian width (softness)
    With very small values of the gaussian width, the edge approaches a
    step function.

Definition at line 137 of file Bimage_edit.cpp.

  int Bimage::shell (Vector3< double > center, double minrad, double maxrad, double width, int fill_type = 0, double fill = 0)

Fills a shell within an image with a uniform value.

Parameters:
    center center of shell.
    minrad minimum radius of shell.
    maxrad maximum radius of shell.
    width gaussian width of smoothing function.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill fill value.

Returns:
    int 0.

    All voxels within a shell at a given location and within given radii
    are set to a given fill value.
    The new data replaces the old data.
    The default center is {0,0,0}.

Definition at line 544 of file Bimage_edit.cpp.

  int Bimage::shell (long nn, Vector3< double > center, double minrad, double maxrad, double width, int fill_type = 0, double fill = 0)

Fills a shell within an image with a uniform value.

Parameters:
    nn sub-image.
    center center of shell.
    minrad minimum radius of shell.
    maxrad maximum radius of shell.
    width gaussian width of smoothing function.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill fill value.

Returns:
    int 0.

    All voxels within a shell at a given location and within given radii
    are set to a given fill value.
    The new data replaces the old data.
    The default center is {0,0,0}.

Definition at line 572 of file Bimage_edit.cpp.

  int Bimage::shell_wrap (long nn, Vector3< double > center, double minrad, double maxrad, double width, int fill_type = 0, double fill = 0)

Fills a shell within an image with a uniform value with wrapping.

Parameters:
    nn sub-image.
    center center of shell.
    minrad minimum radius of shell.
    maxrad maximum radius of shell.
    width gaussian width of smoothing function.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill fill value.

Returns:
    int 0.

    All voxels within a shell at a given location and within given radii
    are set to a given fill value.
    The new data replaces the old data.
    The default center is {0,0,0}.

Definition at line 654 of file Bimage_edit.cpp.

  int Bimage::shift (Vector3< double > vec, int fill_type = 0, double fill = 0)

Shifts an image.

Parameters:
    vec 3-value real space shift vector.
    fill_type fill type for filling empty regions.
    fill value to fill in empty regions.

Returns:
    int error code.

Definition at line 587 of file Bimage_transform.cpp.

  int Bimage::shift (long nn, Vector3< double > vec, int fill_type = 0, double fill = 0)

Shifts one sub-image.

Parameters:
    nn sub-image.
    vec 3-value real space shift vector.
    fill_type fill type for filling empty regions.
    fill value to fill in empty regions.

Returns:
    int error code.

Definition at line 603 of file Bimage_transform.cpp.

  int Bimage::shift_background (double bkg)

Sets the background for each sub-image to a given value.

Parameters:
    bkg new background value.

Returns:
    int 0, <0 on error.

    The background is taken as the average of the values outside the
    circle or sphere enclosed by the image.

Definition at line 351 of file Bimage_background.cpp.

  int Bimage::shift_wrap (Vector3< double > vec)

Shifts an image.

Parameters:
    vec 3-value real space shift vector.

Returns:
    int error code.

Definition at line 643 of file Bimage_transform.cpp.

  int Bimage::shift_wrap (long nn, Vector3< double > vec)

Shifts one sub-image with wrapping.

Parameters:
    nn sub-image.
    vec 3-value real space shift vector.

Returns:
    int error code.

Definition at line 657 of file Bimage_transform.cpp.

  long Bimage::show_image () [inline]

Definition at line 552 of file Bimage.h.

  void Bimage::show_image (long nn) [inline]

Definition at line 553 of file Bimage.h.

  double Bimage::show_maximum () [inline]

Definition at line 559 of file Bimage.h.

  void Bimage::show_maximum (double v) [inline]

Definition at line 561 of file Bimage.h.

  double Bimage::show_minimum () [inline]

Definition at line 558 of file Bimage.h.

  void Bimage::show_minimum (double v) [inline]

Definition at line 560 of file Bimage.h.

  double Bimage::show_scale () [inline]

Definition at line 556 of file Bimage.h.

  void Bimage::show_scale (double scale) [inline]

Definition at line 557 of file Bimage.h.

  long Bimage::show_slice () [inline]

Definition at line 554 of file Bimage.h.

  void Bimage::show_slice (long nz) [inline]

Definition at line 555 of file Bimage.h.

  int Bimage::shrink_wrap (Vector3< long > nusize, Vector3< long > translate)

Shrinks an image to a new size with wrapping of the excluded edges.

Parameters:
    nusize new image size three-value vector.
    translate three-value translation vector.

Returns:
    int 0.

    An image is resized to a smaller size with translation and wrapping
    of the excluded edges to complete periodic boundaries. The image is
    first converted to floating point to prevent overflows of smaller
    data types. The new image is finally converted back to the original
    data type.
    The new data replaces the old data.

Definition at line 436 of file Bimage_resize.cpp.

  void Bimage::simple_to_complex ()

A simple image is converted to a complex image.

The input image is written into the real part of the complex image.

Definition at line 22 of file Bimage_complex.cpp.

  void Bimage::simple_to_rgb ()

A simple image is converted to a color image.

All three color values in each voxel are the same (i.e., gray).

Definition at line 21 of file Bimage_color.cpp.

  void Bimage::simple_to_rgba ()

A simple image is converted to a color image.

All three color values in each voxel are the same (i.e., gray).
The alpha value is set to 255.

Definition at line 58 of file Bimage_color.cpp.

  Vector3<long> Bimage::size () const [inline]

Definition at line 373 of file Bimage.h.

  void Bimage::size (long nx, long ny, long nz) [inline]

Definition at line 374 of file Bimage.h.

  void Bimage::size (Vector3< long > vec) [inline]

Definition at line 375 of file Bimage.h.

  void Bimage::size (vector< long > vec) [inline]

Definition at line 376 of file Bimage.h.

  void Bimage::sizeX (long nx) [inline]

Definition at line 377 of file Bimage.h.

  long Bimage::sizeX () const [inline]

Definition at line 380 of file Bimage.h.

  void Bimage::sizeY (long ny) [inline]

Definition at line 378 of file Bimage.h.

  long Bimage::sizeY () const [inline]

Definition at line 381 of file Bimage.h.

  void Bimage::sizeZ (long nz) [inline]

Definition at line 379 of file Bimage.h.

  long Bimage::sizeZ () const [inline]

Definition at line 382 of file Bimage.h.

  int Bimage::slices_to_images ()

Changes the slices in a 3D image into a set of 2D images.

Returns:
    int error code (<0 means failure).

Definition at line 2052 of file Bimage.cpp.

  void Bimage::smallest (Bimage * p)

Selects the smallest of each pixel from two images.

Parameters:
    *p other image.

Definition at line 3730 of file Bimage.cpp.

  double Bimage::snvariance (double snradius)

Calculates the ratio of variance inside and outside a given radius.

Parameters:
    snradius radius of signal.

Returns:
    double the SNR.

    The region outside the radial limit is considered noise and the region
    inside is considered signal plus noise.

Definition at line 1467 of file Bimage_helix.cpp.

  long Bimage::space_group () [inline]

Definition at line 591 of file Bimage.h.

  void Bimage::space_group (unsigned int grp) [inline]

Definition at line 595 of file Bimage.h.

  int Bimage::sphere (Vector3< double > center, double radius, double width = 0, int fill_type = 0, double fill = 0)

Fills a sphere within an image with a uniform value.

Parameters:
    center three vector center of sphere.
    radius sphere radius.
    width gaussian width of smoothing function.
    fill_type FILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
    fill fill value.

Returns:
    int 0.

    All voxels within a sphere at a given location and with a given radius
    are increased by a given fill value.
    The new data replaces the old data.
    The default center is {0,0,0}.

Definition at line 438 of file Bimage_edit.cpp.

  void Bimage::split_channels ()

The channels are split into individual images.

The input image is replaced with a new image.

Definition at line 1924 of file Bimage.cpp.

  void Bimage::square ()

Calculates the square of an image.

Values less than zero are set to zero.
Values greater than the data type maximum are set to the maximum.

Definition at line 678 of file Bimage_rescale.cpp.

  void Bimage::square_root ()

Calculates the square root of an image.

Values less than zero are set to zero.
Values greater than the data type maximum are set to the maximum.

Definition at line 698 of file Bimage_rescale.cpp.

  double Bimage::standard_deviation () [inline]

Definition at line 537 of file Bimage.h.

  void Bimage::standard_deviation (double d) [inline]

Definition at line 541 of file Bimage.h.

  long Bimage::statistics ()

Calculates the statistics for an image.

Returns:
    long number of errors.

Definition at line 22 of file Bimage_stats.cpp.

  long Bimage::statistics (long img_num)

Calculates the statistics for a sub-image.

Parameters:
    img_num sub-image number.

Returns:
    long number of errors.

Definition at line 100 of file Bimage_stats.cpp.

  long Bimage::statistics (Bimage * pmask, double & regavg, double & regstd)

Calculates the statistics for a region in an image.

Parameters:
    *pmask region.
    &regavg region average to be calculated.
    &regstd region standard deviation to be calculated.

Returns:
    long number of voxels.

Definition at line 163 of file Bimage_stats.cpp.

  long Bimage::stats_in_mask (long nn, Bimage * pmask)

Calculates the statistics for an image for each level in a mask.

Parameters:
    nn sub-image number.
    *pmask mask with two or more levels

Returns:
    long number of levels (0 means failure).

Definition at line 486 of file Bimage_stats.cpp.

  long Bimage::stats_in_poly (long nn, int nvert, Vector3< double > * poly, double & vavg, double & vstd)

Calculates the statistics for an image within the given polyhedron.

Parameters:
    nn sub-image number.
    nvert number of polygon vertices.
    *poly array of polygon vertices.
    &vavg return value for the average.
    &vstd return value for the standard deviation.

Returns:
    long number of values (0 means failure).

    If a voxel lies within the specified polyhedron, it is included in
    the statistical calculations.

Definition at line 415 of file Bimage_stats.cpp.

  long Bimage::stats_in_shape (long nn, int type, Vector3< long > start, Vector3< long > end, double & vavg, double & vstd)

Calculates the statistics for an image within the given box.

Parameters:
    nn sub-image number.
    type type of selection: 1=rectangle, 2=ellipse.
    start starting coordinates.
    end ending coordinates.
    &vavg return value for the average.
    &vstd return value for the standard deviation.

Returns:
    long number of values (0 means failure).

    If a voxel lies within the specified box, it is included in
    the statistical calculations.

Definition at line 278 of file Bimage_stats.cpp.

  long Bimage::stats_within_radii (long nn, Vector3< double > loc, double rad_min, double rad_max, double & vavg, double & vstd)

Calculates the statistics for an image within given radii from a location.

Parameters:
    nn sub-image number.
    loc center of shell.
    rad_min minimum radius (pixel units).
    rad_max maximum radius (pixel units).
    &vavg return value for the average.
    &vstd return value for the standard deviation.

Returns:
    long number of values (0 means failure).

    If a voxel lies within the specified radii, it is included in
    the statistical calculations.

Definition at line 201 of file Bimage_stats.cpp.

  int Bimage::subimage_information ()

Prints out header information for all sub-images.

Returns:
    int error code (<0 means failure).

Definition at line 2564 of file Bimage.cpp.

  void Bimage::subtract (Bimage * p)

Subtracts another image from an image.

Parameters:
    *p image to be added.

    Requirement: The images must have the same size.

Definition at line 3403 of file Bimage.cpp.

  int Bimage::subtract_background ()

Subtracts the background for each sub-image.

Returns:
    int 0, <0 on error.

    The background is taken from the sub-image structures.

Definition at line 337 of file Bimage_background.cpp.

  void Bimage::sum (long m, Bimage ** p)

Sums an array of images with their FOM blocks.

Parameters:
    m number of images in the array.
    **p array of images.

    The images must all have the same dimensions.

Definition at line 23 of file Bimage_combine.cpp.

  void Bimage::sum_images ()

Adds all sub-images.

Definition at line 3303 of file Bimage.cpp.

  vector< Bsuperpixel > Bimage::superpixels (long step, double colorweight = 0.2, long iterations = 10, double stop = 1)

Segment the image into superpixels.

Parameters:
    step initial superpixel intervals.
    colorweight weight of color differences compared to spatial distances.
    iterations maximum number of iterations.
    stop stopping condition as a percent of voxel changes.

Returns:
    vector<Bsuperpixel> array of superpixels.

    The segment array contents are:
    0       count
    1-3     coordinates
    4+      channels
    last    color weight for the segment - maximum squared distance
    The mask is linked to the original image for return.

Definition at line 1812 of file Bimage_segment.cpp.

  vector< Bsuperpixel > Bimage::superpixels_from_mask (long cc, long step)

Create superpixels from a multilevel mask.

Parameters:
    cc number of channels in the original image.
    step distance limit to determine neigbors.

Returns:
    vector<Bsuperpixel> array of superpixels.

Definition at line 1761 of file Bimage_segment.cpp.

  int Bimage::superpixels_update (Bimage * pmask, vector< long > vstep, double colorweight, vector< Bsuperpixel > & seg)

Definition at line 1549 of file Bimage_segment.cpp.

  Bimage * Bimage::surface_to_topograph (double threshold, int dir = 0)

Converts a 3D image to a 2D height image.

Parameters:
    threshold threshold to define the surface (assuming positive density).
    dir direction: 0=bottom up, 1=top down.

Returns:
    Bimage* 2D height image.

    The threshold defines the surface of the positive density in the 3D image.
    Each line of voxels in the z-direction is scanned for the voxel
    exceeding the threshold with the highest z-index.

Definition at line 119 of file Bimage_topo.cpp.

  double Bimage::symmetrize (Bstring & symmetry_string, int flag) [inline]

Definition at line 1178 of file Bimage.h.

  double Bimage::symmetrize (Bsymmetry * sym, int flag) [inline]

Definition at line 1182 of file Bimage.h.

  double Bimage::symmetrize (Bstring & symmetry_string, View ref_view, int flag) [inline]

Definition at line 1186 of file Bimage.h.

  double Bimage::symmetrize (Bsymmetry * sym, View ref_view, int flag)

Applies point group symmetry to an image.

Parameters:
    *sym point group.
    ref_view reference view vector and rotation angle.
    flag flag to normalize after symmetrization.

Returns:
    double symmetry FOM.

    The point group symmetry operations are applied to an image with an
    orientation defined by the reference symmetry axis (default {0,0,1}).
    The fill value is taken from image's background value.
    The symmetry FOM is taken as the ratio of the power after to before
    symmetrization.

Definition at line 31 of file Bimage_symmetry.cpp.

  Bimage * Bimage::symmetrize_cylinder (int flag)

Calculates a cylindrically symmetrized map.

Parameters:
    flag 0:

Returns:
    Bimage* 2D image with the cylindrical average.

    A 2D cylindrically symmetrized average is calculated.

Definition at line 524 of file Bimage_helix.cpp.

  int Bimage::symmetrize_cylinder ()

Calculates a cylindrically symmetrized map.

Returns:
    int 0.

    The image is replaced with its cylindrically symmetrized version.

Definition at line 585 of file Bimage_helix.cpp.

  string& Bimage::symmetry () [inline]

Definition at line 596 of file Bimage.h.

  void Bimage::symmetry (string grp) [inline]

Definition at line 600 of file Bimage.h.

  Matrix3 Bimage::symmetry_equivalent (Bimage * pref, Bimage * pmask, Bsymmetry * sym)

Finds the symmetry equivalent orientation of a particle with respect to a template.

Parameters:
    *pref template to test against (same size as input image).
    *pmask mask to limit correlation calculation.
    *sym symmetry structure.

Returns:
    Matrix3 transformed image.

    For point groups up to tetrahedral symmetry, there is an ambiguity in the
    orientation of a particle even though it is oriented according to the
    standard orientation for the symmetry.
    A template is used to select the desired orientation and the image is transformed.
    Both the input image and template must be in the standard orientation
    for the point group.

Definition at line 654 of file Bimage_symmetry.cpp.

  Matrix3 Bimage::symmetry_equivalent_cyclic (Bimage * pref, Bimage * pmask, Bsymmetry * sym)

Finds the cyclic symmetry equivalent orientation of a particle with respect to a template.

Parameters:
    *pref template to test against (same size as input image).
    *pmask mask to limit correlation calculation.
    *sym symmetry structure.

Returns:
    Matrix3 transformed image.

    For point groups up to tetrahedral symmetry, there is an ambiguity in the
    orientation of a particle even though it is oriented according to the
    standard orientation for the symmetry.
    A template is used to select the desired orientation and the image is transformed.
    Both the input image and template must be in the standard orientation
    for the point group.

Definition at line 776 of file Bimage_symmetry.cpp.

  vector< Vector3< long > > Bimage::tile_coordinates (Vector3< long > & start, Vector3< long > & region, Vector3< long > & tile_size, Vector3< long > & step_size, int exceed)

Generates a set of tile coordinates for an image.

Parameters:
    &start 3-vector start for first tile to be extracted.
    &region 3-vector size of part of image to be extracted (0 = whole image).
    &tile_size 3-vector size of extracted image.
    &step_size 3-vector size of intervals between tiles.
    exceed flag to allow tiles to exceed the input image size.

Returns:
    Vector3<long>* set of coordinates.

    A set of tiles of specified size are extracted from a given sub-image
    in an image structure, starting from a point and generating
    as many tiles as would fit into the image size given. If the image size
    given is zero, then the whole image is used. The origins of the tiles
    are inserted into the sub-image origin fields.
    The old data is not affected.

Definition at line 263 of file Bimage_extract.cpp.

  Bimage * Bimage::tile_mask (long step)

Converts a mask to a tiled multilevel mask.

Parameters:
    step isotropic tile edge size.

Returns:
    Bimage* new mask.

    The old data is unmodified.

Definition at line 1415 of file Bimage_mask.cpp.

  long Bimage::to_mask () [inline]

Definition at line 1299 of file Bimage.h.

  long Bimage::to_mask (double threshold)

Change the image to a mask.

Returns:
    long number of mask voxels.

    The input image is effectively thresholded and a mask with 0 and 1 generated.
    The new data type is unsigned char/byte.

Definition at line 51 of file Bimage_mask.cpp.

  Bimage * Bimage::topograph_to_surface (Bimage * psd, long nz, double density, double resolution)

Converts a 2D AFM image to a 3D density map.

Parameters:
    *psd 2D standard deviation image.
    nz z dimension of the new 3D map.
    density density inside the surface (Da/A3).
    resolution sigma bounds.

Returns:
    int 0.

    The 2D image is expanded in the z direction according to:
                              voxel_density
    dens[x,y,z] = --------------------------------------
                  1+exp(factor*(z-zdis[x,y])/sigma[x,y])
    where   voxel_density is the total density attributed to a voxel
            factor = 1.618
            z - zdis[x,y] is the z distance from the surface
            sigma is a standard deviation term to describe the surface variability.
    The sigma term can be set automatically or given by an input standard deviation map.
    The position of the surface is calculated as:
    zdis[x,y] = loz + (hiz - loz)*(image[x,y] - min)/(max - min)
    where   loz and hiz are the lowest and highest points of the surface in the 3D map
            min and max are the image minimum and maximum values

Definition at line 39 of file Bimage_topo.cpp.

  int Bimage::transform (Vector3< double > scale, Vector3< double > origin, Vector3< double > translate, Matrix3 mat, int fill_type = 0, double fill = 0)

Transforms an image by translation, rotation, scaling and skewing, in place.

Parameters:
    scale 3-value scale factor vector to apply.
    origin 3-value origin for rotation and skewing.
    translate 3-value vector for translation after transformation.
    mat 3x3 rotation or skewing matrix.
    fill_type fill type for filling empty regions.
    fill value to fill in empty regions.

Returns:
    0 error code.

    A number of transformation types are combined in this function for
    efficiency. The basic operation is the conversion of the image data
    from the original data block to a new data block, applying a
    transformation matrix and translation vector with a specified origin
    followed by an optional translation:
        y = R*x + t
    where   R is the rotation/skewing/scaling matrix.
            t is the translation vector.
    Note: The image is converted to floating point to improve interpolation.

Definition at line 37 of file Bimage_transform.cpp.

  Bimage * Bimage::transform (Vector3< long > nusize, Vector3< double > scale, Vector3< double > origin, Vector3< double > translate, Matrix3 mat, int fill_type = 0, double fill = 0)

Transforms an image by translation, rotation, scaling and skewing, returning a new image.

Parameters:
    nusize 3-value new image size.
    scale 3-value scale factor vector to apply.
    origin 3-value origin for rotation and skewing.
    translate 3-value vector for translation after transformation.
    mat 3x3 rotation or skewing matrix.
    fill_type fill type for filling empty regions.
    fill value to fill in empty regions.

Returns:
    Bimage* new image.

    A number of transformation types are combined in this function for
    efficiency. The basic operation is the conversion of the image data
    from the original data block to a new data block, applying a
    transformation matrix and translation vector with a specified origin
    followed by an optional translation:
        y = R*x + t
    where   R is the rotation/skewing/scaling matrix.
            t is the translation vector.
    Note: The image is converted to floating point to improve interpolation.

Definition at line 75 of file Bimage_transform.cpp.

  Bimage * Bimage::transform (long nn, Vector3< long > nusize, Vector3< double > scale, Vector3< double > origin, Vector3< double > translate, Matrix3 mat, int fill_type = 0, double fill = 0)

Transforms a sub-image by translation, rotation, scaling and skewing, returning a single new image.

Parameters:
    nn sub-image to process.
    nusize 3-value new image size.
    scale 3-value scale factor vector to apply.
    origin 3-value origin for rotation and skewing.
    translate 3-value vector for translation after transformation.
    mat 3x3 rotation or skewing matrix.
    fill_type fill type for filling empty regions.
    fill value to fill in empty regions.

Returns:
    Bimage* new image.

    A number of transformation types are combined in this function for
    efficiency. The basic operation is the conversion of the image data
    from the original data block to a new data block, applying a
    transformation matrix and translation vector with a specified origin
    followed by an optional translation:
        y = R*x + t
    where   R is the rotation/skewing/scaling matrix.
            t is the translation vector.
    Note: The image is converted to floating point to improve interpolation.

Definition at line 136 of file Bimage_transform.cpp.

  int Bimage::transform_lines ()

Definition at line 1300 of file Bimage_helix.cpp.

  void Bimage::transform_voxel (long i, Bimage * pt, long nn, Vector3< double > oldorigin, Vector3< double > nuorigin, Matrix3 affmat, double fill)

Definition at line 102 of file Bimage_transform.cpp.

  int Bimage::truncate (double minim, double maxim, double setmin, double setmax)

Truncates image data to a given minimum and maximum.

Parameters:
    minim minimum.
    maxim maximum.
    setmin value to set voxels smaller than minimum.
    setmax value to set voxels larger than maximum.

Returns:
    int 0.

    All values smaller than the new minimum are set to the new minimum
    and all values larger than the new maximum are set to the new maximum.
    In cases where the given minimum and maximum are outside the data
    type ranges, they are reset to the data type range limits.
    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 277 of file Bimage_rescale.cpp.

  int Bimage::truncate_to_avg (double minim, double maxim)

Sets voxels in image data exceeding a given minimum and maximum to the average.

Parameters:
    minim minimum.
    maxim maximum.

Returns:
    int 0.

    All values smaller than the new minimum or larger than the new
    maximum are set to the image average.
    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 349 of file Bimage_rescale.cpp.

  int Bimage::truncate_to_background (double minim, double maxim)

Sets voxels in image data exceeding a given minimum and maximum to the image background.

Parameters:
    minim minimum.
    maxim maximum.

Returns:
    int 0.

    All values smaller than the new minimum or larger than the new
    maximum are set to the background value.
    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 367 of file Bimage_rescale.cpp.

  int Bimage::truncate_to_min_max (double minim, double maxim)

Truncates image data to a given minimum and maximum.

Parameters:
    minim minimum.
    maxim maximum.

Returns:
    int 0.

    All values smaller than the new minimum are set to the new minimum
    and all values larger than the new maximum are set to the new maximum.
    In cases where the given minimum and maximum are outside the data
    type ranges, they are reset to the data type range limits.
    The new data replaces the old data.
    Image statistics are recalculated.

Definition at line 331 of file Bimage_rescale.cpp.

  double Bimage::tube_interpolate (long i, int h, int k, double latconst, int zmin, int zmax, double radius, int norm_flag = 1)

Definition at line 73 of file Bimage_helix.cpp.

  double Bimage::tube_symmetrize (int h, int k, double latconst, int zmin, int zmax, double radius, int norm_flag = 1)

Symmetrizes an image given tubular lattice parameters.

Parameters:
    h units along u vector.
    k units along v vector.
    latconst lattice constant (angstrom).
    zmin mimimum z slice to include.
    zmax maximum z slice to include.
    radius radius to do symmetrizing over (pixels).
    norm_flag if 1, normalize

Returns:
    double R factor.

    The data between the z limits are replicated along the helical axis
    according to the lattice parameters to fill the new volume.

Definition at line 633 of file Bimage_helix.cpp.

  void Bimage::unit_cell (UnitCell uc) [inline]

Definition at line 601 of file Bimage.h.

  UnitCell Bimage::unit_cell () [inline]

Definition at line 608 of file Bimage.h.

  Bimage * Bimage::unpack_combined_transform ()

Unpacks a complex transform obtained from two real images.

Returns:
    Bimage* transform of second image.

    The complex image must be a Fourier transform obtained from two real
    space images which were packed into the real and imaginary parts
    of the complex image before Fourier transformation.
    The input image is used to hold the transform of the first image.
    A new image is created to hold the transform of the second image.
    Both these images are complex floating point.
    Note: Images with even dimensions cannot be unpacked exactly because
        the inverse is not present when x=nx/2 or y=ny/2 or z=nz/2.

Definition at line 749 of file Bimage_complex.cpp.

  int Bimage::unpack_transform (unsigned char * data, FourierType tf)

Definition at line 2337 of file Bimage.cpp.

  int Bimage::unpack_transform (int img_select, unsigned char * data, FourierType tf)

Definition at line 2342 of file Bimage.cpp.

  void Bimage::update_from_meta_data ()

Update sub-image information from the metadata.

The metadata in JSON format is transferred to the sub-image information.

Definition at line 702 of file Bimage.cpp.

  vector<double> Bimage::values (long i) [inline]

Definition at line 284 of file Bimage.h.

  void Bimage::values (long i, vector< double > val) [inline]

Definition at line 290 of file Bimage.h.

  double * Bimage::values (long nn, Vector3< double > vox)

Returns an array with all channel data at the given coordinates.

Parameters:
    nn image index.
    vox voxel coordinates.

Returns:
    double* value array.

    The values of all channels are returned in double precision.

Definition at line 980 of file Bimage.cpp.

  int Bimage::variance (long kernel_size)

Calculates the local variance within the given kernel.

Parameters:
    kernel_size size of kernel edge.

Returns:
    int 0.

    The local variance within a kernel is calculated.
    The calculation is threaded if compiled with GCD or OpenMP.

Definition at line 615 of file Bimage_stats.cpp.

  int Bimage::variance (Bimage * pweight)

Calculates the local variance weighed with the given image.

Parameters:
    pweight weight image.

Returns:
    int 0.

    The local variance is calculated using the given image as kernel weights.
    The calculation is threaded if compiled with GCD or OpenMP.

Definition at line 718 of file Bimage_stats.cpp.

  Bimage * Bimage::variance_mask (long kernel_size, double lowvar = 1e-6, int bkg_flag = 0)

Calculates a mask based on local variance.

Parameters:
    kernel_size size of kernel edge.
    lowvar low variance threshold.
    bkg_flag flag to generate a background with value -1.

Returns:
    Bimage* binary mask.

    The local variance within a kernel is calculated and used to generate the mask.
    A threshold is calculated to define the foreground and background.
    Excluded regions are defined by a low variance parameter.
    Foreground is set to 1, background is set to -1, excluded areas are set to 0.

Definition at line 1367 of file Bimage_mask.cpp.

  double Bimage::variance_threshold (double lowvar)

Calculates a threshold for a local variance image.

Parameters:
    lowvar low variance threshold.

Returns:
    double threshold.

    A threshold is calculated to define the foreground and background.
    Excluded regions are defined by a low variance parameter.

Definition at line 1308 of file Bimage_mask.cpp.

  Vector3< double > Bimage::vector3 (long j)

Returns a 3-value vector at the given index.

Parameters:
    j index.

Returns:
    Vector3<double> the 3-value vector.

    The index refers to compound values.

Definition at line 1019 of file Bimage.cpp.

  void Bimage::view (double vx, double vy, double vz, double va) [inline]

Definition at line 589 of file Bimage.h.

  void Bimage::view (View vw) [inline]

Definition at line 590 of file Bimage.h.

  double Bimage::voxel_size () [inline]

Definition at line 510 of file Bimage.h.

  bool Bimage::within_boundaries (Vector3< double > loc) [inline]

Definition at line 448 of file Bimage.h.

  bool Bimage::within_boundaries (long xx, long yy, long zz) [inline]

Definition at line 453 of file Bimage.h.

  int Bimage::write (Bstring & fn)

Definition at line 2320 of file Bimage.cpp.

  void Bimage::zero_fourier_origin ()

Zeroes the first voxel in each image.

Definition at line 2011 of file Bimage.cpp.

  int Bimage::zero_origin ()

Shifts the origins to zero with wrapping.

Returns:
    int error code.

Definition at line 727 of file Bimage_transform.cpp.

Member Data Documentation

  Bsub_image* Bimage::image

Definition at line 188 of file Bimage.h.

  Bimage* Bimage::next

Definition at line 165 of file Bimage.h.

Author

Generated automatically by Doxygen for Bsoft from the source code.