Bsoft  2.1.0
Bernard's software package
Bimage Class Reference

General image parameter class. More...

#include <Bimage.h>

Public Member Functions

 Bimage ()
 Initializes an image. More...
 
 Bimage (const Bimage &p)
 The copy constructor. More...
 
 Bimage (Bstring &fn, int readdata, int img_select)
 Reads an image from a file. More...
 
 Bimage (DataType type, CompoundType ctype, long nx, long ny, long nz, long nn)
 Initializes an image. More...
 
 Bimage (DataType type, CompoundType ctype, Vector3< long > size, long nn)
 Initializes an image. More...
 
 Bimage (DataType type, CompoundType ctype, vector< long > size, long nn)
 Initializes an image. More...
 
 Bimage (DataType type, long nc, long nx, long ny, long nz, long nn)
 Initializes a generic multi-channel image. More...
 
 Bimage (DataType type, long nc, Vector3< long > size, long nn)
 Initializes a generic multi-channel image. More...
 
 Bimage (Matrix &mat, long scale)
 Initializes an image from a 2D matrix. More...
 
 ~Bimage ()
 Image destructor. More...
 
void check ()
 Checks an image for reasonable properties. More...
 
bool check_if_same_size (Bimage *p)
 Check if two images are the same size. More...
 
bool check_if_same_image_size (Bimage *p)
 Check if two images are the same size. More...
 
void check_sampling ()
 Checks that the sampling is properly specified. More...
 
void check_resolution (double &resolution)
 Checks that the resolution falls within reasonable limits. More...
 
bool compatible (Bimage *p)
 Check if this image has the same number of channels and data type as another. More...
 
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. More...
 
void update_from_meta_data ()
 Update sub-image information from the metadata. More...
 
void meta_data_retain_one_image (long img_num)
 Erases all sub-image records from the meta data except one. More...
 
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_and_clear ()
 
unsigned char * data_alloc (long nbytes)
 Allocate image data. More...
 
unsigned char * data_alloc_and_clear (long nbytes)
 
unsigned char * data_alloc (DataType type, CompoundType ctype, long nx, long ny, long nz, long nn)
 Allocate image data with size parameters. More...
 
unsigned char * data_alloc_and_clear (DataType type, CompoundType ctype, long nx, long ny, long nz, long nn)
 
unsigned char * data_assign (unsigned char *nudata)
 Assign image data. More...
 
unsigned char * data_pointer ()
 
unsigned char * data_pointer (long offset)
 
void data_pointer (unsigned char *ptr)
 
void data_delete ()
 Deallocates the image data. More...
 
long data_offset ()
 
void data_offset (long doff)
 
long image_size ()
 
Bimage & operator= (const Bimage &p)
 Assigns an image. More...
 
double operator[] (long j) const
 Returns the data value at the given index. More...
 
double get (long nn, long xx, long yy, long zz, long cc=0)
 Returns the data value at the given coordinates. More...
 
double get (long nn, Vector3< double > vox, long cc=0)
 Returns the data value at the given coordinates. More...
 
vector< double > values (long i)
 
void values (long i, vector< double > val)
 
vector< double > values (long nn, Vector3< double > vox)
 Returns an array with all channel data at the given coordinates. More...
 
Complex< double > complex (long j)
 Returns a complex value at the given index. More...
 
Vector3< double > vector3 (long j)
 Returns a 3-value vector at the given index. More...
 
RGB< double > rgb (long j)
 Returns a color value at the given index. More...
 
RGBA< double > rgba (long j)
 Returns a color value at the given index. More...
 
CMYK< double > cmyk (long j)
 Returns a color value at the given index. More...
 
TypePointer fill_value (double v)
 
void set (long j, double v)
 Sets a single value at the given index. More...
 
void set (long j, Complex< double > cv)
 Sets a complex value at the given index. More...
 
void set (long j, RGB< double > color)
 Sets a color value at the given index. More...
 
void set (long j, RGBA< double > color)
 Sets a color value at the given index. More...
 
void set (long j, CMYK< double > color)
 Sets a color value at the given index. More...
 
void set (long j, Vector3< double > vec)
 Sets a 3-value vector at the given index. More...
 
void set (long j, View view)
 Sets a 3-value vector at the given index. More...
 
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. More...
 
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. More...
 
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. More...
 
double average (long cc, double xf, double yf, double zf, long nn, double iscale)
 Averages in 3D when scaling is less than 1. More...
 
double interpolate (long cc, double xx, double yy=0, double zz=0, long nn=0, double fill=0) const
 Interpolates using a given location. More...
 
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. More...
 
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. More...
 
long data_type_size () const
 Returns the size of the datatype in bytes. More...
 
long compound_type_size ()
 
double data_type_min ()
 Get the minimum of a datatype. More...
 
double data_type_max ()
 Get the maximum of a datatype. More...
 
Bstring data_type_string ()
 Get the string representation of a datatype. More...
 
Bstring compound_type_string ()
 Get the string representation of a datatype. More...
 
void fix_type ()
 Determines the replacement data type. More...
 
void change_type (char letter)
 Get the data type indicated by a single letter code. More...
 
void change_type (char *string)
 Get the data type from a string. More...
 
void change_type (DataType nutype)
 Change the data to the new type. More...
 
void split_channels ()
 The channels are split into individual images. More...
 
void combine_channels (long nc)
 The channels are composed from individual images. More...
 
FourierType fourier_type ()
 
void fourier_type (FourierType tf)
 
void zero_fourier_origin ()
 Zeroes the first voxel in each image. More...
 
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. More...
 
long kernel_max_neigbor (long idx, long ksize)
 Finds the highest value in a kernel excluding the central voxel. More...
 
long kernel_max_wrap (long idx, long ksize)
 Finds the highest value in a kernel with wrapping. More...
 
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)
 
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)
 
vector< Vector3< double > > sampling ()
 
void sampling (vector< Vector3< double >> sam)
 
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. More...
 
int slices_to_images ()
 Changes the slices in a 3D image into a set of 2D images. More...
 
int images_to_slices ()
 Changes the 2D images to slices in a 3D image. More...
 
long delete_images (Bstring list, int retain=0)
 Retains or deletes sub-images from a multi-image structure. More...
 
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. More...
 
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. More...
 
long statistics (long img_num)
 Calculates the statistics for a sub-image. More...
 
long statistics (Bimage *pmask, double &regavg, double &regstd)
 Calculates the statistics for a region in an image. More...
 
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. More...
 
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. More...
 
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. More...
 
long stats_in_mask (long nn, Bimage *pmask)
 Calculates the statistics for an image for each level in a mask. More...
 
int variance (long kernel_size, int flag=0)
 Calculates the local variance within the given kernel. More...
 
int variance (Vector3< long > kernel_size, int flag=0)
 Calculates the local variance within the given kernel. More...
 
int variance (Bimage *pweight)
 Calculates the local variance weighed with the given image. More...
 
int information ()
 Prints out header information for an image. More...
 
int subimage_information ()
 Prints out header information for all sub-images. More...
 
int moments (long max_order)
 Prints out moments for all sub-images. More...
 
int moments (long max_order, long nn)
 Prints out moments for one sub-image. More...
 
void get (Bstring tag)
 Prints out header information associated with a tag string. More...
 
Bimage * copy ()
 Copies the header information and data of an image into a new image structure. More...
 
Bimage * copy (long nu_nimg)
 Copies the header information and data of an image into a new image structure. More...
 
Bimage * copy_header ()
 
Bimage * copy_header (long nu_nimg)
 Copy an image structure into a new one. More...
 
Bimage * extract (long nn)
 Extracts one sub-image into new image structure. More...
 
Bimage * extract (long n1, long n2)
 Extracts a set of sub-images into new image structure. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
Bimage * extract_line (long nn, Vector3< double > start, Vector3< double > end, long width)
 Extracts a line from an image into a new image. More...
 
Bimage * extract_tetrahedron (Vector3< double > *tet, int fill_type=0, double fill=0)
 Extracts a tetrahedral part of the image. More...
 
Bimage * orthogonal_slices (long nn, Vector3< long > voxel, Vector3< long > ext_size)
 Extracts orthogonal views around a voxel. More...
 
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. More...
 
Bimage * extract_magnify (long nn, Vector3< long > center, Vector3< long > ext_size, double scale)
 Extracts a region from an image to magnify. More...
 
Bimage * extract_slice (long nz)
 Extracts a given slice or slices from an image. More...
 
Bimage * extract_filament (long img_num, double width, int axis, long nspline, Vector3< double > *spline)
 Extracts a filament defined by a series of coordinates. More...
 
int replace (Bimage *img)
 Replaces the data with that from the given image. More...
 
int replace (long nn, Bimage *img, long nr=0)
 Replaces one sub-image in an image structure. More...
 
int replace (long nn, Bimage *img, long nr, double fill)
 Replaces one sub-image in an image structure. More...
 
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. More...
 
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. More...
 
void invert ()
 Inverts the data in the image. More...
 
void reslice (const char *order)
 
void reslice (Bstring order)
 Switches axes of an image. More...
 
void add (double v)
 Adds a constant value to an image. More...
 
void multiply (double v)
 Multiplies an image with a constant value. More...
 
void multiply (long nn, double v)
 Multiplies a sub-image with a constant value. More...
 
void power (double v)
 Calculates the power of an image. More...
 
void sum_images ()
 Adds all sub-images. More...
 
void average_images ()
 
Bimage * average_images (bool sd)
 Averages all sub-images and optionally calculates standard deviation image. More...
 
void add (Bimage *p)
 Adds another image to an image. More...
 
void add (long nn, Bimage *p)
 Adds another image to a sub-image. More...
 
void subtract (Bimage *p)
 Subtracts another image from an image. More...
 
void add (Bimage *p, double scale, double shift)
 Adds another image to an image. More...
 
void add (long nn, Bimage *p, double scale, double shift)
 Adds another image to an image. More...
 
void multiply (Bimage *p, double scale, double shift=0)
 Multiplies an image with another image. More...
 
void multiply (long nn, Bimage *p)
 Multiplies a sub-image with another image. More...
 
void multiply (Bimage *p)
 Multiplies all sub-images with the first sub-image of the other image. More...
 
void divide (Bimage *p, double scale=1, double shift=0)
 Divides the first image by the second. More...
 
void divide_one (Bimage *p, double scale=1, double shift=0)
 Divides the first image by the first sub-image of the second. More...
 
void inverse (double minval=0)
 Calculates the inverse of the image. More...
 
void largest (Bimage *p)
 Selects the largest of each pixel from two images. More...
 
void smallest (Bimage *p)
 Selects the smallest of each pixel from two images. More...
 
Bimage * operator+ (Bimage &p)
 Adds two images together, adjusting for size difference. More...
 
Bplot * plot ()
 Converts a one-dimensional image into a plot. More...
 
void sum (long m, Bimage **p)
 Sums an array of images with their FOM blocks. More...
 
void catenate (long m, Bimage **p)
 Catenates an array of images of the same size into a multi-image structure. More...
 
Bimage * blend (Bimage *p, long number)
 Blends the two images, creating a new set of sub-images. More...
 
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. More...
 
int place_with_addition (Bimage *p, long nn)
 Packs a tile into a new composite image with addition within overlap. More...
 
int place_with_overlap (Bimage *p, long nn)
 Packs a tile into a new composite image with weighted overlap. More...
 
int place_central_part (Bimage *p, long nn)
 Packs a tile into a new composite image, retaining only the central part. More...
 
int assemble_tiles (Bimage *pt, int flag=0)
 Assembles overlapping tiles into this image. More...
 
double linear_fit (Bimage *p, Bimage *pmask, double max_exclude)
 Linear least squares fit of two images. More...
 
int histomatch (Bimage *p, long bins)
 Fits two images by matching the histogram of the second to the first. More...
 
int kernel_gaussian (double sigma, double max)
 Generates a gaussian kernel image. More...
 
int kernel_laplacian_of_gaussian (double sigma, double max)
 Generates a laplacian-of-gaussian kernel. More...
 
int filter_average (long kernel_size)
 Applies an averaging filter to an image. More...
 
int filter_average (Vector3< long > k)
 
int filter_gaussian (long kernel_size, double sigma)
 Applies a gaussian filter to an image. More...
 
int filter_sinc ()
 Weighs an image with a sinc function. More...
 
int convolve_chunk (Bimage *pkernel, float *nudata, long i, long len)
 
int convolve (Bimage *pkernel)
 Convolves an image with an arbitrary size convolution filter. More...
 
int filter_ortho (int type)
 Convolves the image with an orthogonal kernel with wrapping. More...
 
int filter_dog (double sigma1, double sigma2)
 Convolves the image with a difference of gausians kernel. More...
 
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. More...
 
int filter_rolling_ball (long radius, double scale)
 Apply a rolling ball filter. More...
 
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. More...
 
Bimage * filter_peak (long kernel_size)
 Finds the peaks in an image. More...
 
Bimage * periodic_averaging (Vector3< double > period)
 Calculates an average within a periodic frame. More...
 
Bimage * nad_2D (double ht, double lambda, double C, double alpha)
 Denoises a 2D image by non-linear anisotropic diffusion. More...
 
Bimage * nad (double ht, long zw, double lambda, double C, double alpha)
 Denoises a 3D density map by non-linear anisotropic diffusion. More...
 
void simple_to_complex ()
 A simple image is converted to a complex image. More...
 
void complex_to_real ()
 The real part of a complex image is written to a simple image. More...
 
void complex_to_imaginary ()
 The imaginary part of a complex image is written to a simple image. More...
 
void complex_to_intensities ()
 The intensities from a complex image is written to a simple image. More...
 
void complex_to_amplitudes ()
 The amplitudes from a complex image is written to a simple image. More...
 
void complex_to_signed_amplitudes ()
 The signed amplitudes from a complex image is written to a simple image. More...
 
void complex_to_phases ()
 The phases from a complex image is written to a simple image. More...
 
void complex_conjugate ()
 Calculates the complex conjugate image. More...
 
double complex_power ()
 Calculates the power in a complex image. More...
 
double complex_normalize ()
 Normalizes the power in a complex image. More...
 
int phase_shift (Vector3< double > shift)
 Phase shifts a complex image. More...
 
int phase_shift (long nn, Vector3< double > shift)
 Phase shifts a complex sub-image. More...
 
int phase_shift_to_origin ()
 Phase shifts a set of reflections to the image origin. More...
 
int phase_shift_to_center ()
 Phase shifts a set of reflections to the nominal center of the image origin. More...
 
int complex_multiply (Bimage *p)
 Calculates the product of a complex image with a simple image. More...
 
int complex_product (Bimage *p)
 Calculates the complex product of two complex images. More...
 
int complex_conjugate_product (Bimage *p)
 Calculates the product of a complex image with the conjugate of a second. More...
 
Bimage * complex_conjugate_product_one2many (Bimage *p)
 Calculates the product of a complex image with the conjugate of a second. More...
 
int complex_apply_mask (Bimage *pmask)
 Applies a mask to a complex image. More...
 
int complex_apply_negative_mask (Bimage *pmask)
 Applies a negative mask to a complex image. More...
 
int complex_apply_dual_mask (Bimage *pmask)
 Applies a dual mask to a complex image. More...
 
int complex_bandpass (double hires, double lores)
 Bandpasses a Fourier transform. More...
 
Bimage * pack_two_in_complex (Bimage *p)
 Packs two real images into one complex image. More...
 
Bimage * unpack_combined_transform ()
 Unpacks a complex transform obtained from two real images. More...
 
int combined_complex_product ()
 Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
double merge_amplitudes_and_phases (Bimage *pamp)
 Merges the amplitudes from one map with the phases of another. More...
 
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. More...
 
Bimage * intensities_phase_colored (double scale)
 Generates a power spectrum with phases colored according to a color wheel. More...
 
int phase_colour_wheel ()
 Generates a phase color wheel. More...
 
fft_plan fft_setup (fft_direction dir, int opt=0)
 Sets up a plan for fast Fourier transforms. More...
 
int fft ()
 
int fft_back ()
 
int fft (fft_direction dir)
 Fast Fourier transforms an image. More...
 
int fft_back (fft_plan plan, bool norm_flag=1)
 
int fft (fft_direction dir, bool norm_flag)
 Fast Fourier transforms an image. More...
 
int fft (fft_plan plan, bool norm_flag=1)
 Fast Fourier transforms an image. More...
 
Vector3< double > change_transform_size (Vector3< long > nusize)
 Resizes a "standard" transform. More...
 
int power_spectrum (int flags=0)
 Calculates a power spectrum. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
long fspace_maximum_radius (double resolution, double sampling_ratio=1)
 Calculates the maximum radius in frequency space from a given resolution. More...
 
int fspace_background ()
 Calculates the background for a Fourier transform. More...
 
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. More...
 
int fspace_2D_interpolate (Complex< float > cv, Vector3< double > m, double part_weight, int interp_type)
 Interpolates a 2D image for packing ito a 3D reciprocal space volume.
More...
 
int fspace_pack_2D (Bimage *p, Matrix3 mat, double hi_res, double lo_res, Vector3< double > scale, double part_weight=1, int interp_type=0)
 Packs a 2D Fourier transform into a 3D reciprocal space volume.
More...
 
int fspace_pack_2D (Bimage *p, View asu_view, Bsymmetry *sym, double hi_res, double lo_res, Vector3< double > scale, double part_weight=1, int interp_type=0)
 Packs a 2D Fourier transform into a 3D reciprocal space volume.
More...
 
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.
More...
 
int fspace_pack_3D (Bimage *p, double hi_res=0, double threshold=0)
 Packs a 3D Fourier transform into a 3D reciprocal space volume. More...
 
long fspace_reconstruction_add (Bimage *p)
 Adds all components to a reconstruction. More...
 
long fspace_reconstruction_weigh ()
 Weighs a reconstruction. More...
 
int fspace_reconstruction_stats (double resolution, double sampling_ratio=1)
 Calculates Fourier shell statistics. More...
 
long fspace_reconstruction_snr ()
 Calculates the SNR map. More...
 
int fspace_translate (Vector3< double > shift)
 Translates an image in frequency space to avoid interpolation. More...
 
int fspace_translate (long nn, Vector3< double > shift)
 Translates an image in frequency space to avoid interpolation. More...
 
int fspace_resize (double scale, double res_hi, double res_lo)
 Resizes an image in frequency space to avoid interpolation. More...
 
Bimage * fspace_resize (Bimage *pref)
 Resizes an image in frequency space to avoid interpolation. More...
 
int fspace_amp_one ()
 Sets all amplitudes to one. More...
 
int fspace_amp_threshold (double threshold)
 Filters the amplitudes of the Fourier transform of an image. More...
 
int fspace_sqrt_amp ()
 Change the amlitudes to their square roots. More...
 
int fspace_square_amp ()
 Change the amlitudes to their squares. More...
 
int fspace_bandpass (double res_hi, double res_lo=0, double width=0)
 Applies a bandpass filter to an image. More...
 
int fspace_bandpass (double res_hi, double res_lo, double width, fft_plan planf, fft_plan planb)
 Applies a bandpass filter to an image. More...
 
Bimage * fspace_radial_power (double resolution, double sampling_ratio=1)
 Calculates the radial power spectrum from a Fourier transform. More...
 
double * fspace_radial (long nn, long maxrad, int flag=0)
 Calculates the radial power spectrum from a Fourier transform. More...
 
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. More...
 
int fspace_weigh_ramp (double resolution, fft_plan planf, fft_plan planb)
 Weighs a transform with a ramp. More...
 
int fspace_weigh_ramp (double resolution, double axis, fft_plan planf, fft_plan planb)
 Weighs a transform with a ramp. More...
 
int fspace_weigh_B_factor (double B, double resolution=0)
 Weighs an image's amplitudes with B-factor (gaussian) curve. More...
 
int fspace_weigh_C_curve (double resolution=0)
 Weighs an image's amplitudes with the carbon scattering curve. More...
 
int fspace_weigh_LoG (double resolution, double sigma)
 Weighs an image's amplitudes with a Laplacian-of-Gaussian function. More...
 
int fspace_weigh_RPS_curve (Bplot *plot, double resolution=0)
 Weighs an image's amplitudes with a given RPS curve. More...
 
int fspace_weigh_FSC_curve (Bplot *plot, double resolution=0)
 Weighs an image's amplitudes with a given FSC curve. More...
 
int fspace_weigh (Bimage *pref, Bimage *pmask, double resolution=0)
 Weighs an image's amplitudes with the radial power spectrum of another. More...
 
int fspace_weigh_dose (long nn, double dose_per_frame, vector< double > critdose)
 
int fspace_weigh_dose (double dose_per_frame, int flag=0)
 Weighs an image's amplitudes with the accumulated dose. More...
 
int fspace_weigh_accumulated_dose (vector< double > dose)
 Weighs an image's amplitudes with the accumulated dose. More...
 
int fspace_normalize ()
 Normalizes an image's amplitudes. More...
 
int fspace_normalize_radial (Bimage *pmask, double resolution=0, int flag=0)
 Normalizes an image's amplitudes. More...
 
int fspace_positive ()
 Sets the image to positive definite. More...
 
double friedel_check ()
 Checks Friedel symmetry. More...
 
int friedel_apply ()
 Applies Friedel symmetry. More...
 
Bimage * project (char axis, int flags=1)
 Projects a 3D image to a 2D image down one of the three major axes. More...
 
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. More...
 
Bimage * project (View *view, int norm_flag=1)
 Calculates a set of projections from a 3D density map. More...
 
Bimage * central_section (Matrix3 mat, double resolution, FSI_Kernel *kernel)
 Calculates a central section of a 3D fourier transform. More...
 
Bimage * project (View *view, double resolution, FSI_Kernel *kernel)
 Calculates a set of projections as central sections from a 3D fourier transform. More...
 
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. More...
 
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. More...
 
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. More...
 
Bimage * local_filter (Bimage *pmask, int mask_level, Bimage *resmap, int size, Vector3< long > vedge)
 Applies a local resolution filter to a map. More...
 
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. More...
 
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. More...
 
int phase_flip (Bimage *pd)
 Flips the phases of an image based on a phase difference map. More...
 
double correlate (Bimage *p)
 Calculates correlation coefficient between two images. More...
 
double correlate (Bimage *p, double rmin, double rmax, Bimage *pmask=NULL, int flag=0)
 Calculates a correlation coefficient between two images. More...
 
double rotate_correlate (Vector3< double > axis, double angle)
 Rotates a copy of an image and correlates it with the original. More...
 
double R_factor (Bimage *p)
 Calculates an R factor between two images. More...
 
int auto_correlate (double hires, double lores)
 Calculates an autocorrelation map by Fast Fourier transformation. More...
 
Bimage * cross_correlate (Bimage *p, double hires, double lores, fft_plan planf, fft_plan planb)
 Calculates a cross-correlation map by Fast Fourier transformation. More...
 
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. More...
 
double correlation_coefficient (Vector3< double > shift)
 Calculates a coefficient from a Fourier correlation transform given a shift. More...
 
Vector3< double > find_shift_in_transform (double shift_limit)
 Finds the shift by brute force backtransformation for selected shifts. More...
 
Bimage * cross_correlate_fspace (Bimage *p, double hires, double lores, double shift_limit)
 Calculates a cross-correlation map by Fast Fourier transformation. More...
 
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. More...
 
Bimage * cross_correlate_validate (Bimage *p, Bimage *pmask)
 Calculates a masked cross-correlation map by Fast Fourier transformation. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int find_peak (double radius=1e30, double sigma=0)
 Finds the peak in an image to the nearest voxel. More...
 
Vector3< double > fit_peak ()
 Fits an elliptic parabole to locate the position of the peak to sub-voxel resolution. More...
 
int refine_peak_new ()
 Refines the position of a peak to sub-voxel resolution. More...
 
int refine_peak ()
 Refines the position of a peak to sub-voxel resolution. More...
 
Bimage * find_peaks (long kernelsize)
 Finds peaks in a map with periodic boundaries. More...
 
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. More...
 
double ccmap_confidence (long nn)
 Calculates a confidence level to associate with a cross-correlation peak. More...
 
double peak_sigma (long nn, Vector3< long > coor, long kernel_size)
 Calculates a sigma value for a cross-correlation peak. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
vector< 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. More...
 
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. More...
 
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. More...
 
void simple_to_rgb ()
 A simple image is converted to a color image. More...
 
void simple_to_rgba ()
 A simple image is converted to a color image. More...
 
void color_to_simple ()
 A color image is converted to a simple image. More...
 
void rgb_to_rgba ()
 An alpha channel is added to a RGB color image. More...
 
void rgba_to_rgb ()
 The alpha channel is delete from an RGBA color image. More...
 
void rgb_to_cmyk ()
 Converts an RGB color image to CMYK. More...
 
void cmyk_to_rgb ()
 Converts a CMYK color image to RGB. More...
 
int one_color (int color, double cmin, double cmax, int flag=0)
 Converts a gray-scale image to a single color. More...
 
int color_red (double cmin, double cmax, int flag=0)
 Converts a gray-scale image to red. More...
 
int color_green (double cmin, double cmax, int flag=0)
 Converts a gray-scale image to green. More...
 
int color_blue (double cmin, double cmax, int flag=0)
 Converts a gray-scale image to blue. More...
 
int pure_color ()
 Generates a pure color image without intensity. More...
 
int color_combine (Bimage *p)
 Combines two colored images. More...
 
Bimage * color_spectrum (double cmin, double cmax)
 Colorizes an image to a spectrum. More...
 
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. More...
 
int rescale (double scale, double shift)
 Rescales the image data with a given multiplier and offset. More...
 
int rescale (long nn, double scale, double shift)
 Rescales the image data with a given multiplier and offset. More...
 
int rescale_to_min_max (double numin, double numax)
 Rescales the image data to a given minimum and maximum. More...
 
int rescale_to_min_max (long nn, double numin, double numax)
 Rescales the image data to a given minimum and maximum. More...
 
int rescale_to_avg_std (double nuavg, double nustd)
 Rescales the image data to a given average and standard deviation. More...
 
int rescale_to_avg_std (long nn, double nuavg, double nustd)
 Rescales the image data to a given average and standard deviation. More...
 
int rescale_to_avg_std (double nuavg, double nustd, Bimage *pmask)
 Rescales the image data to a given average and standard deviation. More...
 
int truncate (double minim, double maxim, double setmin, double setmax)
 Truncates image data to a given minimum and maximum. More...
 
int truncate_to_min_max (double minim, double maxim)
 Truncates image data to a given minimum and maximum. More...
 
int truncate_to_avg (double minim, double maxim)
 Sets voxels in image data exceeding a given minimum and maximum to the average. More...
 
int truncate_to_background (double minim, double maxim)
 Sets voxels in image data exceeding a given minimum and maximum to the image background. More...
 
int limit_levels (int nlevels)
 Converts a full gray scale image to a limited level image. More...
 
int normalize (long imgnum, double average, double stdev, int norm_type, long bins)
 Normalizes a sub-image to a desired average and standard deviation. More...
 
int normalize (double average, double stdev, int norm_type)
 Normalizes a set of images to a desired average and standard deviation. More...
 
int normalize_local (long kernel_size)
 Normalizes by subtracting local average and dividing by local standard deviation. More...
 
int normalize_local (Vector3< long > kernel)
 Normalizes by subtracting local average and dividing by local standard deviation. More...
 
void square ()
 Calculates the square of an image. More...
 
void square_root ()
 Calculates the square root of an image. More...
 
void logarithm ()
 Calculates the logarithm of the image data. More...
 
int gradient_correction ()
 Calculates and corrects for a linear gradient across an image. More...
 
int quadric_correct (vector< double > param)
 Corrects for a quadric surface. More...
 
vector< double > quadric_fit ()
 Fits the whole image to a quadric surface. More...
 
Bimage * thickness (double reference, double lambda)
 Calculates a thickness based on intensities with respect to a reference. More...
 
int calculate_background (long nn, int flag)
 Calculates the background for one sub-image. More...
 
int calculate_background (int flag=0)
 Calculates the background for each sub-image. More...
 
int calculate_background (Bimage *pmask, long nn, int flag=0)
 Calculates the background for one sub-image. More...
 
int calculate_background (Bimage *pmask, int flag=0)
 Calculates the background for each sub-image. More...
 
int correct_background (long nn, int flag)
 Corrects the background for one sub-image. More...
 
int correct_background (int flag=0)
 Corrects the background for each sub-image. More...
 
int correct_background (Bimage *pmask, int flag=0)
 Corrects the background for each sub-image. More...
 
int subtract_background ()
 Subtracts the background for each sub-image. More...
 
int shift_background (double bkg)
 Sets the background for each sub-image to a given value. More...
 
vector< long > histogram (long bins, double &scale, double &offset)
 Calculates the histogram of an image. More...
 
Bplot * histogram (long bins)
 Calculates the histogram of an image. More...
 
Bplot * histogram_counts (int flags=0)
 Finds the peaks in a quantized image from the histogram. More...
 
Bplot * percentiles ()
 Calculates the percentiles from the histogram of an image. More...
 
int histogram_thresholds (double &tmin, double &tmax)
 Calculates minimum and maximum thresholds for truncation. More...
 
double otsu_threshold (long bins)
 Calculates the threshold on a histogram according to Otsu. More...
 
vector< double > histogram_gauss_fit (long bins, long ngauss=1)
 Fits a gaussian function to a histogram of an image. More...
 
Bplot * histogram_gauss_plot (long bins, long ngauss=1)
 Fits a gaussian function to a histogram of an image. More...
 
Bplot * histogram_poisson_fit (long bins, int flag=0)
 Fits a poisson function to a histogram of an image. More...
 
int resize (Vector3< long > nusize, Vector3< long > translate, int fill_type=0, double fill=0)
 Resizes without interpolation or rescaling. More...
 
Bimage * resize_copy (Vector3< long > nusize, Vector3< long > translate, int fill_type=0, double fill=0)
 Resizes without interpolation or rescaling. More...
 
int resize_wrap (Vector3< long > nusize, Vector3< long > translate)
 Resizes without interpolation or rescaling. More...
 
Bimage * resize_wrap_copy (Vector3< long > nusize, Vector3< long > translate)
 Resizes with wrapping without interpolation or rescaling. More...
 
int pad (long sz, int fill_type=0, double fill=0)
 Pads an image to a new size with a given fill value. More...
 
int pad (Vector3< long > sz, int fill_type=0, double fill=0)
 Pads an image to a new size with a given fill value. More...
 
Bimage * pad_copy (long sz, int fill_type=0, double fill=0)
 Pads an image to a new size with a given fill value. More...
 
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. More...
 
int shrink_wrap (Vector3< long > nusize, Vector3< long > translate)
 Shrinks an image to a new size with wrapping of the excluded edges. More...
 
int enlarge (Vector3< long > scale)
 Enlarges an image by an inetger scale. More...
 
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. More...
 
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. More...
 
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. More...
 
Bimage * edge_mask (int type, Vector3< long > rect, Vector3< double > start, double width)
 Creates a mask with the edge approaching zero. More...
 
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. More...
 
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. More...
 
int hanning_taper (double fill=0)
 Apply Hanning taper window to the image. More...
 
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. More...
 
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. More...
 
int gaussian_sphere (long nn, Vector3< double > center, double sigma, double amp)
 Fills a gaussian sphere within an image with a uniform value. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int quadric (double *param)
 Generates a quadric surface over the whole image. More...
 
int fill_gaps (long step)
 Fill the voxels that are not calculated. More...
 
int interpolate_gaps (long step)
 Interpolate the voxels that are not calculated. More...
 
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. More...
 
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. More...
 
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. More...
 
int rotate ()
 Rotates an image using parameters defined in the image in place. More...
 
int rotate (double angle)
 Rotates an image around the z-axis by the given angle in place. More...
 
int rotate (Vector3< double > axis, double angle)
 Rotates an image using an axis and angle in place. More...
 
int rotate (View view)
 Rotates an image to a specified view in place. More...
 
int rotate (Vector3< double > translate, View view)
 Rotates an image to a specified view in place. More...
 
int rotate (Matrix3 mat)
 Rotates an image using the specified matrix. More...
 
int rotate (Vector3< double > translate, Matrix3 mat)
 Rotates an image using the specified shift and matrix. More...
 
Bimage * rotate (Vector3< long > nusize)
 Rotates an image using parameters defined in the image. More...
 
Bimage * rotate (Vector3< long > nusize, double angle)
 Rotates an image around the z-axis by the given angle. More...
 
Bimage * rotate (Vector3< long > nusize, Vector3< double > axis, double angle)
 Rotates an image using an axis and angle. More...
 
Bimage * rotate (Vector3< long > nusize, View view)
 Rotates an image to a specified view. More...
 
Bimage * rotate (Vector3< long > nusize, Vector3< double > translate, View view)
 Rotates an image to a specified view. More...
 
Bimage * rotate (Vector3< long > nusize, Matrix3 mat)
 Rotates an image using the specified matrix. More...
 
int rotate_and_add (Bimage *p, Vector3< double > origin, View view)
 Rotates an image to a specified view and adds it to another image. More...
 
Bimage * orient (View *views)
 Calculates multiple copies oriented according to views. More...
 
int mirror ()
 Inverts/mirrors each image through its origin. More...
 
int shift (Vector3< double > vec, int fill_type=0, double fill=0)
 Shifts an image. More...
 
int shift (long nn, Vector3< double > vec, int fill_type=0, double fill=0)
 Shifts one sub-image. More...
 
int shift_wrap (Vector3< double > vec)
 Shifts an image. More...
 
int shift_wrap (long nn, Vector3< double > vec)
 Shifts one sub-image with wrapping. More...
 
int center (int fill_type=0, double fill=0)
 Centers an image. More...
 
int center_wrap ()
 Centers an image with wrapping. More...
 
int zero_origin ()
 Shifts the origins to zero with wrapping. More...
 
Bimage * scale_to_same_size (Bimage *pref)
 Scales and image to the given reference. More...
 
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. More...
 
Bimage * scale_to_reference (Bimage *pref, Bimage *pmask=NULL)
 Scales and image to the given reference, searching for the correct scale. More...
 
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. More...
 
double check_point_group (Bstring &check_string)
 Checks for the requested symmetries. More...
 
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. More...
 
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. More...
 
long rotate_to_axis (Bsymmetry *sym, long axis, long axis_flag)
 Rotates to a symmetry axis. More...
 
int change_symmetry (Bsymmetry *symold, Bsymmetry *symnu, double radius, double z_slope)
 Changes the symmetry order for cyclic and dihedral maps. More...
 
Matrix3 symmetry_equivalent (Bimage *ptemp, Bimage *pmask, Bsymmetry *sym)
 Finds the symmetry equivalent orientation of a particle with respect to a template. More...
 
Matrix3 symmetry_equivalent_cyclic (Bimage *pref, Bimage *pmask, Bsymmetry *sym)
 Finds the cyclic symmetry equivalent orientation of a particle with respect to a template. More...
 
Bimage * levelmask_asymmetric_units (Bsymmetry *sym, int index)
 Calculates a multi-level mask to indicate asymmetric units. More...
 
int replicate_asymmetric_unit (Bsymmetry *sym)
 Calculates a full map from one asymmetric unit. More...
 
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.
More...
 
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. More...
 
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. More...
 
Bimage * symmetrize_cylinder (int flag)
 Calculates a cylindrically symmetrized map. More...
 
int symmetrize_cylinder ()
 Calculates a cylindrically symmetrized map. More...
 
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. More...
 
double convert_to_helix (double helix_rise, double helix_angle, Vector3< double > offset)
 Converts a map to a helix. More...
 
int distort_elliptically (double angle, double shift)
 Transforms a tubular cylinder to an elliptical profile. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
double snvariance (double snradius)
 Calculates the ratio of variance inside and outside a given radius. More...
 
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. More...
 
Bplot * filament_width (long width, long lim_lo, long lim_hi)
 Estimates the width of a filament. More...
 
Bimage * filament_density (double width)
 Estimates the density per pixel length of a filament. More...
 
Bimage * radial (long minrad, long maxrad, double rad_step=1, int wrap=0)
 Calculates the radial average of an image. More...
 
Bimage * radial (long minrad, long maxrad, double rad_step, Bimage *pmask, int wrap=0)
 Calculates the radial average of an image. More...
 
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. More...
 
Bimage * radial_symmetry_adjusted (double rad_start, double rad_end, double rad_step, double spherical_fraction, Bsymmetry *sym)
 Calculates the symmetry-adjusted radial average of an image. More...
 
double * radial_fit (Bimage *pref)
 Fits a radial profile to a reference radial profile. More...
 
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. More...
 
Bimage * cartesian_to_spherical (long nannuli, long nphi, long ntheta)
 Calculates an image with spherical coordinates. More...
 
Bimage * cartesian_to_cylindrical (long nannuli, long nphi, int flag=0)
 Calculates an image with cylindrical coordinates. More...
 
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. More...
 
Bimage * polar_power_spectrum (double resolution, long num_angle)
 Calculates the polar power spectrum of a 2D transform amplitude or intensity image. More...
 
int line_powerspectra (fft_plan plan)
 Calculates the 1D power spectrum of each line in an image. More...
 
int radial_shells ()
 Calculates an image with slices representing radial shell projections. More...
 
int cylindrical_shells ()
 Calculates an image with slices representing cylindrical shell projections. More...
 
Bimage * radial_sections (double rad_start, double rad_end, double rad_step, double spherical_fraction, Bsymmetry *sym, int fill_type=FILL_USER, double fill=0)
 Calculates an image with slices giving the radial section projections. More...
 
Bimage * radial_coverage (double threshold, double rad_step=1)
 Calculates the coverage in each radial shell. More...
 
Bimage * topograph_to_surface (Bimage *psd, long nz, double density, double resolution)
 Converts a 2D AFM image to a 3D density map. More...
 
Bimage * surface_to_topograph (double threshold, int dir=0)
 Converts a 3D image to a 2D height image. More...
 
Bimage * rotate_height (Matrix3 mat, Vector3< double > translate, double threshold=0)
 Rotates a 3D map and calculates the height along the z-axis. More...
 
Bimage * height (View *views, double threshold=0)
 Calculates a set of height images from a 3D density map. More...
 
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. More...
 
int bin (long b)
 
int bin (Vector3< long > bk)
 Bins by an integer size in place. More...
 
Bimage * bin_copy (long b)
 
Bimage * bin_copy (Vector3< long > bk)
 Bins by an integer size and returns a new image. More...
 
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. More...
 
int median_bin (int binning)
 Bins by an integer size, selecting the kernel median. More...
 
int noise_uniform (double rmin, double rmax)
 Generates an image with a uniform random distribution of densities. More...
 
int noise_gaussian (double ravg=0, double rstd=1)
 Generates an image with a gaussian random distribution of densities. More...
 
int noise_poisson (double ravg)
 Generates an image with a poisson random distribution of densities. More...
 
int noise_logistical (double ravg, double rstd)
 Generates an image with a gaussian random distribution of densities. More...
 
int noise_spectral (double alpha)
 Generates a noise map with a defined spectral decay. More...
 
long mask (Bimage *pmask, double fill)
 Masks an image. More...
 
long to_mask ()
 
long to_mask (double threshold)
 Change the image to a mask. More...
 
Bimage * mask_by_threshold (double threshold)
 Generates a mask based on an image at a given threshold. More...
 
Bimage * mask_by_thresholds (vector< double > threshold)
 Generates a mask based on an image at a given threshold. More...
 
long mask_stats ()
 Calculates statistics for a mask. More...
 
long mask_invert ()
 Inverts a mask. More...
 
long mask_combine (Bimage *p, int operation)
 Combines two masks with different operations. More...
 
Bimage * mask_extract (Bimage *pmask)
 Zeroes everything outside the mask and return the excised feature. More...
 
int max_in_kernel (long ksize)
 
long mask_dilate_erode (unsigned char dir)
 Dilates or erodes a binary mask. More...
 
long mask_dilate (long times=1)
 Dilates a binary mask. More...
 
long mask_erode (long times=1)
 Erodes a binary mask. More...
 
long mask_open (int times=1)
 Opens a binary mask. More...
 
long mask_close (int times=1)
 Closes a binary mask. More...
 
long mask_fill (Vector3< long > voxel)
 Fills an empty part of a mask indicated by the given voxel. More...
 
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. More...
 
long mask_rectangle (double length, double width, double rect_angle, int wrap)
 Generates a mask along an axis within a 2D image. More...
 
long mask_symmetrize (Bsymmetry *sym)
 Symetrizes a mask. More...
 
Vector3< double > mask_fspace_resize (Vector3< long > nusize)
 Resizes a reciprocal space mask. More...
 
vector< double > fspace_default_bands (double res_lo, double res_hi)
 Sets up default frequency space bands to generate a mask. More...
 
int mask_fspace_banded (vector< double > &band)
 Generate reciprocal space mask based on a specification of bands. More...
 
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. More...
 
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. More...
 
long mask_missing_cone (Vector3< double > origin, double mis_ang, double resolution)
 Generates a mask with a missing cone. More...
 
long mask_missing_find (Vector3< double > ori, double resolution, Bstring &mis_type)
 Generates a missing mask from an example image. More...
 
long mask_pack_plane (Matrix3 mat, double hi_res, double scale)
 Packs a 2D mask into a 3D reciprocal space volume.
More...
 
double variance_threshold (double lowvar)
 Calculates a threshold for a local variance image. More...
 
Bimage * variance_mask (long kernel_size, double lowvar=1e-6, int bkg_flag=0)
 Calculates a mask based on local variance. More...
 
Bimage * tile_mask (long step)
 Converts a mask to a tiled multilevel mask. More...
 
long mask_split (long voxels_per_level)
 Converts a mask to a multilevel mask with a given number of voxels per level. More...
 
long levelmask_collapse ()
 Collapse a multi-level mask to a binary mask. More...
 
long levelmask_add (Bimage *pmask, int add_level=1)
 Adds a bilevel mask to a level mask. More...
 
long levelmask_dilate (int times)
 Dilates a level mask. More...
 
long levelmask_dilate ()
 Dilates a level mask. More...
 
long levelmask_select (Bstring &select_list, int flag=0)
 Retains the selected levels in a multi-level mask. More...
 
long levelmask_select (long nn, Vector3< long > voxel)
 Retains the selected levels in a multi-level mask. More...
 
long levelmask_select (Bimage *pmask)
 Selects regions overlapping a mask. More...
 
long levelmask_switch (long index1, long index2)
 Switches two segments in a multi-level mask. More...
 
int level_masked_stats (Bimage *pmask)
 Caclulates statistics for all the regions defined by a multi-level mask. More...
 
long levelmask_symmetrize (Bsymmetry *sym)
 Symetrizes a multi-level mask. More...
 
Bimage * level_mask_extract (Bimage *pmask)
 Extracts all the regions associated with a multi-level mask. More...
 
double levelmask_average_region_size ()
 Calculates the average size of regions in a level mask. More...
 
long levelmask_clean ()
 Removes empty levels from a multi-level mask. More...
 
long levelmask_colorize ()
 Colorizes a multi-level mask with random color assignments. More...
 
Bimage * levelmask_color_by_size ()
 Color a multi-level mask based on the volumes of regions. More...
 
int levelmask_region_size ()
 Convert a mask to reflect region sizes. More...
 
Bplot * levelmask_size_histogram ()
 Color a multi-level mask based on the volumes of regions. More...
 
Matrix mask_interface_matrix (int img_num)
 Calculates the interfaces between regions. More...
 
long mask_region_interfaces (int reg_num)
 Reports the whole interface matrix or interfaces for one region only. More...
 
long mask_merge_delete (long min_size, long min_if)
 Calculates the interfaces between regions and deletes/merges small ones. More...
 
long apply_soft_mask (long nn, Bimage *pmask, int fill_type, double fill)
 Applies a soft mask to a sub-image. More...
 
Bimage * regions (double threshold, int sign)
 Segments an image into contiguous regions. More...
 
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. More...
 
int region_threshold_series (double threshold_first, double threshold_last, double threshold_step)
 Segments a map through a series of thresholds and reports results. More...
 
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. More...
 
long check_neighbors (long idx)
 Check neighbors in region map and assign a value if a neighbor is assigned. More...
 
Bimage * region_peaks (long kernel_size, double threshold, int flood=0, int wrap=0)
 Generates a segmented image from peaks above a threshold value. More...
 
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. More...
 
int filter_extremes ()
 Filters the extremes out of a micrograph image. More...
 
int filter_extremes (int mod_flag)
 Filters the extremes out of an image. More...
 
long replace_maxima (double threshold)
 Replaces maxima above a threshold using local averages. More...
 
double mass_threshold (long img_num, double mol_weight, double rho)
 Finds the density threshold associated with a particular molecular weight. More...
 
double mass_at_threshold (long img_num, double threshold, double rho)
 Calculates the mass from the density threshold. More...
 
Bimage * internal_volume (double threshold)
 Calculates the internal volume of a shell. More...
 
Bimage * internal_volume (double threshold, int mask_out_freq)
 Calculates the internal volume of a shell. More...
 
Bimage * kmeans_segment (long nregion=2, long max_iter=10, double ratio=1)
 Segments an image based on K-means. More...
 
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. More...
 
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. More...
 
vector< Bsuperpixel > superpixels (long step, double colorweight=0.2, long iterations=10, double stop=1)
 Segment the image into superpixels. More...
 
vector< Bsuperpixel > superpixels (long step, double colorweight=0.2, long iterations=10, long bin_levels=1, double stop=1)
 
int impose_superpixels (Bimage *pmask, vector< Bsuperpixel > &seg, int impose)
 Impose superpixel features onto an image. More...
 

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 177 of file Bimage.h.

Constructor & Destructor Documentation

◆ Bimage() [1/9]

Bimage::Bimage ( )

Initializes an image.

The internal initialization function is called.

Definition at line 43 of file Bimage.cpp.

◆ Bimage() [2/9]

Bimage::Bimage ( const Bimage &  p)

The copy constructor.

The internal copy function is called.

Definition at line 57 of file Bimage.cpp.

◆ Bimage() [3/9]

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

Reads an image from a file.

The internal initialization function is called.

Definition at line 69 of file Bimage.cpp.

◆ Bimage() [4/9]

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

Initializes an image.

Parameters
typedata type.
ctypecompound type.
nxx dimension.
nyy dimension.
nzz dimension.
nnnumber of sub-images.
The internal initialization function is called.
The basic properties and size is set up and the data allocated.

Definition at line 91 of file Bimage.cpp.

◆ Bimage() [5/9]

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

Initializes an image.

Parameters
typedata type.
ctypecompound type.
sizeimage size.
nnnumber of sub-images.
The internal initialization function is called.
The basic properties and size is set up and the data allocated.

Definition at line 112 of file Bimage.cpp.

◆ Bimage() [6/9]

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

Initializes an image.

Parameters
typedata type.
ctypecompound type.
sizeimage size.
nnnumber of sub-images.

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

Definition at line 132 of file Bimage.cpp.

◆ Bimage() [7/9]

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

Initializes a generic multi-channel image.

Parameters
typedata type.
ncnumber of channels.
nxx dimension.
nyy dimension.
nzz dimension.
nnnumber of sub-images.
The internal initialization function is called.
The basic properties and size is set up and the data allocated.

Definition at line 154 of file Bimage.cpp.

◆ Bimage() [8/9]

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

Initializes a generic multi-channel image.

Parameters
typedata type.
ncnumber of channels.
sizeimage size.
nnnumber of sub-images.
The internal initialization function is called.
The basic properties and size is set up and the data allocated.

Definition at line 175 of file Bimage.cpp.

◆ Bimage() [9/9]

Bimage::Bimage ( Matrix &  mat,
long  scale 
)

Initializes an image from a 2D matrix.

Parameters
matmatrix.
scaleinteger scale for enlarging the image.
The internal initialization function is called.
The basic properties and size is set up and the data allocated.
The matrix contents are transferred with dimension scaling.

Definition at line 194 of file Bimage.cpp.

◆ ~Bimage()

Bimage::~Bimage ( )

Image destructor.

All properties and associated data are deallocated.

Definition at line 222 of file Bimage.cpp.

Member Function Documentation

◆ add() [1/8]

void Bimage::add ( Bimage *  p)

Adds another image to an image.

Parameters
*pimage to be added.
Requirement: The images must have the same size.

Definition at line 3381 of file Bimage.cpp.

◆ add() [2/8]

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

Adds another image to an image.

Parameters
*pimage to be added.
scaledensity scale to other image
shiftdensity shift to other image.
Requirement: The images must have the same size.

Definition at line 3456 of file Bimage.cpp.

◆ add() [3/8]

void Bimage::add ( double  v)

Adds a constant value to an image.

Parameters
vconstant to be added.

Definition at line 3237 of file Bimage.cpp.

◆ add() [4/8]

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
xxx location.
yyy location.
zzz location.
nnimage number (4 th dimension).
vvalue to add.
Inverse of trilinear interpolation.

Definition at line 1266 of file Bimage.cpp.

◆ add() [5/8]

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

Definition at line 322 of file Bimage.h.

◆ add() [6/8]

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

Definition at line 321 of file Bimage.h.

◆ add() [7/8]

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

Adds another image to a sub-image.

Parameters
nnsub-image.
*pimage 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 3434 of file Bimage.cpp.

◆ add() [8/8]

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

Adds another image to an image.

Parameters
nnsub-image.
*pimage to be added.
scaledensity scale to other image
shiftdensity shift to other image.
Requirement: The images must have the same size.

Definition at line 3483 of file Bimage.cpp.

◆ align()

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_numreference sub-image.
*pmaskcross-correlation mask.
hi_reshigh resolution limit.
lo_reslow resolution limit.
shift_limitlimit on extent of search for shift.
edge_widthwidth of smoothing edge.
gauss_widthdecay coefficient for smoothing edge.
bin3-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.

◆ align2D() [1/2]

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
*prefreference 2D image.
res_polarpolar resolution limit.
ann_minminimum annulus (>=0).
ann_maxmaximum annulus (< image radius).
*prs_maskdual mask.
shift_limitmaximum shift from nominal origin of box.
angle_limitmaximum rotation from original in-plane rotation angle.
planf_1DFFT forward plan for polar images.
planb_1DFFT backward plan for polar images.
planf_2DFFT forward plan for 2D images.
planb_2DFFT 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 881 of file Bimage_align.cpp.

◆ align2D() [2/2]

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
*prefreference 2D image.
ann_minminimum annulus (>=0).
ann_maxmaximum annulus (< image radius).
res_lolow resolution limit (angstrom).
res_hihigh resolution limit (angstrom).
shift_limitmaximum shift from nominal origin of box.
angle_limitmaximum 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 968 of file Bimage_align.cpp.

◆ align2D_pps()

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
*prefreference 2D image.
res_hihigh resolution limit.
res_lolow resolution limit.
shift_limitmaximum shift from nominal origin of box.
angle_limitmaximum rotation from original in-plane rotation angle.
planfFFT forward plan.
planbFFT 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 794 of file Bimage_align.cpp.

◆ align_fast()

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_numreference sub-image.
*pmaskcross-correlation mask.
hi_reshigh resolution limit.
lo_reslow resolution limit.
shift_limitlimit on extent of search for shift.
edge_widthwidth of smoothing edge.
gauss_widthdecay 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.

◆ align_progressive()

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
nrefreference sub-image.
*pmaskcross-correlation mask.
hi_reshigh resolution limit.
lo_reslow resolution limit.
shift_limitlimit on extent of search for shift.
planfplan for forward Fourier transform.
planbplan 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.

◆ align_progressive_fast()

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

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

Parameters
nrefreference sub-image.
shift_limitlimit 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.

◆ alloc_size()

long Bimage::alloc_size ( ) const
inline

Definition at line 267 of file Bimage.h.

◆ apply_soft_mask()

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

Applies a soft mask to a sub-image.

Parameters
nnsub-image.
pmasksoft mask: [0,1].
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillvalue 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 2516 of file Bimage_mask.cpp.

◆ assemble_tiles()

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

Assembles overlapping tiles into this image.

Parameters
*ptmulti-image containing tiles.
flagflag 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 433 of file Bimage_combine.cpp.

◆ auto_correlate()

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

Calculates an autocorrelation map by Fast Fourier transformation.

Parameters
hireshigh resolution limit.
loreslow 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.

◆ average() [1/3]

double Bimage::average ( )
inline

Definition at line 543 of file Bimage.h.

◆ average() [2/3]

void Bimage::average ( double  d)
inline

Definition at line 547 of file Bimage.h.

◆ average() [3/3]

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
ccchannel.
xfx location.
yfy location.
zfz location.
nnimage number.
iscaleinverse scale.
Returns
double average.
All neighboring voxels in x, y and z are averaged and result returned.

Definition at line 1371 of file Bimage.cpp.

◆ average2D()

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
ccchannel.
xfx location.
yfy location.
zfz location.
nnimage number.
iscaleinverse scale.
Returns
double average.
All neighboring voxels in x and y are averaged and result returned.

Definition at line 1334 of file Bimage.cpp.

◆ average_images() [1/2]

void Bimage::average_images ( )
inline

Definition at line 724 of file Bimage.h.

◆ average_images() [2/2]

Bimage * Bimage::average_images ( bool  sd)

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

Parameters
sdflag to calculate linked standard deviation image.
Returns
Bimage* average image.

Definition at line 3336 of file Bimage.cpp.

◆ average_phase_difference()

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
*preal space reference image.
res_hiupper resolution limit.
res_lolower resolution limit.
weightingweighting 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 1986 of file Bimage_fspace.cpp.

◆ back_project()

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.

◆ background() [1/3]

void Bimage::background ( double  bkg)
inline

Definition at line 555 of file Bimage.h.

◆ background() [2/3]

double Bimage::background ( long  nn)
inline

Definition at line 549 of file Bimage.h.

◆ background() [3/3]

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

Definition at line 552 of file Bimage.h.

◆ bar() [1/2]

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
nnsub-image.
startstart of bar.
endend of bar.
widthwidth of bar.
edge_widthbar edge width.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillfill 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 757 of file Bimage_edit.cpp.

◆ bar() [2/2]

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
startstart of bar.
endend of bar.
widthwidth of bar.
edge_widthbar edge width.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillfill 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 731 of file Bimage_edit.cpp.

◆ bin() [1/2]

int Bimage::bin ( long  b)
inline

Definition at line 1293 of file Bimage.h.

◆ bin() [2/2]

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

Bins by an integer size in place.

Parameters
bk3-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.

◆ bin_around_origin()

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
bininteger bin factor.
Returns
Bimage* new image.
An image is binned by an integer size, square in 2D and cubic in 3D.

Definition at line 331 of file Bimage_bin.cpp.

◆ bin_copy() [1/2]

Bimage* Bimage::bin_copy ( long  b)
inline

Definition at line 1298 of file Bimage.h.

◆ bin_copy() [2/2]

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

Bins by an integer size and returns a new image.

Parameters
bk3-value vector of integer bin factors.
Returns
Bimage* new image.
An image is binned by an integer size.

Definition at line 267 of file Bimage_bin.cpp.

◆ blend()

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

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

Parameters
*psecond image.
numbernumber 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 106 of file Bimage_combine.cpp.

◆ blobs()

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
thresholdthreshold to define contiguous regions.
min_sizeminimum number of voxels to keep a region.
max_sizemaximum number of voxels to keep a region.
setvaluevalue to assign to deleted regions (typically set to threshold).
signsign 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 537 of file Bimage_segment.cpp.

◆ calculate_background() [1/4]

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

Calculates the background for each sub-image.

Parameters
*pmaskforeground mask.
flagflag 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.

◆ calculate_background() [2/4]

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

Calculates the background for one sub-image.

Parameters
*pmaskforeground mask.
nnsub-image.
flagflag 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.

◆ calculate_background() [3/4]

int Bimage::calculate_background ( int  flag = 0)

Calculates the background for each sub-image.

Parameters
flagflag 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.

◆ calculate_background() [4/4]

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

Calculates the background for one sub-image.

Parameters
nnsub-image.
flagflag 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.

◆ cartesian_to_cylindrical()

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

Calculates an image with cylindrical coordinates.

Parameters
nannulinumber of annuli.
nphinumber of phi angles.
flagswitch: 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 592 of file Bimage_polar.cpp.

◆ cartesian_to_spherical()

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

Calculates an image with spherical coordinates.

Parameters
nannulinumber of annuli.
nphinumber of phi angles.
nthetanumber 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 501 of file Bimage_polar.cpp.

◆ catenate()

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

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

Parameters
mnumber of images in the array.
**parray of images.
The images must all have the same dimensions.

Definition at line 52 of file Bimage_combine.cpp.

◆ ccmap_confidence()

double Bimage::ccmap_confidence ( long  nn)

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

Author
Bernard Heymann and Xiange Zheng
Parameters
nnsub-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 1950 of file Bimage_correlate.cpp.

◆ center()

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

Centers an image.

Parameters
fill_typefill type for filling empty regions.
fillvalue to fill in empty regions.
Returns
int error code.

Definition at line 694 of file Bimage_transform.cpp.

◆ center_wrap()

int Bimage::center_wrap ( )

Centers an image with wrapping.

Returns
int error code.

Definition at line 708 of file Bimage_transform.cpp.

◆ central_section()

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

Calculates a central section of a 3D fourier transform.

Parameters
mat3x3 rotation or skewing matrix.
resolutionhigh resolution limit.
*kernelfrequency 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.

◆ change_symmetry()

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

Changes the symmetry order for cyclic and dihedral maps.

Parameters
*symoldoriginal symmetry.
*symnunew symmetry.
radiusradius in voxels of repeating units.
z_slopeslope 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.

◆ change_transform_size()

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

Resizes a "standard" transform.

Parameters
nusizenew 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.

◆ change_type() [1/3]

void Bimage::change_type ( char *  string)

Get the data type from a string.

Parameters
*stringstring describing the data type.

Definition at line 1795 of file Bimage.cpp.

◆ change_type() [2/3]

void Bimage::change_type ( char  letter)

Get the data type indicated by a single letter code.

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

Definition at line 1765 of file Bimage.cpp.

◆ change_type() [3/3]

void Bimage::change_type ( DataType  nutype)

Change the data to the new type.

Parameters
nutypenew data type.

Definition at line 1830 of file Bimage.cpp.

◆ channels() [1/2]

long Bimage::channels ( )
inline

Definition at line 384 of file Bimage.h.

◆ channels() [2/2]

void Bimage::channels ( long  cc)
inline

Definition at line 385 of file Bimage.h.

◆ check()

void Bimage::check ( )

Checks an image for reasonable properties.

Definition at line 419 of file Bimage.cpp.

◆ check_if_same_image_size()

bool Bimage::check_if_same_image_size ( Bimage *  p)

Check if two images are the same size.

Parameters
*pimage 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 592 of file Bimage.cpp.

◆ check_if_same_size()

bool Bimage::check_if_same_size ( Bimage *  p)

Check if two images are the same size.

Parameters
*pimage 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 566 of file Bimage.cpp.

◆ check_neighbors()

long Bimage::check_neighbors ( long  idx)

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

Parameters
idxindex in multi-image.
Returns
long new value assigned.

Definition at line 406 of file Bimage_segment.cpp.

◆ check_point_group()

double Bimage::check_point_group ( Bstring &  check_string)

Checks for the requested symmetries.

Parameters
&check_stringstring 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.

◆ check_resolution()

void Bimage::check_resolution ( double &  resolution)

Checks that the resolution falls within reasonable limits.

Parameters
&resolutionresolution (modified).
The resolution is set to between half the real size and the Nyquist frequency.

Definition at line 635 of file Bimage.cpp.

◆ check_sampling()

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 616 of file Bimage.cpp.

◆ clear()

void Bimage::clear ( )
inline

Definition at line 705 of file Bimage.h.

◆ cmyk()

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

Returns a color value at the given index.

Parameters
jindex.
Returns
CMYK<double> the color value.
The index refers to compound values.

Definition at line 1083 of file Bimage.cpp.

◆ cmyk_to_rgb()

void Bimage::cmyk_to_rgb ( )

Converts a CMYK color image to RGB.

Definition at line 206 of file Bimage_color.cpp.

◆ color_blue()

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

Converts a gray-scale image to blue.

Parameters
cminlower grayscale boundary.
cmaxupper grayscale boundary.
flagsets the type of conversion
Returns
int 0.
A grayscale image is converted to blue between the given minimum and maximum.

Definition at line 337 of file Bimage_color.cpp.

◆ color_combine()

int Bimage::color_combine ( Bimage *  p)

Combines two colored images.

Parameters
*psecond image.
Returns
int 0.
Each pair of voxels is summed and the result truncated to 255.

Definition at line 382 of file Bimage_color.cpp.

◆ color_green()

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

Converts a gray-scale image to green.

Parameters
cminlower grayscale boundary.
cmaxupper grayscale boundary.
flagsets the type of conversion
Returns
int 0.
A grayscale image is converted to green between the given minimum and maximum.

Definition at line 322 of file Bimage_color.cpp.

◆ color_red()

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

Converts a gray-scale image to red.

Parameters
cminlower grayscale boundary.
cmaxupper grayscale boundary.
flagsets the type of conversion
Returns
int 0.
A grayscale image is converted to red between the given minimum and maximum.

Definition at line 307 of file Bimage_color.cpp.

◆ color_spectrum()

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

Colorizes an image to a spectrum.

Parameters
cminlower grayscale boundary.
cmaxupper 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 415 of file Bimage_color.cpp.

◆ color_to_simple()

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.

◆ combine_channels()

void Bimage::combine_channels ( long  nc)

The channels are composed from individual images.

Parameters
ncnumber of channels.
The input image is replaced with a new image.

Definition at line 1987 of file Bimage.cpp.

◆ combined_complex_product() [1/4]

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.

◆ combined_complex_product() [2/4]

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
*pmaskbinary 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.

◆ combined_complex_product() [3/4]

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
hireshigh resolution limit.
loreslow 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.

◆ combined_complex_product() [4/4]

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
hireshigh resolution limit.
loreslow resolution limit.
*pmaskbinary 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.

◆ combined_complex_product_implicit_mask()

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
hireshigh resolution limit.
loreslow 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 1090 of file Bimage_complex.cpp.

◆ compatible()

bool Bimage::compatible ( Bimage *  p)

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

Parameters
*preference 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 653 of file Bimage.cpp.

◆ complex()

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

Returns a complex value at the given index.

Parameters
jindex.
Returns
Complex<double> the complex floating point value.
The index refers to compound values.

Definition at line 1027 of file Bimage.cpp.

◆ complex_apply_dual_mask()

int Bimage::complex_apply_dual_mask ( Bimage *  pmask)

Applies a dual mask to a complex image.

Parameters
*pmaskmask (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.

◆ complex_apply_mask()

int Bimage::complex_apply_mask ( Bimage *  pmask)

Applies a mask to a complex image.

Parameters
*pmaskmask (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.

◆ complex_apply_negative_mask()

int Bimage::complex_apply_negative_mask ( Bimage *  pmask)

Applies a negative mask to a complex image.

Parameters
*pmaskmask (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.

◆ complex_bandpass()

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

Bandpasses a Fourier transform.

Parameters
hireshigh resolution limit.
loreslow 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.

◆ complex_conjugate()

void Bimage::complex_conjugate ( )

Calculates the complex conjugate image.

Definition at line 183 of file Bimage_complex.cpp.

◆ complex_conjugate_product()

int Bimage::complex_conjugate_product ( Bimage *  p)

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

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

◆ complex_conjugate_product_one2many()

Bimage * Bimage::complex_conjugate_product_one2many ( Bimage *  p)

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

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

◆ complex_multiply()

int Bimage::complex_multiply ( Bimage *  p)

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

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

◆ complex_normalize()

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.

◆ complex_power()

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.

◆ complex_product()

int Bimage::complex_product ( Bimage *  p)

Calculates the complex product of two complex images.

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

◆ complex_to_amplitudes()

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.

◆ complex_to_imaginary()

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.

◆ complex_to_intensities()

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.

◆ complex_to_phases()

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.

◆ complex_to_real()

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.

◆ complex_to_signed_amplitudes()

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.

◆ compound_type() [1/2]

CompoundType Bimage::compound_type ( )
inline

Definition at line 364 of file Bimage.h.

◆ compound_type() [2/2]

void Bimage::compound_type ( CompoundType  ct)
inline

Definition at line 365 of file Bimage.h.

◆ compound_type_size()

long Bimage::compound_type_size ( )
inline

Definition at line 368 of file Bimage.h.

◆ compound_type_string()

Bstring Bimage::compound_type_string ( )

Get the string representation of a datatype.

Returns
Bstring string representation of a datatype.

Definition at line 1715 of file Bimage.cpp.

◆ convert_to_helix()

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

Converts a map to a helix.

Parameters
helix_riserise per asymmetric unit
helix_anglerotation angle per asymmetric unit.
offsetoffset 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.

◆ convolve()

int Bimage::convolve ( Bimage *  pkernel)

Convolves an image with an arbitrary size convolution filter.

Parameters
*pkernelkernel 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 473 of file Bimage_filter.cpp.

◆ convolve_chunk()

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

Definition at line 392 of file Bimage_filter.cpp.

◆ coordinates() [1/4]

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

Definition at line 456 of file Bimage.h.

◆ coordinates() [2/4]

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

Definition at line 445 of file Bimage.h.

◆ coordinates() [3/4]

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

Definition at line 429 of file Bimage.h.

◆ coordinates() [4/4]

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

Definition at line 436 of file Bimage.h.

◆ copy() [1/2]

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 2702 of file Bimage.cpp.

◆ copy() [2/2]

Bimage * Bimage::copy ( long  nu_nimg)

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

Parameters
nu_nimgnew number of images (if < 1, keep the old number)
Returns
Bimage* copied image, NULL if copy failed.

Definition at line 2728 of file Bimage.cpp.

◆ copy_header() [1/2]

Bimage* Bimage::copy_header ( )
inline

Definition at line 658 of file Bimage.h.

◆ copy_header() [2/2]

Bimage * Bimage::copy_header ( long  nu_nimg)

Copy an image structure into a new one.

Parameters
nu_nimgnew 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 2762 of file Bimage.cpp.

◆ correct_background() [1/3]

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

Corrects the background for each sub-image.

Parameters
*pmaskforeground mask.
flagflag 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.

◆ correct_background() [2/3]

int Bimage::correct_background ( int  flag = 0)

Corrects the background for each sub-image.

Parameters
flagflag 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.

◆ correct_background() [3/3]

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

Corrects the background for one sub-image.

Parameters
nnsub-image.
flagflag 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.

◆ correlate() [1/2]

double Bimage::correlate ( Bimage *  p)

Calculates correlation coefficient between two images.

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

◆ correlate() [2/2]

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

Calculates a correlation coefficient between two images.

Parameters
*psecond image.
rminminimum radius (pixel units).
rmaxmaximum radius (pixel units).
*pmaskmask (can be NULL).
flagflag 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.

◆ correlate_annuli()

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
*polrefreference image polar power spectrum transform.
ann_minlow resolution cutoff (in inverse pixels).
ann_maxhigh resolution cutoff (in inverse pixels).
ang_minminimum angle to test for (radians).
ang_maxmaximum angle to test for (radians).
planfFFT forward plan.
planbFFT backward plan.
&cc_maxpointer 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.

◆ correlation_coefficient()

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

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

Parameters
shiftreal 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 466 of file Bimage_correlate.cpp.

◆ cross_correlate() [1/4]

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

Definition at line 954 of file Bimage.h.

◆ cross_correlate() [2/4]

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

◆ cross_correlate() [3/4]

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

Calculates a cross-correlation map by Fast Fourier transformation.

Parameters
*psecond image.
hireshigh resolution limit.
loreslow resolution limit.
*pmaskbinary 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 417 of file Bimage_correlate.cpp.

◆ cross_correlate() [4/4]

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
*psecond image.
hireshigh resolution limit.
loreslow resolution limit.
planfforward transform plan.
planbbackward 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.

◆ cross_correlate_fspace()

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

Calculates a cross-correlation map by Fast Fourier transformation.

Parameters
*psecond image.
hireshigh resolution limit.
loreslow resolution limit.
shift_limitmaximum 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 559 of file Bimage_correlate.cpp.

◆ cross_correlate_two_way()

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
*psecond image.
hireshigh resolution limit.
loreslow resolution limit.
planfFFT forward plan.
planbFFT 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 667 of file Bimage_correlate.cpp.

◆ cross_correlate_validate()

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

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

Parameters
*psecond image.
*pmaskbinary 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 748 of file Bimage_correlate.cpp.

◆ cylinder()

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
centerthree vector center of cylinder.
radiuscylinder radius.
heightcylinder heigth.
widthgaussian width of smoothing function.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillfill 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 467 of file Bimage_edit.cpp.

◆ cylindrical_shells()

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 928 of file Bimage_polar.cpp.

◆ data_alloc() [1/3]

unsigned char* Bimage::data_alloc ( )
inline

Definition at line 271 of file Bimage.h.

◆ data_alloc() [2/3]

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

Allocate image data with size parameters.

Parameters
typedata type.
ctypecompound type.
nxx dimension.
nyy dimension.
nzz dimension.
nnnumber of sub-images.
Returns
unsigned char* pointer to data.
The image parameters are set and a new data block allocated.

Definition at line 845 of file Bimage.cpp.

◆ data_alloc() [3/3]

unsigned char * Bimage::data_alloc ( long  nbytes)

Allocate image data.

Parameters
nbytesnumber of bytes to allocate.
Returns
unsigned char* pointer to data.
Any old data block is deleted.

Definition at line 799 of file Bimage.cpp.

◆ data_alloc_and_clear() [1/3]

unsigned char* Bimage::data_alloc_and_clear ( )
inline

Definition at line 272 of file Bimage.h.

◆ data_alloc_and_clear() [2/3]

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

Definition at line 277 of file Bimage.h.

◆ data_alloc_and_clear() [3/3]

unsigned char* Bimage::data_alloc_and_clear ( long  nbytes)
inline

Definition at line 274 of file Bimage.h.

◆ data_assign()

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

Assign image data.

Parameters
*nudataallocated data pointer.
Returns
unsigned char* pointer to data.
Note: The size of the data block must correspond to the image dimensions!

Definition at line 875 of file Bimage.cpp.

◆ data_delete()

void Bimage::data_delete ( )

Deallocates the image data.

Definition at line 897 of file Bimage.cpp.

◆ data_offset() [1/2]

long Bimage::data_offset ( )
inline

Definition at line 288 of file Bimage.h.

◆ data_offset() [2/2]

void Bimage::data_offset ( long  doff)
inline

Definition at line 289 of file Bimage.h.

◆ data_pointer() [1/3]

unsigned char* Bimage::data_pointer ( )
inline

Definition at line 284 of file Bimage.h.

◆ data_pointer() [2/3]

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

Definition at line 285 of file Bimage.h.

◆ data_pointer() [3/3]

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

Definition at line 286 of file Bimage.h.

◆ data_size()

long Bimage::data_size ( )
inline

Definition at line 270 of file Bimage.h.

◆ data_type() [1/2]

DataType Bimage::data_type ( )
inline

Definition at line 362 of file Bimage.h.

◆ data_type() [2/2]

void Bimage::data_type ( DataType  dt)
inline

Definition at line 363 of file Bimage.h.

◆ data_type_bits()

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 1582 of file Bimage.cpp.

◆ data_type_max()

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 1663 of file Bimage.cpp.

◆ data_type_min()

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 1633 of file Bimage.cpp.

◆ data_type_size()

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 1607 of file Bimage.cpp.

◆ data_type_string()

Bstring Bimage::data_type_string ( )

Get the string representation of a datatype.

Returns
Bstring string representation of a datatype.

Definition at line 1689 of file Bimage.cpp.

◆ default_origin()

Vector3<double> Bimage::default_origin ( )
inline

Definition at line 592 of file Bimage.h.

◆ defocus_scale()

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

Definition at line 216 of file Bimage_powerspectrum.cpp.

◆ delete_images()

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

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

Parameters
listlist of sub-images to retain or delete.
retain0=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 2156 of file Bimage.cpp.

◆ density() [1/2]

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

Definition at line 711 of file Bimage.h.

◆ density() [2/2]

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
nnsub-image number.
coordposition of density in map (voxels).
radiusspherical radius.
sigmastandard deviation result.
Returns
double average density.
The density origin is positioned on the component.

Definition at line 3012 of file Bimage.cpp.

◆ distort_elliptically()

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

Transforms a tubular cylinder to an elliptical profile.

Parameters
angleangle of elliptical maximum.
shiftoutward 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.

◆ divide()

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

Divides the first image by the second.

Parameters
*pother image.
scaledensity scale to apply to other image
shiftdensity 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 3582 of file Bimage.cpp.

◆ divide_one()

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
*pother image.
scaledensity scale to apply to other image
shiftdensity 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 3635 of file Bimage.cpp.

◆ dyad_interpolate()

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

Definition at line 56 of file Bimage_helix.cpp.

◆ edge() [1/2]

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
typetype of edge: 0=rectangle, 1=oval, 2=cylinder
rectthree-value size of the area to be smoothed.
startthree-value start for smoothing.
widthgaussian width of smoothing function.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillvalue 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 321 of file Bimage_edit.cpp.

◆ edge() [2/2]

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
nnsub-image.
typetype of edge: 0=rectangle, 1=oval, 2=cylinder
rectthree-value size of the area to be smoothed.
startthree-value start for smoothing.
widthgaussian width of smoothing function.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillvalue 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 367 of file Bimage_edit.cpp.

◆ edge_mask()

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

Creates a mask with the edge approaching zero.

Parameters
typetype of edge: 0=rectangle, 1=oval, 2=cylinder
rectthree-value size of the area to be masked.
startthree-value start for mask.
widthgaussian 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 233 of file Bimage_edit.cpp.

◆ enlarge()

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

Enlarges an image by an inetger scale.

Parameters
scalethree-value scale.
Returns
int 0.
An image is enlarged by integer amounts.
The new data replaces the old data.

Definition at line 499 of file Bimage_resize.cpp.

◆ erase()

long Bimage::erase ( string  tag)
inline

Definition at line 241 of file Bimage.h.

◆ extract() [1/6]

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

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

Parameters
n1first sub-image to extract.
n2last sub-image to extract.
Returns
Bimage* the new image structure, NULL if copy failed.

Definition at line 40 of file Bimage_extract.cpp.

◆ extract() [2/6]

Bimage * Bimage::extract ( long  nn)

Extracts one sub-image into new image structure.

Parameters
nnimage number to extract.
Returns
Bimage* the new image structure, NULL if copy failed.

Definition at line 21 of file Bimage_extract.cpp.

◆ extract() [3/6]

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

Definition at line 664 of file Bimage.h.

◆ extract() [4/6]

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
nnimage number to extract.
locextraction location.
sizeextraction size.
oriextraction origin.
matorientation matrix.
Returns
Bimage* the new image structure, NULL if copy failed.

Definition at line 108 of file Bimage_extract.cpp.

◆ extract() [5/6]

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

Definition at line 671 of file Bimage.h.

◆ extract() [6/6]

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
nnimage number to extract.
coordsextraction start.
sizeextraction size.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillfill value.
Returns
Bimage* the new image structure, NULL if copy failed.

Definition at line 69 of file Bimage_extract.cpp.

◆ extract_filament()

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_numimage number from which to extract filament.
widthwidth of filament image to extract.
axishelical axis alignment: x=1, y=2, z=3.
nsplinenumber of coordinates in spline curve.
*splinespline curve.
Returns
Bimage* one filament image.
A single filament is extracted and returned.

Definition at line 1128 of file Bimage_extract.cpp.

◆ extract_line()

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
nnimage number from which to extract.
start3-vector start of line.
end3-vector end of line.
widthwidth 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 505 of file Bimage_extract.cpp.

◆ extract_magnify()

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

Extracts a region from an image to magnify.

Parameters
nnimage number to extract.
centercenter of region to magnify.
ext_sizesize of region to magnify.
scaledimensional 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 872 of file Bimage_extract.cpp.

◆ extract_shell()

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

Extracts a shell from an image into a new image.

Parameters
nnimage number from which to extract, -1 indicates all images.
minradminimum shell radius.
maxradmaximum 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 193 of file Bimage_extract.cpp.

◆ extract_show()

Bimage * Bimage::extract_show ( int  aflag)

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

Parameters
aflagaveraging 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 816 of file Bimage_extract.cpp.

◆ extract_show_chunk()

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

Definition at line 700 of file Bimage_extract.cpp.

◆ extract_slice()

Bimage * Bimage::extract_slice ( long  nz)

Extracts a given slice or slices from an image.

Parameters
nzslice 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 1036 of file Bimage_extract.cpp.

◆ extract_tetrahedron()

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

Extracts a tetrahedral part of the image.

Parameters
*tetfour 3-value vectors defining the tetrahedron.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillfill 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 542 of file Bimage_extract.cpp.

◆ extract_tiles() [1/3]

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
nnimage number from which to extract.
start3-vector start for first tile to be extracted.
region3-vector size of part of image to be extracted (0 = whole image).
tile_size3-vector size of extracted image.
step_size3-vector size of tile intervals.
exceedflag 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 397 of file Bimage_extract.cpp.

◆ extract_tiles() [2/3]

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
nnimage number from which to extract.
tile_size3-vector size of extracted image.
fractionoverlap 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 449 of file Bimage_extract.cpp.

◆ extract_tiles() [3/3]

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
nnimage number from which to extract, -1 indicates all images.
*coordscoordinates for the tile origins.
tile_size3-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 331 of file Bimage_extract.cpp.

◆ extract_wrap() [1/2]

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
nnimage number to extract.
locextraction location.
sizeextraction size.
oriextraction origin.
matorientation matrix.
Returns
Bimage* the new image structure, NULL if copy failed.

Definition at line 151 of file Bimage_extract.cpp.

◆ extract_wrap() [2/2]

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

Definition at line 677 of file Bimage.h.

◆ extrude_cross_section()

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
lengthlength in z.
helix_risehelical subunit rise in angstrom.
helix_anglehelical subunit rotation in radians.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillvalue 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.

◆ fft() [1/4]

int Bimage::fft ( )
inline

Definition at line 830 of file Bimage.h.

◆ fft() [2/4]

int Bimage::fft ( fft_direction  dir)

Fast Fourier transforms an image.

Parameters
dirdirection 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.

◆ fft() [3/4]

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

Fast Fourier transforms an image.

Parameters
dirdirection of transformation (FFTW_FORWARD or FFTW_BACKWARD)
norm_flagnormalization: 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.

◆ fft() [4/4]

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

Fast Fourier transforms an image.

Parameters
planFourier transform plan.
norm_flagnormalization: 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.

◆ fft_back() [1/2]

int Bimage::fft_back ( )
inline

Definition at line 831 of file Bimage.h.

◆ fft_back() [2/2]

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

Definition at line 838 of file Bimage.h.

◆ fft_setup()

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

Sets up a plan for fast Fourier transforms.

Parameters
dirdirection of transformation (FFTW_FORWARD or FFTW_BACKWARD)
optoptimization (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.

◆ filament_density()

Bimage * Bimage::filament_density ( double  width)

Estimates the density per pixel length of a filament.

Parameters
widthfilament 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.

◆ filament_width()

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

Estimates the width of a filament.

Parameters
widthwindow size.
lim_lominimum filament width.
lim_himaximum 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.

◆ file_name() [1/2]

string& Bimage::file_name ( )
inline

Definition at line 246 of file Bimage.h.

◆ file_name() [2/2]

void Bimage::file_name ( string  s)
inline

Definition at line 245 of file Bimage.h.

◆ fill()

void Bimage::fill ( double  v)
inline

Definition at line 706 of file Bimage.h.

◆ fill_gaps()

int Bimage::fill_gaps ( long  step)

Fill the voxels that are not calculated.

Parameters
stepstep 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 855 of file Bimage_edit.cpp.

◆ fill_value()

TypePointer Bimage::fill_value ( double  v)

Definition at line 1089 of file Bimage.cpp.

◆ filter_average() [1/2]

int Bimage::filter_average ( long  kernel_size)

Applies an averaging filter to an image.

Parameters
kernel_sizelength 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 207 of file Bimage_filter.cpp.

◆ filter_average() [2/2]

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

Definition at line 213 of file Bimage_filter.cpp.

◆ filter_bilateral()

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
sigma1sigma for distance weighting function.
sigma2sigma for density difference weighting function.
kernel_typekernel type for range filter.
kernel_radiuskernel 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 783 of file Bimage_filter.cpp.

◆ filter_bilateral_chunk()

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

Definition at line 670 of file Bimage_filter.cpp.

◆ filter_dog()

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

Convolves the image with a difference of gausians kernel.

Parameters
sigma1sigma for the inner gaussian.
sigma2sigma for the outer gaussian.
Returns
int 0, <0 on error.

Definition at line 641 of file Bimage_filter.cpp.

◆ filter_extremes() [1/2]

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 620 of file Bimage_segment.cpp.

◆ filter_extremes() [2/2]

int Bimage::filter_extremes ( int  mod_flag)

Filters the extremes out of an image.

Parameters
mod_flagmodification 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 649 of file Bimage_segment.cpp.

◆ filter_gaussian()

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

Applies a gaussian filter to an image.

Parameters
kernel_sizelength of kernel edge.
sigmagaussian 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 324 of file Bimage_filter.cpp.

◆ filter_ortho()

int Bimage::filter_ortho ( int  type)

Convolves the image with an orthogonal kernel with wrapping.

Parameters
typetype 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 544 of file Bimage_filter.cpp.

◆ filter_peak()

Bimage * Bimage::filter_peak ( long  kernel_size)

Finds the peaks in an image.

Parameters
kernel_sizelength 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 1075 of file Bimage_filter.cpp.

◆ filter_rank()

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

Applies a median filter to an image.

Parameters
kernel_sizelength of kernel edge (typically 3).
rankwhich 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 1021 of file Bimage_filter.cpp.

◆ filter_rank_chunk()

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

Definition at line 940 of file Bimage_filter.cpp.

◆ filter_rolling_ball()

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

Apply a rolling ball filter.

Parameters
radiusradius of rolling ball.
scaledensity scale.
Returns
int 0.

Definition at line 835 of file Bimage_filter.cpp.

◆ filter_sinc()

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 365 of file Bimage_filter.cpp.

◆ find_center()

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
*pmaskbinary mask (only 0 and 1).
hireshigh resolution limit.
loreslow resolution limit.
radiussearch radius (if < 1, default 1e30).
sigmaattenuation around radius.
refine_flagset 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 1235 of file Bimage_correlate.cpp.

◆ find_cyclic_point_group()

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
sympoint group.
binfacbinning for faster searching (limited to 1,2,3).
hireshigh resolution limit in angstroms.
loreslow 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.

◆ find_helix_parameters() [1/2]

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_startstart value for angle.
angle_endend value for angle.
angle_stepstep size for angle.
binbin image for faster searching (limited to 1,2,3).
hireshigh resolution limit in angstroms.
loreslow resolution limit in angstroms.
radiusradius 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.

◆ find_helix_parameters() [2/2]

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_startstart value for rise.
rise_endend value for rise.
rise_stepstep size for rise.
angle_startstart value for angle.
angle_endend value for angle.
angle_stepstep size for angle.
binbin image for faster searching (limited to 1,2,3).
radiusradius 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.

◆ find_peak()

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

Finds the peak in an image to the nearest voxel.

Parameters
radiussearch radius (if < 1, default 1e30).
sigmaattenuation 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 1340 of file Bimage_correlate.cpp.

◆ find_peaks() [1/2]

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_distexclusion distance between peaks.
&ncoornumber of coordinates.
&threshold_minminimum threshold to choose peaks.
&threshold_maxmaximum threshold to choose peaks.
pix_minminimum peak width.
pix_maxmaximum 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 1828 of file Bimage_correlate.cpp.

◆ find_peaks() [2/2]

Bimage * Bimage::find_peaks ( long  kernelsize)

Finds peaks in a map with periodic boundaries.

Parameters
kernelsizesize 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 1739 of file Bimage_correlate.cpp.

◆ find_point_group()

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
sympoint group.
angle_stepangular step size for search.
binfacbinning for faster searching (limited to 1,2,3).
hireshigh resolution limit in angstroms.
loreslow resolution limit in angstroms.
flagsflag 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.

◆ find_shift() [1/5]

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
*prefreference image.
*pmaskbinary mask (only 0 and 1).
hireshigh resolution limit.
loreslow resolution limit.
radiussearch radius (if < 1, default 1e30).
sigmaattenuation around radius.
refine_flagset 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 929 of file Bimage_correlate.cpp.

◆ find_shift() [2/5]

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

◆ find_shift() [3/5]

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
*prefreference image.
*pmaskbinary mask (only 0 and 1).
hireshigh resolution limit.
loreslow resolution limit.
radiussearch radius (if < 1, default 1e30).
sigmaattenuation around radius.
refine_flagset to refine shift to subpixel resolution.
planfforward Fourier transform plan.
planbbackward Fourier transform plan.
&cccorrelation 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 1091 of file Bimage_correlate.cpp.

◆ find_shift() [4/5]

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
*prefreference image.
hireshigh resolution limit.
loreslow resolution limit.
radiussearch radius (if < 1, default 1e30).
sigmaattenuation around radius.
refine_flagset to refine shift to subpixel resolution.
planfforward Fourier transform plan.
planbbackward 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 1028 of file Bimage_correlate.cpp.

◆ find_shift() [5/5]

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
nnsub-image to align.
*prefreference image.
*pmaskbinary mask for cross-correlation (only 0 and 1).
hi_reshigh resolution limit.
lo_reslow resolution limit.
shift_limitsearch radius (if < 1, default 1e30).
planfforward Fourier transform plan.
planbbackward 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 1144 of file Bimage_correlate.cpp.

◆ find_shift_in_transform() [1/2]

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

Finds the shift by brute force backtransformation for selected shifts.

Parameters
shift_limitmaximum 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 501 of file Bimage_correlate.cpp.

◆ find_shift_in_transform() [2/2]

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

Definition at line 81 of file Bimage_align.cpp.

◆ find_symmetric_view()

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
*ptempsymmetric template.
&symsymmetry.
phi_stepphi angle step size (radians).
theta_steptheta angle step size (radians).
alpha_steprotation angle step size (radians).
shiftshift 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.

◆ find_template()

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
*ptemptemplate image.
*pmaskreciprocal space mask.
hireshigh resolution limit.
loreslow resolution limit.
binlevel of image binning.
planfforward Fourier transform plan.
planbbackward 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 1177 of file Bimage_correlate.cpp.

◆ fit_peak()

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

◆ fix_type()

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 1740 of file Bimage.cpp.

◆ fourier_type() [1/2]

FourierType Bimage::fourier_type ( )
inline

Definition at line 380 of file Bimage.h.

◆ fourier_type() [2/2]

void Bimage::fourier_type ( FourierType  tf)
inline

Definition at line 381 of file Bimage.h.

◆ friedel_apply()

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 1806 of file Bimage_fspace.cpp.

◆ friedel_check()

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 1744 of file Bimage_fspace.cpp.

◆ fsc() [1/2]

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

Definition at line 325 of file Bimage_resolution.cpp.

◆ fsc() [2/2]

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

Definition at line 245 of file Bimage_resolution.cpp.

◆ fsc_dpr()

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_reshigh resolution limit.
sampling_ratioradial sampling ratio (1 for per voxel sampling).
flagif 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.

◆ fsc_local()

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
*psecond image.
*pmaskmask.
hi_reshigh resolution limit.
*cutoffcorrelation threshold(s).
mask_levelmask level index.
sizekernel size.
padpadding factor.
vedgeedge size.
stepvoxel step size.
taperkernel tapering function.
fillbackground 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 592 of file Bimage_resolution.cpp.

◆ fsc_shell()

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
*psecond image.
hi_reshigh resolution limit.
*cutoffcorrelation threshold(s).
thicknessshell thickness.
stepstep size between shells.
minradminimum radius.
maxradmaximum radius.
padpadding factor.
smoothflag for edge smooting.
fillbackground fill value.
Returns
Bimage* a 1D image containing the shell resolutions.

Definition at line 415 of file Bimage_resolution.cpp.

◆ fspace_2D_interpolate()

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

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

Parameters
cvcomplex value from 2D transform.
mlocation in 3D relative to origin.
part_weightweight to assign to value (usually 1).
interp_typeinterpolation type (0=nearest neighbor, 1=weighted nearest neigbor, 2=trilinear).
Returns
int 0, <0 on error.

Definition at line 25 of file Bimage_reconstruct.cpp.

◆ fspace_amp_one()

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 323 of file Bimage_fspace.cpp.

◆ fspace_amp_threshold()

int Bimage::fspace_amp_threshold ( double  threshold)

Filters the amplitudes of the Fourier transform of an image.

Parameters
thresholdMiminum 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 368 of file Bimage_fspace.cpp.

◆ fspace_background()

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 46 of file Bimage_fspace.cpp.

◆ fspace_bandpass() [1/2]

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_hihigh resolution limit.
res_lolow resolution limit.
widthgaussian width of edge.
planfforward Fourier transform plan.
planbbackward 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 525 of file Bimage_fspace.cpp.

◆ fspace_bandpass() [2/2]

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

Applies a bandpass filter to an image.

Parameters
res_hihigh resolution limit.
res_lolow resolution limit.
widthgaussian 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 496 of file Bimage_fspace.cpp.

◆ fspace_default_bands()

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

Sets up default frequency space bands to generate a mask.

Parameters
res_lolow resolution limit (angstrom).
res_hihigh 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 773 of file Bimage_mask.cpp.

◆ fspace_fit_B_factor()

double Bimage::fspace_fit_B_factor ( double  res_hi = 0)

Determines the overall B-factor of an image.

Parameters
res_hihigh 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 994 of file Bimage_fspace.cpp.

◆ fspace_interpolate()

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_numsub-image number.
mlocation in image.
kernelinterpolation kernel.
Returns
Complex<double> interpolated value. The kernel lookup table must be precalculated.

Definition at line 85 of file Bimage_fspace.cpp.

◆ fspace_maximum_radius()

long Bimage::fspace_maximum_radius ( double  resolution,
double  sampling_ratio = 1 
)

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

Parameters
resolutionhigh resolution limit.
sampling_ratiofrequency space sampling (default 1 pixel/sample).
Returns
long maximum radius.
The maximum radius is either the physical image size divided by the resolution,
or Nyquist frequency.

Definition at line 26 of file Bimage_fspace.cpp.

◆ fspace_normalize()

int Bimage::fspace_normalize ( )

Normalizes an image's amplitudes.

Returns
int 0.

Definition at line 1634 of file Bimage_fspace.cpp.

◆ fspace_normalize_radial()

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

Normalizes an image's amplitudes.

Parameters
*pmaskreciprocal space mask (0 & 1, indicating inclusion of structure factors).
resolutionhigh resolution limit.
flagflag to calculate power (0) or amplitude (1).
Returns
int 0.

Definition at line 1662 of file Bimage_fspace.cpp.

◆ fspace_pack_2D() [1/2]

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

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

Parameters
*p2D particle image transform.
matrotation matrix.
hi_reshigh resolution limit.
lo_reslow resolution limit (infinite if 0).
scalescale of reconstruction and particle magnification.
part_weightweight of particle (usually 1).
interp_typeinterpolation 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 107 of file Bimage_reconstruct.cpp.

◆ fspace_pack_2D() [2/2]

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

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

Parameters
*p2D particle image transform.
asu_viewview of asymmetric unit.
*sympoint group symmetry.
hi_reshigh resolution limit.
lo_reslow resolution limit (infinite if 0).
scalescale of reconstruction and particle magnification.
part_weightweight of particle (usually 1).
interp_typeinterpolation 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 174 of file Bimage_reconstruct.cpp.

◆ fspace_pack_2D_into_central_section()

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
*p2D particle image transform.
ft_sizeFourier transform size.
scalescale of reconstruction and particle magnification.
hi_reshigh resolution limit.
lo_reslow resolution limit (infinite if 0).
matrcentral section orientation matrix.
matimage 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. 

Vector3<double> vn(mat[2][0]/mat[2][2], mat[2][1]/mat[2][2], 0);

matr = matr.transpose();

m = mat * iv; m[2] = m.scalar(vn); m = matr * m;

Definition at line 212 of file Bimage_reconstruct.cpp.

◆ fspace_pack_3D()

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
*p3D particle image transform.
hi_reshigh resolution limit.
thresholdthreshold 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 314 of file Bimage_reconstruct.cpp.

◆ fspace_positive()

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 1703 of file Bimage_fspace.cpp.

◆ fspace_radial()

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

Calculates the radial power spectrum from a Fourier transform.

Parameters
nnsub-image number.
maxradmaximum radius (i.e., high resolution limit).
flagflag to calculate power (0) or amplitude (1), and not normalize (2).
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 729 of file Bimage_fspace.cpp.

◆ fspace_radial_power()

Bimage * Bimage::fspace_radial_power ( double  resolution,
double  sampling_ratio = 1 
)

Calculates the radial power spectrum from a Fourier transform.

Parameters
resolutionhigh resolution limit.
sampling_ratiofrequency space sampling (default 1 pixel/sample).
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 610 of file Bimage_fspace.cpp.

◆ fspace_reconstruction_add()

long Bimage::fspace_reconstruction_add ( Bimage *  p)

Adds all components to a reconstruction.

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

◆ fspace_reconstruction_snr()

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 536 of file Bimage_reconstruct.cpp.

◆ fspace_reconstruction_stats()

int Bimage::fspace_reconstruction_stats ( double  resolution,
double  sampling_ratio = 1 
)

Calculates Fourier shell statistics.

Parameters
resolutionhigh resolution limit.
sampling_ratiofrequency space sampling (default 1 pixel/sample).
Returns
int 0.
The average FOM and number of FOM values in each resolution shell is determined.

Definition at line 452 of file Bimage_reconstruct.cpp.

◆ fspace_reconstruction_weigh()

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.

◆ fspace_resize() [1/2]

Bimage * Bimage::fspace_resize ( Bimage *  pref)

Resizes an image in frequency space to avoid interpolation.

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

Definition at line 253 of file Bimage_fspace.cpp.

◆ fspace_resize() [2/2]

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

Resizes an image in frequency space to avoid interpolation.

Parameters
scaleisotropic scaling.
res_hihigh resolution limit.
res_lolow resolution limit.
Returns
int 0.

Definition at line 202 of file Bimage_fspace.cpp.

◆ fspace_scale() [1/4]

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

Definition at line 842 of file Bimage_fspace.cpp.

◆ fspace_scale() [2/4]

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

Definition at line 860 of file Bimage_fspace.cpp.

◆ fspace_scale() [3/4]

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

Definition at line 927 of file Bimage_fspace.cpp.

◆ fspace_scale() [4/4]

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

Definition at line 909 of file Bimage_fspace.cpp.

◆ fspace_sqrt_amp()

int Bimage::fspace_sqrt_amp ( )

Change the amlitudes to their square roots.

Returns
int 0.

Definition at line 424 of file Bimage_fspace.cpp.

◆ fspace_square_amp()

int Bimage::fspace_square_amp ( )

Change the amlitudes to their squares.

Returns
int 0.

Definition at line 455 of file Bimage_fspace.cpp.

◆ fspace_translate() [1/2]

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

Translates an image in frequency space to avoid interpolation.

Parameters
nnsub-image to transform.
shift3-value real space shift vector.
Returns
int 0.

Definition at line 175 of file Bimage_fspace.cpp.

◆ fspace_translate() [2/2]

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

Translates an image in frequency space to avoid interpolation.

Parameters
shift3-value real space shift vector.
Returns
int error code.

Definition at line 147 of file Bimage_fspace.cpp.

◆ fspace_weigh() [1/3]

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

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

Parameters
*prefreference image.
*pmaskreciprocal space mask (0 & 1, indicating inclusion of structure factors).
resolutionhigh 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 1585 of file Bimage_fspace.cpp.

◆ fspace_weigh() [2/3]

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

Definition at line 795 of file Bimage_fspace.cpp.

◆ fspace_weigh() [3/3]

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

Definition at line 818 of file Bimage_fspace.cpp.

◆ fspace_weigh_accumulated_dose()

int Bimage::fspace_weigh_accumulated_dose ( vector< double >  dose)

Weighs an image's amplitudes with the accumulated dose.

Parameters
dosearray containing accumulated dose and parameters.
Returns
int 0.
The amplitudes are weighed using:
1. with 2 parameters: the formula of Grant and Grigorieff (2015).
2. with 3 parameters: exponential decay.

Definition at line 1561 of file Bimage_fspace.cpp.

◆ fspace_weigh_B_factor()

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

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

Parameters
BB factor.
resolutionhigh 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 1183 of file Bimage_fspace.cpp.

◆ fspace_weigh_C_curve()

int Bimage::fspace_weigh_C_curve ( double  resolution = 0)

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

Parameters
resolutionhigh 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 1226 of file Bimage_fspace.cpp.

◆ fspace_weigh_dose() [1/2]

int Bimage::fspace_weigh_dose ( double  dose_per_frame,
int  flag = 0 
)

Weighs an image's amplitudes with the accumulated dose.

Parameters
dose_per_frameelectron dose per frame.
flag0=Grant, 1=exponential decay.
Returns
int 0.
The image is Fourier transformed and the amplitudes weighed using 
the formula of Grant and Grigorieff (2015) or an exponential decay curve.

Definition at line 1497 of file Bimage_fspace.cpp.

◆ fspace_weigh_dose() [2/2]

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

Definition at line 1460 of file Bimage_fspace.cpp.

◆ fspace_weigh_FSC_curve()

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

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

Parameters
*plotFSC plot.
resolutionhigh 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 1365 of file Bimage_fspace.cpp.

◆ fspace_weigh_LoG()

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

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

Parameters
resolutionhigh resolution limit.
sigmagaussian 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 1261 of file Bimage_fspace.cpp.

◆ fspace_weigh_ramp() [1/2]

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

Weighs a transform with a ramp.

Parameters
resolutionhigh resolution limit.
axistilt axis for single tilt series (radians).
planf2D forward Fourier transform plan.
planb2D backward Fourier transform plan.
Returns
int 0.
Requirements:
    The data must be complex float and the FOM block must be allocated.

Definition at line 1124 of file Bimage_fspace.cpp.

◆ fspace_weigh_ramp() [2/2]

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

Weighs a transform with a ramp.

Parameters
resolutionhigh resolution limit.
planf2D forward Fourier transform plan.
planb2D backward Fourier transform plan.
Returns
int 0.
Requirements:
    The data must be complex float and the FOM block must be allocated.

Definition at line 1062 of file Bimage_fspace.cpp.

◆ fspace_weigh_RPS_curve()

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

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

Parameters
*plotRPS plot.
resolutionhigh 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 1308 of file Bimage_fspace.cpp.

◆ gaussian_sphere()

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
nnsub-image.
centercenter of sphere.
sigmaGaussian sigma value.
ampamplitude.
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 494 of file Bimage_edit.cpp.

◆ get() [1/3]

void Bimage::get ( Bstring  tag)

Prints out header information associated with a tag string.

Parameters
tagtag string.

Definition at line 2678 of file Bimage.cpp.

◆ get() [2/3]

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

Returns the data value at the given coordinates.

Parameters
nnimage index.
xxx coordinate.
yyy coordinate.
zzz coordinate.
ccchannel index.
Returns
double value.
The elemental data value is returned in double precision.

Definition at line 960 of file Bimage.cpp.

◆ get() [3/3]

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

Returns the data value at the given coordinates.

Parameters
nnimage index.
voxvoxel coordinates.
ccchannel index.
Returns
double value.
The elemental data value is returned in double precision.

Definition at line 982 of file Bimage.cpp.

◆ get_localtime()

tm* Bimage::get_localtime ( )
inline

Definition at line 260 of file Bimage.h.

◆ get_time()

time_t Bimage::get_time ( )
inline

Definition at line 256 of file Bimage.h.

◆ gradient_correction()

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.

◆ graph_segment()

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
typesegmentation type: 1=threshold, 2=statistical region merging.
*pmaskmask to limit areas for segmentation.
connect_typeconnection type: 0=direct neighbors, 1=all neighbors.
complexitya value determining the number of segments.
min_sizeminimum segment size.
return_type1=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 1443 of file Bimage_segment.cpp.

◆ hanning_taper()

int Bimage::hanning_taper ( double  fill = 0)

Apply Hanning taper window to the image.

Parameters
fillvalue 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 388 of file Bimage_edit.cpp.

◆ height()

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

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

Parameters
*viewslinked list of views.
thresholddensity 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.

◆ helical_cross_section()

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_risehelical subunit rise in angstrom.
helix_anglehelical subunit rotation in radians.
scalescale of cross section.
hireshigh 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.

◆ helix_interpolate()

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.

◆ helix_segment_correlation()

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
thicknesssegment thickness.
angle_startstart value for angle.
angle_endend value for angle.
angle_stepstep size for angle.
binbin image for faster searching (limited to 1,2,3).
hireshigh resolution limit in angstroms.
loreslow resolution limit in angstroms.
radiusradius 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.

◆ helix_segment_correlation_one()

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.

◆ helix_symmetrize()

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_riserise per asymmetric unit (angstrom).
helix_anglerotation angle per asymmetric unit (radians).
dyad_axisdyad axis indicator: 2=dyad axis on x-axis, otherwise none.
zminmimimum z slice to include.
zmaxmaximum z slice to include.
radiusradius to do symmetrizing over (pixels).
norm_flagif 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.

◆ histogram() [1/2]

Bplot * Bimage::histogram ( long  bins)

Calculates the histogram of an image.

Parameters
binsnumber 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 79 of file Bimage_histogram.cpp.

◆ histogram() [2/2]

vector< long > Bimage::histogram ( long  bins,
double &  scale,
double &  offset 
)

Calculates the histogram of an image.

Parameters
binsnumber of bins in the histogram.
&scalescale.
&offsetoffset.
Returns
vector<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.

◆ histogram_counts()

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

Finds the peaks in a quantized image from the histogram.

Parameters
flags1=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 207 of file Bimage_histogram.cpp.

◆ histogram_gauss_fit()

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

Fits a gaussian function to a histogram of an image.

Parameters
binsnumber of bins in the histogram.
ngaussnumber 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 590 of file Bimage_histogram.cpp.

◆ histogram_gauss_plot()

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

Fits a gaussian function to a histogram of an image.

Parameters
binsnumber of bins in the histogram.
ngaussnumber 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 702 of file Bimage_histogram.cpp.

◆ histogram_poisson_fit()

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

Fits a poisson function to a histogram of an image.

Parameters
binsnumber of bins in the histogram.
flag1=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 977 of file Bimage_histogram.cpp.

◆ histogram_thresholds()

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

Calculates minimum and maximum thresholds for truncation.

Parameters
&tminminumum threshold.
&tmaxmaxumum 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 421 of file Bimage_histogram.cpp.

◆ histomatch()

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

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

Parameters
*psecond image.
binsnumber of bins in the histograms.
Returns
int 0, <0 if error.
Both images are converted to floating point.

Definition at line 615 of file Bimage_combine.cpp.

◆ identifier() [1/2]

Bstring& Bimage::identifier ( )
inline

Definition at line 232 of file Bimage.h.

◆ identifier() [2/2]

void Bimage::identifier ( Bstring  s)
inline

Definition at line 231 of file Bimage.h.

◆ image_size()

long Bimage::image_size ( )
inline

Definition at line 290 of file Bimage.h.

◆ images() [1/2]

long Bimage::images ( )
inline

Definition at line 504 of file Bimage.h.

◆ images() [2/2]

void Bimage::images ( long  nn)

Definition at line 328 of file Bimage.cpp.

◆ images_to_slices()

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 2115 of file Bimage.cpp.

◆ impose_superpixels()

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

Impose superpixel features onto an image.

Parameters
*pmaskmask defining superpixels.
segarray of superpixels.
imposeflag 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 2045 of file Bimage_segment.cpp.

◆ index() [1/6]

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

Definition at line 405 of file Bimage.h.

◆ index() [2/6]

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

Definition at line 396 of file Bimage.h.

◆ index() [3/6]

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

Definition at line 399 of file Bimage.h.

◆ index() [4/6]

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

Definition at line 402 of file Bimage.h.

◆ index() [5/6]

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

Definition at line 408 of file Bimage.h.

◆ index() [6/6]

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

Definition at line 411 of file Bimage.h.

◆ index_wrap() [1/3]

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

Definition at line 414 of file Bimage.h.

◆ index_wrap() [2/3]

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

Definition at line 423 of file Bimage.h.

◆ index_wrap() [3/3]

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

Definition at line 426 of file Bimage.h.

◆ information()

int Bimage::information ( )

Prints out header information for an image.

Returns
int error code (<0 means failure).

Definition at line 2508 of file Bimage.cpp.

◆ integer_interpolation() [1/2]

int Bimage::integer_interpolation ( int  integer_factor)

Definition at line 16 of file Bimage_bin.cpp.

◆ integer_interpolation() [2/2]

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

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

Parameters
integer_factorinteger interpolation factor.
oddflag 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.

◆ intensities_phase_colored()

Bimage * Bimage::intensities_phase_colored ( double  scale)

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

Parameters
scaleamplitude 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 1363 of file Bimage_complex.cpp.

◆ internal_volume() [1/2]

Bimage * Bimage::internal_volume ( double  threshold)

Calculates the internal volume of a shell.

Parameters
thresholdthreshold to define density.
Returns
Bimage* internal volume mask.

Definition at line 934 of file Bimage_segment.cpp.

◆ internal_volume() [2/2]

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

Calculates the internal volume of a shell.

Parameters
thresholdthreshold to define density.
mask_out_freqmask output frequency.
Returns
Bimage* internal volume mask.

Definition at line 1004 of file Bimage_segment.cpp.

◆ interpolate() [1/5]

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

Definition at line 332 of file Bimage.h.

◆ interpolate() [2/5]

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
ccchannel.
xxx location.
yyy location.
zzz location.
nnimage number.
fillfill value if outside boundaries.
Returns
double interpolated value.
Trilinear interpolation.

Definition at line 1414 of file Bimage.cpp.

◆ interpolate() [3/5]

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

Definition at line 336 of file Bimage.h.

◆ interpolate() [4/5]

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

Definition at line 340 of file Bimage.h.

◆ interpolate() [5/5]

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

Definition at line 344 of file Bimage.h.

◆ interpolate_gaps()

int Bimage::interpolate_gaps ( long  step)

Interpolate the voxels that are not calculated.

Parameters
stepstep 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 933 of file Bimage_edit.cpp.

◆ interpolate_wrap() [1/4]

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

Definition at line 350 of file Bimage.h.

◆ interpolate_wrap() [2/4]

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
ccchannel.
xxx location.
yyy location.
zzz location.
nnimage number.
Returns
double interpolated value.
Trilinear interpolation with wrapping around periodic image boundaries.

Definition at line 1524 of file Bimage.cpp.

◆ interpolate_wrap() [3/4]

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

Definition at line 354 of file Bimage.h.

◆ interpolate_wrap() [4/4]

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

Definition at line 358 of file Bimage.h.

◆ inverse()

void Bimage::inverse ( double  minval = 0)

Calculates the inverse of the image.

Parameters
minvalthe 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 3685 of file Bimage.cpp.

◆ invert()

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 3111 of file Bimage.cpp.

◆ kernel_gaussian()

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

Generates a gaussian kernel image.

Parameters
sigmagaussian width.
maxkernel maximum.
Returns
int 0.

Definition at line 34 of file Bimage_filter.cpp.

◆ kernel_high() [1/2]

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

Definition at line 476 of file Bimage.h.

◆ kernel_high() [2/2]

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

Definition at line 486 of file Bimage.h.

◆ kernel_laplacian_of_gaussian()

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

Generates a laplacian-of-gaussian kernel.

Parameters
sigmagaussian width.
maxkernel maximum.
Returns
Bimage* kernel image.

Definition at line 77 of file Bimage_filter.cpp.

◆ kernel_low() [1/2]

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

Definition at line 470 of file Bimage.h.

◆ kernel_low() [2/2]

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

Definition at line 480 of file Bimage.h.

◆ kernel_max()

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

Finds the highest value in a kernel.

Parameters
idxindex in multi-image.
ksizekernel edge half size
Returns
long index of highest value.

Definition at line 2899 of file Bimage.cpp.

◆ kernel_max_neigbor()

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

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

Parameters
idxindex in multi-image.
ksizekernel edge half size
Returns
long index of highest value.

Definition at line 2931 of file Bimage.cpp.

◆ kernel_max_wrap()

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

Finds the highest value in a kernel with wrapping.

Parameters
idxindex in multi-image.
ksizekernel edge half size
Returns
long index of highest value.

Definition at line 2965 of file Bimage.cpp.

◆ kmeans_segment()

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

Segments an image based on K-means.

Parameters
nregionnumber of regions.
max_itermaximum number of iterations.
ratiobalance 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 1125 of file Bimage_segment.cpp.

◆ label() [1/2]

string& Bimage::label ( )
inline

Definition at line 251 of file Bimage.h.

◆ label() [2/2]

void Bimage::label ( string  s)
inline

Definition at line 250 of file Bimage.h.

◆ largest()

void Bimage::largest ( Bimage *  p)

Selects the largest of each pixel from two images.

Parameters
*pother image.

Definition at line 3709 of file Bimage.cpp.

◆ level_mask_extract()

Bimage * Bimage::level_mask_extract ( Bimage *  pmask)

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

Parameters
*pmaskmulti-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 1998 of file Bimage_mask.cpp.

◆ level_masked_stats()

int Bimage::level_masked_stats ( Bimage *  pmask)

Caclulates statistics for all the regions defined by a multi-level mask.

Parameters
*pmaskmulti-level mask map.
Returns
int 0.
The input data is replaced by the average for each region.
A linked image is created to hold the variance for each region.

Definition at line 1800 of file Bimage_mask.cpp.

◆ levelmask_add()

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

Adds a bilevel mask to a level mask.

Parameters
pmaskbilevel mask to add.
add_levelthe 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 1538 of file Bimage_mask.cpp.

◆ levelmask_asymmetric_units()

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

Calculates a multi-level mask to indicate asymmetric units.

Parameters
*symsymmetry structure.
indexasu 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.

◆ levelmask_average_region_size()

double Bimage::levelmask_average_region_size ( )

Calculates the average size of regions in a level mask.

Returns
double average feature size.

Definition at line 2022 of file Bimage_mask.cpp.

◆ levelmask_clean()

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 2061 of file Bimage_mask.cpp.

◆ levelmask_collapse()

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 1500 of file Bimage_mask.cpp.

◆ levelmask_color_by_size()

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 2131 of file Bimage_mask.cpp.

◆ levelmask_colorize()

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 2095 of file Bimage_mask.cpp.

◆ levelmask_dilate() [1/2]

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 1580 of file Bimage_mask.cpp.

◆ levelmask_dilate() [2/2]

long Bimage::levelmask_dilate ( int  times)

Dilates a level mask.

Parameters
timesnumber 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 1562 of file Bimage_mask.cpp.

◆ levelmask_region_size()

int Bimage::levelmask_region_size ( )

Convert a mask to reflect region sizes.

Returns
int 0.

Definition at line 2184 of file Bimage_mask.cpp.

◆ levelmask_select() [1/3]

long Bimage::levelmask_select ( Bimage *  pmask)

Selects regions overlapping a mask.

Parameters
pmaskoverlap 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 1727 of file Bimage_mask.cpp.

◆ levelmask_select() [2/3]

long Bimage::levelmask_select ( Bstring &  select_list,
int  flag = 0 
)

Retains the selected levels in a multi-level mask.

Parameters
&select_listcomma_separated list of levels to select.
flag0=binary mask, 1=multi-level mask.
Returns
long number of voxels retained.
The new data replaces the old data.
The result is either a binary mask (flag=0) or a multi-level mask where
the level indices changed to reflect the new range of selected levels (flag=1).
Image statistics are recalculated.

Definition at line 1650 of file Bimage_mask.cpp.

◆ levelmask_select() [3/3]

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

Retains the selected levels in a multi-level mask.

Parameters
nnimage number.
voxelvoxel with level to select.
Returns
long number of voxels retained.
The new data replaces the old data.
Image statistics are recalculated.

Definition at line 1692 of file Bimage_mask.cpp.

◆ levelmask_size_histogram()

Bplot * Bimage::levelmask_size_histogram ( )

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

Returns
Bplot* region size histogram.

Definition at line 2215 of file Bimage_mask.cpp.

◆ levelmask_switch()

long Bimage::levelmask_switch ( long  index1,
long  index2 
)

Switches two segments in a multi-level mask.

Parameters
index1first index.
index2second index.
Returns
long number of levels.
If the two indices are not found, the mask is not modified.

Definition at line 1774 of file Bimage_mask.cpp.

◆ levelmask_symmetrize()

long Bimage::levelmask_symmetrize ( Bsymmetry *  sym)

Symetrizes a multi-level mask.

Parameters
sympoint group symmetry.
Returns
long maximum level index.

Definition at line 1852 of file Bimage_mask.cpp.

◆ limit_levels()

int Bimage::limit_levels ( int  nlevels)

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

Parameters
nlevelsnumber 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.

◆ line_powerspectra()

int Bimage::line_powerspectra ( fft_plan  plan)

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

Parameters
planfft plan.
Returns
int 0.
Each line is transformed to a power spectrum in place.

Definition at line 814 of file Bimage_polar.cpp.

◆ linear_fit()

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

Linear least squares fit of two images.

Parameters
*psecond image.
*pmaskmask to limit calculation to a certain region.
max_excludemaximum 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 477 of file Bimage_combine.cpp.

◆ local_filter()

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
*pmaskmask of areas to generate.
mask_levelmask level.
*resmaplocal resolution map.
sizekernel size.
vedgeedge 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 782 of file Bimage_resolution.cpp.

◆ logarithm()

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.

◆ mask()

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

Masks an image.

Author
Samuel Payne
Parameters
*pmaskbinary mask.
fillvalue 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.

◆ mask_by_threshold()

Bimage * Bimage::mask_by_threshold ( double  threshold)

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

Author
Samuel Payne & Bernard Heymann
Parameters
thresholdgray 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.

◆ mask_by_thresholds()

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

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

Parameters
thresholdarray 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.

◆ mask_close()

long Bimage::mask_close ( int  times = 1)

Closes a binary mask.

Parameters
timesthe 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 481 of file Bimage_mask.cpp.

◆ mask_combine()

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

Combines two masks with different operations.

Parameters
*psecond mask.
operationcombining 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 255 of file Bimage_mask.cpp.

◆ mask_dilate()

long Bimage::mask_dilate ( long  times = 1)

Dilates a binary mask.

Author
Samuel Payne & Bernard Heymann
Parameters
timesthe 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 423 of file Bimage_mask.cpp.

◆ mask_dilate_erode()

long Bimage::mask_dilate_erode ( unsigned char  dir)

Dilates or erodes a binary mask.

Author
Samuel Payne & Bernard Heymann
Parameters
dir0=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 366 of file Bimage_mask.cpp.

◆ mask_erode()

long Bimage::mask_erode ( long  times = 1)

Erodes a binary mask.

Author
Samuel Payne & Bernard Heymann
Parameters
timesthe 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 443 of file Bimage_mask.cpp.

◆ mask_extract()

Bimage * Bimage::mask_extract ( Bimage *  pmask)

Zeroes everything outside the mask and return the excised feature.

Parameters
*pmaskmask.
Returns
Bimage* excised feature.
The mask must be the same size as the image.

Definition at line 293 of file Bimage_mask.cpp.

◆ mask_fill()

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

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

Parameters
voxelpoint from which to fill the mask.
Returns
long masked voxels.

Definition at line 499 of file Bimage_mask.cpp.

◆ mask_fspace_banded()

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

Generate reciprocal space mask based on a specification of bands.

Parameters
&bandarray 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 808 of file Bimage_mask.cpp.

◆ mask_fspace_resize()

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

Resizes a reciprocal space mask.

Parameters
nusizenew 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 684 of file Bimage_mask.cpp.

◆ mask_interface_matrix()

Matrix Bimage::mask_interface_matrix ( int  img_num)

Calculates the interfaces between regions.

Parameters
img_numsub-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 2298 of file Bimage_mask.cpp.

◆ mask_invert()

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 220 of file Bimage_mask.cpp.

◆ mask_merge_delete()

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

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

Parameters
min_sizeminimum size to accept regions, small ones are deleted/merged.
min_ifminimum 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 2416 of file Bimage_mask.cpp.

◆ mask_missing_cone()

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

Generates a mask with a missing cone.

Parameters
oriimage origin.
mis_angcone angle from xy plane.
resolutionhigh 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 1064 of file Bimage_mask.cpp.

◆ mask_missing_find()

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

Generates a missing mask from an example image.

Parameters
oriimage origin.
resolutionhigh resolution limit.
mis_typemissing 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 1137 of file Bimage_mask.cpp.

◆ mask_missing_pyramid()

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
oriimage origin.
tilt_axis1tilt axis angle 1.
tilt_axis2tilt axis angle 2.
tilt_neg1negative tilt angle for axis 1.
tilt_pos1positive tilt angle for axis 1.
tilt_neg2negative tilt angle for axis 2.
tilt_pos2positive tilt angle for axis 2.
resolutionhigh 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 976 of file Bimage_mask.cpp.

◆ mask_missing_wedge()

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
oriimage origin.
tilt_axistilt axis angle.
tilt_negnegative tilt angle.
tilt_pospositive tilt angle.
resolutionhigh 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 893 of file Bimage_mask.cpp.

◆ mask_open()

long Bimage::mask_open ( int  times = 1)

Opens a binary mask.

Parameters
timesthe 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 461 of file Bimage_mask.cpp.

◆ mask_pack_plane()

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

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

Parameters
mataffine orientation matrix.
hi_reshigh resolution limit.
scalescale.
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 1244 of file Bimage_mask.cpp.

◆ mask_plane()

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

Generates a mask on one side of a plane.

Parameters
originany point on plane.
normalplane normal.
Returns
long 0.
The given image is used to generate a binary mask of the same size.

Definition at line 513 of file Bimage_mask.cpp.

◆ mask_rectangle()

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

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

Parameters
lengthlength along axis (pixels).
widthwidth perpendicular to axis (pixels).
rect_angleangle from x-axis (radians).
wrapflag 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 568 of file Bimage_mask.cpp.

◆ mask_region_interfaces()

long Bimage::mask_region_interfaces ( int  reg_num)

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

Parameters
reg_numregion 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 2365 of file Bimage_mask.cpp.

◆ mask_shell()

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

Definition at line 1328 of file Bimage.h.

◆ mask_split()

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_levelnumber of voxels per level.
Returns
long number of voxels retained.
The new data replaces the old data.
Image statistics are recalculated.

Definition at line 1450 of file Bimage_mask.cpp.

◆ mask_stats()

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.

◆ mask_symmetrize()

long Bimage::mask_symmetrize ( Bsymmetry *  sym)

Symetrizes a mask.

Parameters
sympoint group symmetry.
Returns
long maximum level index.

Definition at line 620 of file Bimage_mask.cpp.

◆ mass_at_threshold()

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

Calculates the mass from the density threshold.

Parameters
img_numsub-image number (first = 0).
thresholddensity threshold.
rhoprotein density in Da/A3.
Returns
double threshold.
An image is assumed to have density represented by higher (white) values.

Definition at line 904 of file Bimage_segment.cpp.

◆ mass_threshold()

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

Finds the density threshold associated with a particular molecular weight.

Parameters
img_numsub-image number (first = 0,).
mol_weightmolecular weight.
rhoprotein 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 820 of file Bimage_segment.cpp.

◆ max_in_kernel()

int Bimage::max_in_kernel ( long  ksize)

Definition at line 308 of file Bimage_mask.cpp.

◆ maximum() [1/2]

double Bimage::maximum ( )
inline

Definition at line 542 of file Bimage.h.

◆ maximum() [2/2]

void Bimage::maximum ( double  d)
inline

Definition at line 546 of file Bimage.h.

◆ maximum_included_radius()

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 2058 of file Bimage.cpp.

◆ median_bin()

int Bimage::median_bin ( int  binning)

Bins by an integer size, selecting the kernel median.

Parameters
binninginteger bin factor.
Returns
int 0.
An image is binned by an integer size, square in 2D and cubic in 3D.

Definition at line 392 of file Bimage_bin.cpp.

◆ merge_amplitudes_and_phases() [1/2]

double Bimage::merge_amplitudes_and_phases ( Bimage *  pamp)

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

Parameters
*pampamplitude 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 1223 of file Bimage_complex.cpp.

◆ merge_amplitudes_and_phases() [2/2]

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
*prefreference Fourier transform.
res_hihigh resolution limit.
res_lolow 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 1271 of file Bimage_complex.cpp.

◆ meta_data()

JSvalue& Bimage::meta_data ( )
inline

Definition at line 234 of file Bimage.h.

◆ meta_data_retain_one_image()

void Bimage::meta_data_retain_one_image ( long  img_num)

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

Parameters
img_numsub-image number.

Definition at line 771 of file Bimage.cpp.

◆ meta_data_update()

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 678 of file Bimage.cpp.

◆ minimum() [1/2]

double Bimage::minimum ( )
inline

Definition at line 541 of file Bimage.h.

◆ minimum() [2/2]

void Bimage::minimum ( double  d)
inline

Definition at line 545 of file Bimage.h.

◆ mirror()

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

◆ moments() [1/2]

int Bimage::moments ( long  max_order)

Prints out moments for all sub-images.

Returns
int error code (<0 means failure).

Definition at line 2607 of file Bimage.cpp.

◆ moments() [2/2]

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

Prints out moments for one sub-image.

Parameters
max_ordermaximum order.
nnsub-image.
Returns
int error code (<0 means failure).

Definition at line 2624 of file Bimage.cpp.

◆ montage()

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
colscolumns in montage.
rowsrows in montage.
firstfirst slice in montage.
skipnumber of slices to skip.
flipflip 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.

◆ multiply() [1/6]

void Bimage::multiply ( Bimage *  p)

Multiplies all sub-images with the first sub-image of the other image.

Parameters
*pimage multiplier.
The other image is multiplied with the first.
Both images are converted to floating point.

Definition at line 3550 of file Bimage.cpp.

◆ multiply() [2/6]

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

Multiplies an image with another image.

Parameters
*pimage multiplier.
scaledensity scale to other image
shiftdensity shift to other image.
Requirement: The images must have the same size.

Definition at line 3505 of file Bimage.cpp.

◆ multiply() [3/6]

void Bimage::multiply ( double  v)

Multiplies an image with a constant value.

Parameters
vconstant multiplier.

Definition at line 3253 of file Bimage.cpp.

◆ multiply() [4/6]

void Bimage::multiply ( long  j,
Complex< double >  cv 
)
inline

Definition at line 325 of file Bimage.h.

◆ multiply() [5/6]

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

Multiplies a sub-image with another image.

Parameters
nnsub-image to multiply.
*pimage multiplier.
Requirement: The images must have the same size.

Definition at line 3530 of file Bimage.cpp.

◆ multiply() [6/6]

void Bimage::multiply ( long  nn,
double  v 
)

Multiplies a sub-image with a constant value.

Parameters
nnsub-image.
vconstant multiplier.

Definition at line 3274 of file Bimage.cpp.

◆ nad()

Bimage * Bimage::nad ( double  ht,
long  zw,
double  lambda,
double  C,
double  alpha 
)

Denoises a 3D density map by non-linear anisotropic diffusion.

Parameters
httime step size, 0 < ht <= 0.25.
zwslab size for piece-wise denoising.
lambdalamda parameter for EED.
Ccoherence 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.

◆ nad_2D()

Bimage * Bimage::nad_2D ( double  ht,
double  lambda,
double  C,
double  alpha 
)

Denoises a 2D image by non-linear anisotropic diffusion.

Parameters
httime step size, 0 < ht <= 0.25.
lambdalamda parameter for EED.
Ccoherence 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.

◆ noise_gaussian()

int Bimage::noise_gaussian ( double  ravg = 0,
double  rstd = 1 
)

Generates an image with a gaussian random distribution of densities.

Parameters
ravgaverage.
rstdstandard 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.

◆ noise_logistical()

int Bimage::noise_logistical ( double  ravg,
double  rstd 
)

Generates an image with a gaussian random distribution of densities.

Parameters
ravgaverage.
rstdstandard 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.

◆ noise_poisson()

int Bimage::noise_poisson ( double  ravg)

Generates an image with a poisson random distribution of densities.

Parameters
ravgaverage.
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.

◆ noise_spectral()

int Bimage::noise_spectral ( double  alpha)

Generates a noise map with a defined spectral decay.

Parameters
alphaspectral 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.

◆ noise_uniform()

int Bimage::noise_uniform ( double  rmin,
double  rmax 
)

Generates an image with a uniform random distribution of densities.

Parameters
rminminimum density value.
rmaxmaximum 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.

◆ normalize() [1/2]

int Bimage::normalize ( double  average,
double  stdev,
int  norm_type 
)

Normalizes a set of images to a desired average and standard deviation.

Parameters
averagedesired average.
stdevdesired standard deviation (if 0, use defaults).
norm_typetype 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.

◆ normalize() [2/2]

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
imgnumsub-image number.
averagedesired average.
stdevdesired standard deviation (if 0, use defaults).
norm_typetype of determining the effective average and standard deviation: 0=simple, 1=Gaussian, 2=Poisson.
binsnumber 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.

◆ normalize_local() [1/2]

int Bimage::normalize_local ( long  kernel_size)

Normalizes by subtracting local average and dividing by local standard deviation.

Parameters
kernel_sizesize 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.

◆ normalize_local() [2/2]

int Bimage::normalize_local ( Vector3< long >  kernel)

Normalizes by subtracting local average and dividing by local standard deviation.

Parameters
kernelsize 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.

◆ one_color()

int Bimage::one_color ( int  color,
double  cmin,
double  cmax,
int  flag = 0 
)

Converts a gray-scale image to a single color.

Parameters
colorcolor selection (0=red, 1=green, 2=blue).
cminlower grayscale boundary.
cmaxupper grayscale boundary.
flagsets the type of conversion.
Returns
int 0.
A grayscale image is converted to a selected color between the given minimum and maximum.
The flag parameter bit:
    bit 1       calculate a subtractive color range.
    bit 2       keep the ranges beyond the minimum and maximum as gray

Definition at line 247 of file Bimage_color.cpp.

◆ operator+()

Bimage * Bimage::operator+ ( Bimage &  p)

Adds two images together, adjusting for size difference.

Parameters
&pimage 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 3762 of file Bimage.cpp.

◆ operator=()

Bimage & Bimage::operator= ( const Bimage &  p)

Assigns an image.

The internal copy function is called.

Definition at line 911 of file Bimage.cpp.

◆ operator[]() [1/2]

double Bimage::operator[] ( long  j) const

Returns the data value at the given index.

Parameters
jindex.
Returns
double value.
The elemental data value is returned in double precision.

Definition at line 928 of file Bimage.cpp.

◆ operator[]() [2/2]

JSvalue& Bimage::operator[] ( string  tag)
inline

Definition at line 235 of file Bimage.h.

◆ orient()

Bimage * Bimage::orient ( View *  views)

Calculates multiple copies oriented according to views.

Parameters
viewsorientations for new images.
Returns
Bimage* new set of images.
Each image in a Bimage structure is rotated to the corresponding view.

Definition at line 529 of file Bimage_transform.cpp.

◆ origin() [1/6]

void Bimage::origin ( double  ox,
double  oy,
double  oz 
)
inline

Definition at line 570 of file Bimage.h.

◆ origin() [2/6]

void Bimage::origin ( long  nn,
double  ox,
double  oy,
double  oz 
)
inline

Definition at line 589 of file Bimage.h.

◆ origin() [3/6]

void Bimage::origin ( long  nn,
Vector3< double >  vec 
)
inline

Definition at line 582 of file Bimage.h.

◆ origin() [4/6]

void Bimage::origin ( long  nn,
vector< double >  ori 
)
inline

Definition at line 585 of file Bimage.h.

◆ origin() [5/6]

void Bimage::origin ( Vector3< double >  vec)
inline

Definition at line 578 of file Bimage.h.

◆ origin() [6/6]

void Bimage::origin ( vector< double >  vec)
inline

Definition at line 574 of file Bimage.h.

◆ orthogonal_slices()

Bimage * Bimage::orthogonal_slices ( long  nn,
Vector3< long >  voxel,
Vector3< long >  ext_size 
)

Extracts orthogonal views around a voxel.

Parameters
nnimage number to extract.
voxelvoxel of intersection.
ext_sizesize 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 616 of file Bimage_extract.cpp.

◆ otsu_threshold()

double Bimage::otsu_threshold ( long  bins)

Calculates the threshold on a histogram according to Otsu.

Parameters
binsnumber 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 523 of file Bimage_histogram.cpp.

◆ pack_transform() [1/2]

int Bimage::pack_transform ( int  img_select,
unsigned char *  data,
FourierType  tf 
)

Definition at line 2446 of file Bimage.cpp.

◆ pack_transform() [2/2]

int Bimage::pack_transform ( unsigned char *  data,
FourierType  tf 
)

Definition at line 2441 of file Bimage.cpp.

◆ pack_two_in_complex()

Bimage * Bimage::pack_two_in_complex ( Bimage *  p)

Packs two real images into one complex image.

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

◆ pad() [1/2]

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
sznew size.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillvalue 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 347 of file Bimage_resize.cpp.

◆ pad() [2/2]

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
sznew size.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillvalue 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 370 of file Bimage_resize.cpp.

◆ pad_copy() [1/2]

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
sznew size.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillvalue 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 388 of file Bimage_resize.cpp.

◆ pad_copy() [2/2]

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
sznew size.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillvalue 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 411 of file Bimage_resize.cpp.

◆ page_size() [1/4]

Vector3<long> Bimage::page_size ( )
inline

Definition at line 493 of file Bimage.h.

◆ page_size() [2/4]

void Bimage::page_size ( long  nx,
long  ny,
long  nz 
)
inline

Definition at line 494 of file Bimage.h.

◆ page_size() [3/4]

void Bimage::page_size ( Vector3< long >  vec)
inline

Definition at line 498 of file Bimage.h.

◆ page_size() [4/4]

void Bimage::page_size ( vector< long >  vec)
inline

Definition at line 499 of file Bimage.h.

◆ peak_sigma()

double Bimage::peak_sigma ( long  nn,
Vector3< long >  coor,
long  kernel_size 
)

Calculates a sigma value for a cross-correlation peak.

Parameters
nnsub-image.
coorcoordinates in the image.
kernel_sizekernel 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 2006 of file Bimage_correlate.cpp.

◆ percentiles()

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 344 of file Bimage_histogram.cpp.

◆ periodic_averaging()

Bimage * Bimage::periodic_averaging ( Vector3< double >  period)

Calculates an average within a periodic frame.

Parameters
periodsize of periodic frame.
Returns
Bimage* new image.

Definition at line 1144 of file Bimage_filter.cpp.

◆ phase_colour_wheel()

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 574 of file Bimage_color.cpp.

◆ phase_difference()

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
*preal space reference image.
type0=phase angle, 1=cos(phase angle), 2=scale by amplitude product
res_hiupper resolution limit.
res_lolower resolution limit.
Returns
Bimage* phase difference image.
Both images are Fourier transformed and the cosine of the phase
difference calculated.

Definition at line 1888 of file Bimage_fspace.cpp.

◆ phase_flip()

int Bimage::phase_flip ( Bimage *  pd)

Flips the phases of an image based on a phase difference map.

Parameters
*pdreciprocal space phase difference map.
Returns
int 0.

Definition at line 2074 of file Bimage_fspace.cpp.

◆ phase_shift() [1/2]

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

Phase shifts a complex sub-image.

Parameters
nnsub-image to transform.
shiftthree-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.

◆ phase_shift() [2/2]

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

Phase shifts a complex image.

Parameters
shiftthree-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.

◆ phase_shift_to_center()

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.

◆ phase_shift_to_origin()

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.

◆ place()

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
nnsub-image.
*pimage to place.
loclocation in large image of small image origin.
radiusradial mask to transfer small image.
scaledensity scale to apply to second image.
shiftdensity shift to apply to second image.
operationoperation 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 176 of file Bimage_combine.cpp.

◆ place_central_part()

int Bimage::place_central_part ( Bimage *  p,
long  nn 
)

Packs a tile into a new composite image, retaining only the central part.

Parameters
*pimage = tiles.
nntile 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 356 of file Bimage_combine.cpp.

◆ place_with_addition()

int Bimage::place_with_addition ( Bimage *  p,
long  nn 
)

Packs a tile into a new composite image with addition within overlap.

Parameters
*pimage = tiles.
nntile 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 240 of file Bimage_combine.cpp.

◆ place_with_overlap()

int Bimage::place_with_overlap ( Bimage *  p,
long  nn 
)

Packs a tile into a new composite image with weighted overlap.

Parameters
*pimage = tiles.
nntile 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 282 of file Bimage_combine.cpp.

◆ plot()

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 3839 of file Bimage.cpp.

◆ polar_power_spectrum()

Bimage * Bimage::polar_power_spectrum ( double  resolution,
long  num_angle 
)

Calculates the polar power spectrum of a 2D transform amplitude or intensity image.

Parameters
resolutionhigh resolution limit.
num_anglenumber 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 774 of file Bimage_polar.cpp.

◆ polar_transform()

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
nanglesnumber of angles in each annulus.
ann_minminimum annulus (pixels).
ann_maxmaximum annulus (pixels).
dannwidth of annulus (pixels).
zminminimum z (pixels).
zmaxmaximum z (pixels).
zincincrement 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 699 of file Bimage_polar.cpp.

◆ power()

void Bimage::power ( double  v)

Calculates the power of an image.

Parameters
vpower value.

Definition at line 3291 of file Bimage.cpp.

◆ power_spectrum()

int Bimage::power_spectrum ( int  flags = 0)

Calculates a power spectrum.

Parameters
flags1=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.

◆ powerspectrum_tiled()

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_numsub-image to transform.
tile_sizetile size (if (0,0,0) don't tile).
flags1=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.

◆ powerspectrum_tiled_and_tilted()

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_sizetile size (if (0,0,0) don't tile).
tilt_axistilt axis angle (in radians).
tilt_angletilt angle (in radians).
tilt_offsetoffset perpendicular to tilt axis (in pixels).
defocusaverage defocus to adjust for change in focus.
iCL2inverse of product of spherical aberration and wavelenght squared.
flags1=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 356 of file Bimage_powerspectrum.cpp.

◆ powerspectrum_tilt_axis()

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_numsub-image to transform.
tile_sizetile size (if (0,0,0) don't tile).
tilt_axistilt axis angle (in radians).
tilt_offsetoffset perpendicular to tilt axis (in pixels).
flags1=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.

◆ powerspectrum_tilted()

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_numsub-image to transform.
tile_sizetile size (if (0,0,0) don't tile).
tilt_axistilt axis angle (in radians).
tilt_angletilt angle (in radians).
defocusaverage defocus to adjust for change in focus.
iCL2inverse of product of spherical aberration and wavelenght squared.
flags1=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.

◆ pps_angular_correlation()

vector< 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.

◆ project() [1/3]

Bimage * Bimage::project ( char  axis,
int  flags = 1 
)

Projects a 3D image to a 2D image down one of the three major axes.

Parameters
axisaxis of projection.
flags1=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.

◆ project() [2/3]

Bimage * Bimage::project ( View *  view,
double  resolution,
FSI_Kernel *  kernel 
)

Calculates a set of projections as central sections from a 3D fourier transform.

Parameters
*viewlinked list of views.
resolutionhigh resolution limit.
*kernelfrequency 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.

◆ project() [3/3]

Bimage * Bimage::project ( View *  view,
int  norm_flag = 1 
)

Calculates a set of projections from a 3D density map.

Parameters
*viewlinked list of views.
norm_flagflag 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.

◆ pure_color()

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 352 of file Bimage_color.cpp.

◆ quadric()

int Bimage::quadric ( double *  param)

Generates a quadric surface over the whole image.

Parameters
param7-value array of parameters.
Returns
int 0.

Definition at line 821 of file Bimage_edit.cpp.

◆ quadric_correct()

int Bimage::quadric_correct ( vector< double >  param)

Corrects for a quadric surface.

Parameters
param7-value array of parameters.
Returns
int error code.

Definition at line 826 of file Bimage_rescale.cpp.

◆ quadric_fit()

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.

◆ query()

vector<JSvalue*> Bimage::query ( string &  path)
inline

Definition at line 238 of file Bimage.h.

◆ R_factor()

double Bimage::R_factor ( Bimage *  p)

Calculates an R factor between two images.

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

◆ radial() [1/3]

Bimage * Bimage::radial ( long  minrad,
long  maxrad,
double  rad_step,
Bimage *  pmask,
int  wrap = 0 
)

Calculates the radial average of an image.

Parameters
minradminimum radius in voxels.
maxradmaximum radius in voxels.
rad_stepstep size in voxels.
*pmaskmask to limit calculation.
wrapflag 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.

◆ radial() [2/3]

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
minradminimum radius in voxels.
maxradmaximum radius in voxels.
rad_stepstep size in voxels.
ellipticityratio of major and minor axes.
angleangle of major axis.
*pmaskmask to limit calculation.
wrapflag 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.

◆ radial() [3/3]

Bimage * Bimage::radial ( long  minrad,
long  maxrad,
double  rad_step = 1,
int  wrap = 0 
)

Calculates the radial average of an image.

Parameters
minradminimum radius in voxels.
maxradmaximum radius in voxels.
rad_stepstep size in voxels.
wrapflag 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.

◆ radial_coverage()

Bimage * Bimage::radial_coverage ( double  threshold,
double  rad_step = 1 
)

Calculates the coverage in each radial shell.

Parameters
thresholddensity threshold to distinguish for- and background.
rad_stepradial step size (voxels).
Returns
int 0.

Definition at line 1193 of file Bimage_polar.cpp.

◆ radial_fit()

double * Bimage::radial_fit ( Bimage *  pref)

Fits a radial profile to a reference radial profile.

Parameters
*prefreference 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 328 of file Bimage_polar.cpp.

◆ radial_sections()

Bimage * Bimage::radial_sections ( double  rad_start,
double  rad_end,
double  rad_step,
double  spherical_fraction,
Bsymmetry *  sym,
int  fill_type = FILL_USER,
double  fill = 0 
)

Calculates an image with slices giving the radial section projections.

Parameters
rad_startstarting radius (voxels).
rad_endending radius (voxels).
rad_stepradial step size (voxels).
spherical_fractionfraction of spherical section (requires symmetry).
*symsymmetry for non-spherical sections.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillvalue to fill in excluded regions.
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 1134 of file Bimage_polar.cpp.

◆ radial_shells()

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 856 of file Bimage_polar.cpp.

◆ radial_symmetry_adjusted()

Bimage * Bimage::radial_symmetry_adjusted ( double  rad_start,
double  rad_end,
double  rad_step,
double  spherical_fraction,
Bsymmetry *  sym 
)

Calculates the symmetry-adjusted radial average of an image.

Parameters
rad_startminimum radius in voxels.
rad_endmaximum radius in voxels.
rad_stepstep size in voxels.
spherical_fractionratio of major and minor axes.
*sympoint group symmetry.
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 symmetry is used to adjust the radius to follow the contours of a shell.
The origins within the sub-image structures are used.

Definition at line 209 of file Bimage_polar.cpp.

◆ radial_to_full()

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
nusizesize of image to expand to.
originorigin for radial profile.
Returns
Bimage* new 2D or 3D image.
It assumes the resultant image is square or cubic.

Definition at line 412 of file Bimage_polar.cpp.

◆ read_data()

unsigned char * Bimage::read_data ( ifstream *  fimg,
int  img_select,
int  sb,
int  vax,
long  pad 
)

Read image data in a generalized style.

Parameters
*fimgfile descriptor: file opened in calling function.
img_selectimage selection: if -1, all images, if >= 0, one image.
sbflag activates byte swapping.
vaxindicate vax style floating point - activates conversion.
padany 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 2207 of file Bimage.cpp.

◆ real_size()

Vector3<double> Bimage::real_size ( )
inline

Definition at line 500 of file Bimage.h.

◆ red_white_blue()

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_minbeginning of red gradient (most negative).
white_minend of red gradient (fade into white).
white_maxbeginning of blue gradient (start with white).
blue_maxend 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 478 of file Bimage_color.cpp.

◆ refine_peak()

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

◆ refine_peak_new()

int Bimage::refine_peak_new ( )

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

◆ region_assign()

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
*pmaska mask holding region assignments.
idxthe first voxel of a region.
region_numberthe region number that voxels are assigned.
thresholdthe level to define background.
signsign 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 119 of file Bimage_segment.cpp.

◆ region_flood()

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
*pmaskregion map (if NULL, generate from high threshold).
threshold_hithe level to pick initial regions.
threshold_lothe lowest level to include voxels in regions.
threshold_stepthe incremental change in threshold.
fill_bordersflag 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.
The image is assumed to have high values for objects (i.e., density is white).

Definition at line 256 of file Bimage_segment.cpp.

◆ region_peaks()

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_sizesize of kernel to determine peaks.
thresholdthe lowest level to include voxels in regions.
floodflag to flood to the threshold.
wrapflag 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 457 of file Bimage_segment.cpp.

◆ region_threshold_series()

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_firstthe level to pick initial regions.
threshold_lastthe lowest level to include voxels in regions.
threshold_stepthe incremental change in threshold.
Returns
int 0.

Definition at line 200 of file Bimage_segment.cpp.

◆ regions()

Bimage * Bimage::regions ( double  threshold,
int  sign 
)

Segments an image into contiguous regions.

Parameters
thresholdthe level at which things are ignored.
signsign 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 56 of file Bimage_segment.cpp.

◆ relative_density()

double Bimage::relative_density ( Bimage *  pmask)

Calculates the relative density in a region defined by a mask.

Parameters
*pmaska 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 3071 of file Bimage.cpp.

◆ replace() [1/3]

int Bimage::replace ( Bimage *  img)

Replaces the data with that from the given image.

Parameters
*imgsource image.
Returns
int 0.
The input image must be the same size as the receiving image.

Definition at line 2830 of file Bimage.cpp.

◆ replace() [2/3]

int Bimage::replace ( long  nn,
Bimage *  img,
long  nr,
double  fill 
)

Replaces one sub-image in an image structure.

Parameters
nnimage number to replace.
*imgsource image.
nrsource sub-image number.
fillfill vlue.
Returns
int 0.
The input image may have a different size as the receiving image.

Definition at line 2871 of file Bimage.cpp.

◆ replace() [3/3]

int Bimage::replace ( long  nn,
Bimage *  img,
long  nr = 0 
)

Replaces one sub-image in an image structure.

Parameters
nnimage number to replace.
*imgsource image.
nrsource sub-image number.
Returns
int 0.
The input image must be the same size as the receiving image.

Definition at line 2849 of file Bimage.cpp.

◆ replace_maxima()

long Bimage::replace_maxima ( double  threshold)

Replaces maxima above a threshold using local averages.

Parameters
thresholdthreshold.
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 678 of file Bimage_segment.cpp.

◆ replicate_asymmetric_unit()

int Bimage::replicate_asymmetric_unit ( Bsymmetry *  sym)

Calculates a full map from one asymmetric unit.

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

◆ rescale() [1/2]

int Bimage::rescale ( double  scale,
double  shift 
)

Rescales the image data with a given multiplier and offset.

Parameters
scalemultiplier.
shiftaddition 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.

◆ rescale() [2/2]

int Bimage::rescale ( long  nn,
double  scale,
double  shift 
)

Rescales the image data with a given multiplier and offset.

Parameters
nnsub-image.
scalemultiplier.
shiftaddition or offset.
Returns
int error code.
Requirement: The images must have the same size.

Definition at line 62 of file Bimage_rescale.cpp.

◆ rescale_to_avg_std() [1/3]

int Bimage::rescale_to_avg_std ( double  nuavg,
double  nustd 
)

Rescales the image data to a given average and standard deviation.

Parameters
nuavgnew average.
nustdnew 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.

◆ rescale_to_avg_std() [2/3]

int Bimage::rescale_to_avg_std ( double  nuavg,
double  nustd,
Bimage *  pmask 
)

Rescales the image data to a given average and standard deviation.

Parameters
nuavgnew average.
nustdnew standard deviation.
*pmaskstatistical 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.

◆ rescale_to_avg_std() [3/3]

int Bimage::rescale_to_avg_std ( long  nn,
double  nuavg,
double  nustd 
)

Rescales the image data to a given average and standard deviation.

Parameters
nnsub-image.
nuavgnew average.
nustdnew 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.

◆ rescale_to_min_max() [1/2]

int Bimage::rescale_to_min_max ( double  numin,
double  numax 
)

Rescales the image data to a given minimum and maximum.

Parameters
numinnew minimum.
numaxnew 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.

◆ rescale_to_min_max() [2/2]

int Bimage::rescale_to_min_max ( long  nn,
double  numin,
double  numax 
)

Rescales the image data to a given minimum and maximum.

Parameters
nnsub-image.
numinnew minimum.
numaxnew 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.

◆ resize()

int Bimage::resize ( Vector3< long >  nusize,
Vector3< long >  translate,
int  fill_type = 0,
double  fill = 0 
)

Resizes without interpolation or rescaling.

Parameters
nusizenew image size three-value vector.
translatethree-value translation vector.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER
fillvalue 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.

◆ resize_copy()

Bimage * Bimage::resize_copy ( Vector3< long >  nusize,
Vector3< long >  translate,
int  fill_type = 0,
double  fill = 0 
)

Resizes without interpolation or rescaling.

Parameters
nusizenew image size three-value vector.
translatethree-value translation vector.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER
fillvalue 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 124 of file Bimage_resize.cpp.

◆ resize_wrap()

int Bimage::resize_wrap ( Vector3< long >  nusize,
Vector3< long >  translate 
)

Resizes without interpolation or rescaling.

Parameters
nusizenew image size three-value vector.
translatethree-value translation vector.
Returns
int 0.
An image is resized with translation and filling of new regions with 
a given value.

Definition at line 202 of file Bimage_resize.cpp.

◆ resize_wrap_copy()

Bimage * Bimage::resize_wrap_copy ( Vector3< long >  nusize,
Vector3< long >  translate 
)

Resizes with wrapping without interpolation or rescaling.

Parameters
nusizenew image size three-value vector.
translatethree-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 280 of file Bimage_resize.cpp.

◆ reslice() [1/2]

void Bimage::reslice ( Bstring  order)

Switches axes of an image.

Parameters
orderstring 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 3137 of file Bimage.cpp.

◆ reslice() [2/2]

void Bimage::reslice ( const char *  order)
inline

Definition at line 717 of file Bimage.h.

◆ resolution_prepare() [1/2]

Bimage * Bimage::resolution_prepare ( Bimage *  p)

Definition at line 17 of file Bimage_resolution.cpp.

◆ resolution_prepare() [2/2]

Bimage * Bimage::resolution_prepare ( Bimage *  p,
fft_plan  plan 
)

Definition at line 46 of file Bimage_resolution.cpp.

◆ rgb()

RGB< double > Bimage::rgb ( long  j)

Returns a color value at the given index.

Parameters
jindex.
Returns
RGB<double> the color value.
The index refers to compound values.

Definition at line 1055 of file Bimage.cpp.

◆ rgb_to_cmyk()

void Bimage::rgb_to_cmyk ( )

Converts an RGB color image to CMYK.

Definition at line 176 of file Bimage_color.cpp.

◆ rgb_to_rgba()

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()

RGBA< double > Bimage::rgba ( long  j)

Returns a color value at the given index.

The index refers to compound values.
Parameters
jindex.
Returns
RGBA<double> the color value.

Definition at line 1069 of file Bimage.cpp.

◆ rgba_to_rgb()

void Bimage::rgba_to_rgb ( )

The alpha channel is delete from an RGBA color image.

Definition at line 149 of file Bimage_color.cpp.

◆ rotate() [1/13]

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 255 of file Bimage_transform.cpp.

◆ rotate() [2/13]

int Bimage::rotate ( double  angle)

Rotates an image around the z-axis by the given angle in place.

Parameters
anglerotation angle in radians.
Returns
0 error code.
The image is rotated according to the axis and angle given.

Definition at line 274 of file Bimage_transform.cpp.

◆ rotate() [3/13]

int Bimage::rotate ( Matrix3  mat)

Rotates an image using the specified matrix.

Parameters
mat3x3 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 351 of file Bimage_transform.cpp.

◆ rotate() [4/13]

int Bimage::rotate ( Vector3< double >  axis,
double  angle 
)

Rotates an image using an axis and angle in place.

Parameters
axis3-value rotation axis.
anglerotation angle in radians.
Returns
0 error code.
The image is rotated according to the axis and angle given.

Definition at line 294 of file Bimage_transform.cpp.

◆ rotate() [5/13]

int Bimage::rotate ( Vector3< double >  translate,
Matrix3  mat 
)

Rotates an image using the specified shift and matrix.

Parameters
translatetranslation after rotation.
mat3x3 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 371 of file Bimage_transform.cpp.

◆ rotate() [6/13]

int Bimage::rotate ( Vector3< double >  translate,
View  view 
)

Rotates an image to a specified view in place.

Parameters
translatetranslation after rotation.
*viewview 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 332 of file Bimage_transform.cpp.

◆ rotate() [7/13]

Bimage * Bimage::rotate ( Vector3< long >  nusize)

Rotates an image using parameters defined in the image.

Parameters
nusize3-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 389 of file Bimage_transform.cpp.

◆ rotate() [8/13]

Bimage * Bimage::rotate ( Vector3< long >  nusize,
double  angle 
)

Rotates an image around the z-axis by the given angle.

Parameters
nusize3-value new image size.
anglerotation angle in radians.
Returns
Bimage* rotated image.
The image is rotated according to the axis and angle given.

Definition at line 409 of file Bimage_transform.cpp.

◆ rotate() [9/13]

Bimage * Bimage::rotate ( Vector3< long >  nusize,
Matrix3  mat 
)

Rotates an image using the specified matrix.

Parameters
nusizenew image size.
mat3x3 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 490 of file Bimage_transform.cpp.

◆ rotate() [10/13]

Bimage * Bimage::rotate ( Vector3< long >  nusize,
Vector3< double >  axis,
double  angle 
)

Rotates an image using an axis and angle.

Parameters
nusize3-value new image size.
axis3-value rotation axis.
anglerotation angle in radians.
Returns
Bimage* rotated image.
The image is rotated according to the axis and angle given.

Definition at line 430 of file Bimage_transform.cpp.

◆ rotate() [11/13]

Bimage * Bimage::rotate ( Vector3< long >  nusize,
Vector3< double >  translate,
View  view 
)

Rotates an image to a specified view.

Parameters
nusize3-value new image size.
translatetranslation after rotation.
*viewview 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 470 of file Bimage_transform.cpp.

◆ rotate() [12/13]

Bimage * Bimage::rotate ( Vector3< long >  nusize,
View  view 
)

Rotates an image to a specified view.

Parameters
nusize3-value new image size.
*viewview 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 451 of file Bimage_transform.cpp.

◆ rotate() [13/13]

int Bimage::rotate ( View  view)

Rotates an image to a specified view in place.

Parameters
*viewview 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 314 of file Bimage_transform.cpp.

◆ rotate_and_add()

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
*pthe image to rotate and add (modified).
originorigin in input image.
*viewview 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 512 of file Bimage_transform.cpp.

◆ rotate_correlate()

double Bimage::rotate_correlate ( Vector3< double >  axis,
double  angle 
)

Rotates a copy of an image and correlates it with the original.

Parameters
axisrotation axis.
anglerotation 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.

◆ rotate_cross_correlate()

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

◆ rotate_cross_correlate_two_way()

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

◆ rotate_find_shift()

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
matrotation matrix.
hireshigh resolution limit in angstroms.
loreslow resolution limit in angstroms.
radiussearch radius.
sigmasoften search radius cutoff.
refine_flagrefine shift.
planfforward Fourier transform plan.
planbbackward Fourier transform plan.k
&cccorrelation 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 1308 of file Bimage_correlate.cpp.

◆ rotate_height()

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
mat3x3 rotation or skewing matrix.
translate3-value vector for translation after transformation.
thresholddensity 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.

◆ rotate_project()

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
mat3x3 rotation or skewing matrix.
translate3-value vector for translation after transformation.
radial_cutoffspherical cutoff to apply.
norm_flagflag 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.

◆ rotate_to_axis()

long Bimage::rotate_to_axis ( Bsymmetry *  sym,
long  axis,
long  axis_flag 
)

Rotates to a symmetry axis.

Parameters
*symsymmetry structure.
axisdesired symmetry axis order.
axis_flagview modifier.
Returns
long 0.

Definition at line 558 of file Bimage_symmetry.cpp.

◆ sampling() [1/7]

vector<Vector3<double> > Bimage::sampling ( )
inline

Definition at line 529 of file Bimage.h.

◆ sampling() [2/7]

void Bimage::sampling ( double  ux,
double  uy,
double  uz 
)
inline

Definition at line 523 of file Bimage.h.

◆ sampling() [3/7]

Vector3<double> Bimage::sampling ( long  nn)
inline

Definition at line 526 of file Bimage.h.

◆ sampling() [4/7]

void Bimage::sampling ( long  nn,
double  ux,
double  uy,
double  uz 
)
inline

Definition at line 517 of file Bimage.h.

◆ sampling() [5/7]

void Bimage::sampling ( long  nn,
Vector3< double >  u 
)
inline

Definition at line 514 of file Bimage.h.

◆ sampling() [6/7]

void Bimage::sampling ( Vector3< double >  u)
inline

Definition at line 520 of file Bimage.h.

◆ sampling() [7/7]

void Bimage::sampling ( vector< Vector3< double >>  sam)
inline

Definition at line 534 of file Bimage.h.

◆ scale_to_reference() [1/2]

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
prefreference/template image.
pmaskmask to limit correlation calculation (can be NULL).
scaleminminimum scaling to start search.
scalemaxmaximum scaling to end search.
stepscaling search step size.
Returns
Bimage* scaled image.

Definition at line 759 of file Bimage_transform.cpp.

◆ scale_to_reference() [2/2]

Bimage * Bimage::scale_to_reference ( Bimage *  pref,
Bimage *  pmask = NULL 
)

Scales and image to the given reference, searching for the correct scale.

Parameters
prefreference/template image.
pmaskmask to limit correlation calculation (can be NULL).
Returns
Bimage* scaled image.

Definition at line 817 of file Bimage_transform.cpp.

◆ scale_to_same_size()

Bimage * Bimage::scale_to_same_size ( Bimage *  pref)

Scales and image to the given reference.

Parameters
prefreference/template image.
Returns
Bimage* scaled image.

Definition at line 735 of file Bimage_transform.cpp.

◆ seamed_helix_symmetrize()

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_riserise per asymmetric unit (angstrom).
helix_anglerotation angle per asymmetric unit (radians).
seam_shifttranslation along the seam (subunit height units).
dyad_axisdyad axis indicator: 2=dyad axis on x-axis, otherwise none.
zminmimimum z slice to include.
zmaxmaximum z slice to include.
radiusradius to do symmetrizing over (pixels).
norm_flagif 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.

◆ search_views()

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
*ptempthe template to be searched for.
*viewslist of views to search.
hireshigh resolution limit.
loreslow resolution limit.
search_radiusradius for shift search.
*pmaskmask for cross-correlation (ignored if NULL).
&currviewbest current view to return.
&currshiftbest 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.

◆ search_volume()

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
*ptempthe template to be searched for.
*viewviews.
alpharotation around view vector, <0 = use 2*PI (radians).
alpha_stepangular step size around view vector (radians).
hireshigh resolution limit.
loreslow resolution limit.
*pmaskmask for cross-correlation (ignored if NULL).
thresholdthreshold 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.

◆ search_volume_view()

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
*ptempthe template to be searched for.
viewview.
hireshigh resolution limit.
loreslow resolution limit.
*pmaskmask for cross-correlation (ignored if NULL).
thresholdthreshold value, if 0, threshold = FOMmax/2.
*pfitview 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.

◆ select_images()

long Bimage::select_images ( Bstring  list)

Definition at line 2187 of file Bimage.cpp.

◆ set() [1/7]

void Bimage::set ( long  j,
CMYK< double >  color 
)

Sets a color value at the given index.

Parameters
jindex.
colorcolor value.
The index refers to compound values.

Definition at line 1206 of file Bimage.cpp.

◆ set() [2/7]

void Bimage::set ( long  j,
Complex< double >  cv 
)

Sets a complex value at the given index.

Parameters
jindex.
cvcomplex value.
The index refers to compound values.

Definition at line 1151 of file Bimage.cpp.

◆ set() [3/7]

void Bimage::set ( long  j,
double  v 
)

Sets a single value at the given index.

Parameters
jindex.
vvalue.

Definition at line 1118 of file Bimage.cpp.

◆ set() [4/7]

void Bimage::set ( long  j,
RGB< double >  color 
)

Sets a color value at the given index.

Parameters
jindex.
colorcolor value.
The index refers to compound values.

Definition at line 1167 of file Bimage.cpp.

◆ set() [5/7]

void Bimage::set ( long  j,
RGBA< double >  color 
)

Sets a color value at the given index.

Parameters
jindex.
colorcolor value.
The index refers to compound values.

Definition at line 1186 of file Bimage.cpp.

◆ set() [6/7]

void Bimage::set ( long  j,
Vector3< double >  vec 
)

Sets a 3-value vector at the given index.

Parameters
jindex.
vec3-value vector.
The index refers to compound values.

Definition at line 1226 of file Bimage.cpp.

◆ set() [7/7]

void Bimage::set ( long  j,
View  view 
)

Sets a 3-value vector at the given index.

Parameters
jindex.
view4-value view.
The index refers to compound values.

Definition at line 1244 of file Bimage.cpp.

◆ set_max()

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
xxx location.
yyy location.
zzz location.
nnimage number (4 th dimension).
vvalue to assess and set.
All neighboring voxels are checked and set to the given value if it is larger.

Definition at line 1303 of file Bimage.cpp.

◆ set_time() [1/2]

void Bimage::set_time ( time_t  t)
inline

Definition at line 264 of file Bimage.h.

◆ set_time() [2/2]

void Bimage::set_time ( tm *  t)
inline

Definition at line 265 of file Bimage.h.

◆ shape() [1/2]

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
typetype of shape: 0=rectangle, 1=oval, 2=cylinder
rectthree-value size of the area to be filled.
startthree-value start of area.
widthgaussian width of smoothing function.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillfill 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 105 of file Bimage_edit.cpp.

◆ shape() [2/2]

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
typetype of edge: 0=rectangle, 1=oval, 2=cylinder
nnsub-image.
rectthree-value size of the area to be filled.
startthree-value start of area.
widthgaussian width of smoothing function.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillfill 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 139 of file Bimage_edit.cpp.

◆ shell() [1/2]

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
nnsub-image.
centercenter of shell.
minradminimum radius of shell.
maxradmaximum radius of shell.
widthgaussian width of smoothing function.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillfill 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 574 of file Bimage_edit.cpp.

◆ shell() [2/2]

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
centercenter of shell.
minradminimum radius of shell.
maxradmaximum radius of shell.
widthgaussian width of smoothing function.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillfill 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 546 of file Bimage_edit.cpp.

◆ shell_wrap()

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
nnsub-image.
centercenter of shell.
minradminimum radius of shell.
maxradmaximum radius of shell.
widthgaussian width of smoothing function.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillfill 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 656 of file Bimage_edit.cpp.

◆ shift() [1/2]

int Bimage::shift ( long  nn,
Vector3< double >  vec,
int  fill_type = 0,
double  fill = 0 
)

Shifts one sub-image.

Parameters
nnsub-image.
vec3-value real space shift vector.
fill_typefill type for filling empty regions.
fillvalue to fill in empty regions.
Returns
int error code.

Definition at line 605 of file Bimage_transform.cpp.

◆ shift() [2/2]

int Bimage::shift ( Vector3< double >  vec,
int  fill_type = 0,
double  fill = 0 
)

Shifts an image.

Parameters
vec3-value real space shift vector.
fill_typefill type for filling empty regions.
fillvalue to fill in empty regions.
Returns
int error code.

Definition at line 589 of file Bimage_transform.cpp.

◆ shift_background()

int Bimage::shift_background ( double  bkg)

Sets the background for each sub-image to a given value.

Parameters
bkgnew 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.

◆ shift_wrap() [1/2]

int Bimage::shift_wrap ( long  nn,
Vector3< double >  vec 
)

Shifts one sub-image with wrapping.

Parameters
nnsub-image.
vec3-value real space shift vector.
Returns
int error code.

Definition at line 655 of file Bimage_transform.cpp.

◆ shift_wrap() [2/2]

int Bimage::shift_wrap ( Vector3< double >  vec)

Shifts an image.

Parameters
vec3-value real space shift vector.
Returns
int error code.

Definition at line 641 of file Bimage_transform.cpp.

◆ show_image() [1/2]

long Bimage::show_image ( )
inline

Definition at line 559 of file Bimage.h.

◆ show_image() [2/2]

void Bimage::show_image ( long  nn)
inline

Definition at line 560 of file Bimage.h.

◆ show_maximum() [1/2]

double Bimage::show_maximum ( )
inline

Definition at line 566 of file Bimage.h.

◆ show_maximum() [2/2]

void Bimage::show_maximum ( double  v)
inline

Definition at line 568 of file Bimage.h.

◆ show_minimum() [1/2]

double Bimage::show_minimum ( )
inline

Definition at line 565 of file Bimage.h.

◆ show_minimum() [2/2]

void Bimage::show_minimum ( double  v)
inline

Definition at line 567 of file Bimage.h.

◆ show_scale() [1/2]

double Bimage::show_scale ( )
inline

Definition at line 563 of file Bimage.h.

◆ show_scale() [2/2]

void Bimage::show_scale ( double  scale)
inline

Definition at line 564 of file Bimage.h.

◆ show_slice() [1/2]

long Bimage::show_slice ( )
inline

Definition at line 561 of file Bimage.h.

◆ show_slice() [2/2]

void Bimage::show_slice ( long  nz)
inline

Definition at line 562 of file Bimage.h.

◆ shrink_wrap()

int Bimage::shrink_wrap ( Vector3< long >  nusize,
Vector3< long >  translate 
)

Shrinks an image to a new size with wrapping of the excluded edges.

Parameters
nusizenew image size three-value vector.
translatethree-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 432 of file Bimage_resize.cpp.

◆ simple_to_complex()

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.

◆ simple_to_rgb()

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.

◆ simple_to_rgba()

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.

◆ size() [1/4]

Vector3<long> Bimage::size ( ) const
inline

Definition at line 386 of file Bimage.h.

◆ size() [2/4]

void Bimage::size ( long  nx,
long  ny,
long  nz 
)
inline

Definition at line 387 of file Bimage.h.

◆ size() [3/4]

void Bimage::size ( Vector3< long >  vec)
inline

Definition at line 388 of file Bimage.h.

◆ size() [4/4]

void Bimage::size ( vector< long >  vec)
inline

Definition at line 389 of file Bimage.h.

◆ sizeX() [1/2]

long Bimage::sizeX ( ) const
inline

Definition at line 393 of file Bimage.h.

◆ sizeX() [2/2]

void Bimage::sizeX ( long  nx)
inline

Definition at line 390 of file Bimage.h.

◆ sizeY() [1/2]

long Bimage::sizeY ( ) const
inline

Definition at line 394 of file Bimage.h.

◆ sizeY() [2/2]

void Bimage::sizeY ( long  ny)
inline

Definition at line 391 of file Bimage.h.

◆ sizeZ() [1/2]

long Bimage::sizeZ ( ) const
inline

Definition at line 395 of file Bimage.h.

◆ sizeZ() [2/2]

void Bimage::sizeZ ( long  nz)
inline

Definition at line 392 of file Bimage.h.

◆ slices_to_images()

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 2074 of file Bimage.cpp.

◆ smallest()

void Bimage::smallest ( Bimage *  p)

Selects the smallest of each pixel from two images.

Parameters
*pother image.

Definition at line 3733 of file Bimage.cpp.

◆ snvariance()

double Bimage::snvariance ( double  snradius)

Calculates the ratio of variance inside and outside a given radius.

Parameters
snradiusradius 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.

◆ space_group() [1/2]

long Bimage::space_group ( )
inline

Definition at line 598 of file Bimage.h.

◆ space_group() [2/2]

void Bimage::space_group ( unsigned int  grp)
inline

Definition at line 602 of file Bimage.h.

◆ sphere()

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
centerthree vector center of sphere.
radiussphere radius.
widthgaussian width of smoothing function.
fill_typeFILL_AVERAGE, FILL_BACKGROUND, FILL_USER.
fillfill 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 440 of file Bimage_edit.cpp.

◆ split_channels()

void Bimage::split_channels ( )

The channels are split into individual images.

The input image is replaced with a new image.

Definition at line 1946 of file Bimage.cpp.

◆ square()

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.

◆ square_root()

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.

◆ standard_deviation() [1/2]

double Bimage::standard_deviation ( )
inline

Definition at line 544 of file Bimage.h.

◆ standard_deviation() [2/2]

void Bimage::standard_deviation ( double  d)
inline

Definition at line 548 of file Bimage.h.

◆ statistics() [1/3]

long Bimage::statistics ( )

Calculates the statistics for an image.

Returns
long number of errors.

Definition at line 22 of file Bimage_stats.cpp.

◆ statistics() [2/3]

long Bimage::statistics ( Bimage *  pmask,
double &  regavg,
double &  regstd 
)

Calculates the statistics for a region in an image.

Parameters
*pmaskregion.
&regavgregion average to be calculated.
&regstdregion standard deviation to be calculated.
Returns
long number of voxels.

Definition at line 167 of file Bimage_stats.cpp.

◆ statistics() [3/3]

long Bimage::statistics ( long  img_num)

Calculates the statistics for a sub-image.

Parameters
img_numsub-image number.
Returns
long number of errors.

Definition at line 101 of file Bimage_stats.cpp.

◆ stats_in_mask()

long Bimage::stats_in_mask ( long  nn,
Bimage *  pmask 
)

Calculates the statistics for an image for each level in a mask.

Parameters
nnsub-image number.
*pmaskmask with two or more levels
Returns
long number of levels (0 means failure).

Definition at line 490 of file Bimage_stats.cpp.

◆ stats_in_poly()

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
nnsub-image number.
nvertnumber of polygon vertices.
*polyarray of polygon vertices.
&vavgreturn value for the average.
&vstdreturn 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 419 of file Bimage_stats.cpp.

◆ stats_in_shape()

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
nnsub-image number.
typetype of selection: 1=rectangle, 2=ellipse.
startstarting coordinates.
endending coordinates.
&vavgreturn value for the average.
&vstdreturn 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 282 of file Bimage_stats.cpp.

◆ stats_within_radii()

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
nnsub-image number.
loccenter of shell.
rad_minminimum radius (pixel units).
rad_maxmaximum radius (pixel units).
&vavgreturn value for the average.
&vstdreturn 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 205 of file Bimage_stats.cpp.

◆ subimage_information()

int Bimage::subimage_information ( )

Prints out header information for all sub-images.

Returns
int error code (<0 means failure).

Definition at line 2571 of file Bimage.cpp.

◆ subtract()

void Bimage::subtract ( Bimage *  p)

Subtracts another image from an image.

Parameters
*pimage to be added.
Requirement: The images must have the same size.

Definition at line 3406 of file Bimage.cpp.

◆ subtract_background()

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.

◆ sum()

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

Sums an array of images with their FOM blocks.

Parameters
mnumber of images in the array.
**parray of images.
The images must all have the same dimensions.

Definition at line 23 of file Bimage_combine.cpp.

◆ sum_images()

void Bimage::sum_images ( )

Adds all sub-images.

Definition at line 3306 of file Bimage.cpp.

◆ superpixels() [1/2]

vector< Bsuperpixel > Bimage::superpixels ( long  step,
double  colorweight = 0.2,
long  iterations = 10,
double  stop = 1 
)

Segment the image into superpixels.

Parameters
stepinitial superpixel intervals.
colorweightweight of color differences compared to spatial distances.
iterationsmaximum number of iterations.
stopstopping 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 1872 of file Bimage_segment.cpp.

◆ superpixels() [2/2]

vector< Bsuperpixel > Bimage::superpixels ( long  step,
double  colorweight = 0.2,
long  iterations = 10,
long  bin_levels = 1,
double  stop = 1 
)

Definition at line 1939 of file Bimage_segment.cpp.

◆ superpixels_from_mask()

vector< Bsuperpixel > Bimage::superpixels_from_mask ( long  cc,
long  step 
)

Create superpixels from a multilevel mask.

Parameters
ccnumber of channels in the original image.
stepdistance limit to determine neigbors.
Returns
vector<Bsuperpixel> array of superpixels.

Definition at line 1821 of file Bimage_segment.cpp.

◆ superpixels_update()

int Bimage::superpixels_update ( Bimage *  pmask,
vector< long >  vstep,
double  colorweight,
vector< Bsuperpixel > &  seg 
)

Definition at line 1609 of file Bimage_segment.cpp.

◆ surface_to_topograph()

Bimage * Bimage::surface_to_topograph ( double  threshold,
int  dir = 0 
)

Converts a 3D image to a 2D height image.

Parameters
thresholdthreshold to define the surface (assuming positive density).
dirdirection: 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.

◆ symmetrize() [1/4]

double Bimage::symmetrize ( Bstring &  symmetry_string,
int  flag 
)
inline

Definition at line 1188 of file Bimage.h.

◆ symmetrize() [2/4]

double Bimage::symmetrize ( Bstring &  symmetry_string,
View  ref_view,
int  flag 
)
inline

Definition at line 1196 of file Bimage.h.

◆ symmetrize() [3/4]

double Bimage::symmetrize ( Bsymmetry *  sym,
int  flag 
)
inline

Definition at line 1192 of file Bimage.h.

◆ symmetrize() [4/4]

double Bimage::symmetrize ( Bsymmetry *  sym,
View  ref_view,
int  flag 
)

Applies point group symmetry to an image.

Parameters
*sympoint group.
ref_viewreference view vector and rotation angle.
flagflag 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.

◆ symmetrize_cylinder() [1/2]

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.

◆ symmetrize_cylinder() [2/2]

Bimage * Bimage::symmetrize_cylinder ( int  flag)

Calculates a cylindrically symmetrized map.

Parameters
flag0:
Returns
Bimage* 2D image with the cylindrical average.
A 2D cylindrically symmetrized average is calculated.

Definition at line 524 of file Bimage_helix.cpp.

◆ symmetry() [1/2]

string& Bimage::symmetry ( )
inline

Definition at line 603 of file Bimage.h.

◆ symmetry() [2/2]

void Bimage::symmetry ( string  grp)
inline

Definition at line 607 of file Bimage.h.

◆ symmetry_equivalent()

Matrix3 Bimage::symmetry_equivalent ( Bimage *  pref,
Bimage *  pmask,
Bsymmetry *  sym 
)

Finds the symmetry equivalent orientation of a particle with respect to a template.

Parameters
*preftemplate to test against (same size as input image).
*pmaskmask to limit correlation calculation.
*symsymmetry 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.

◆ symmetry_equivalent_cyclic()

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
*preftemplate to test against (same size as input image).
*pmaskmask to limit correlation calculation.
*symsymmetry 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.

◆ thickness()

Bimage * Bimage::thickness ( double  reference,
double  lambda 
)

Calculates a thickness based on intensities with respect to a reference.

Parameters
referencereference intensity.
lambdaproportionaility coefficient.
Returns
vector<double> 7-value array of parameters.
The thickness for each pixel is:
    t = lambda * ln(Iref/Ipix)
If Ipix <= 0, t = 0

Definition at line 920 of file Bimage_rescale.cpp.

◆ tile_coordinates()

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
&start3-vector start for first tile to be extracted.
&region3-vector size of part of image to be extracted (0 = whole image).
&tile_size3-vector size of extracted image.
&step_size3-vector size of intervals between tiles.
exceedflag 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 259 of file Bimage_extract.cpp.

◆ tile_mask()

Bimage * Bimage::tile_mask ( long  step)

Converts a mask to a tiled multilevel mask.

Parameters
stepisotropic tile edge size.
Returns
Bimage* new mask.
The old data is unmodified.

Definition at line 1412 of file Bimage_mask.cpp.

◆ to_mask() [1/2]

long Bimage::to_mask ( )
inline

Definition at line 1313 of file Bimage.h.

◆ to_mask() [2/2]

long Bimage::to_mask ( double  threshold)

Change the image to a mask.

Parameters
thresholdset mask above this value.
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.

◆ topograph_to_surface()

Bimage * Bimage::topograph_to_surface ( Bimage *  psd,
long  nz,
double  density,
double  resolution 
)

Converts a 2D AFM image to a 3D density map.

Parameters
*psd2D standard deviation image.
nzz dimension of the new 3D map.
densitydensity inside the surface (Da/A3).
resolutionsigma 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.

◆ transform() [1/3]

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
nnsub-image to process.
nusize3-value new image size.
scale3-value scale factor vector to apply.
origin3-value origin for rotation and skewing.
translate3-value vector for translation after transformation.
mat3x3 rotation or skewing matrix.
fill_typefill type for filling empty regions.
fillvalue 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 138 of file Bimage_transform.cpp.

◆ transform() [2/3]

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
scale3-value scale factor vector to apply.
origin3-value origin for rotation and skewing.
translate3-value vector for translation after transformation.
mat3x3 rotation or skewing matrix.
fill_typefill type for filling empty regions.
fillvalue 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.

◆ transform() [3/3]

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
nusize3-value new image size.
scale3-value scale factor vector to apply.
origin3-value origin for rotation and skewing.
translate3-value vector for translation after transformation.
mat3x3 rotation or skewing matrix.
fill_typefill type for filling empty regions.
fillvalue 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.

◆ transform_lines()

int Bimage::transform_lines ( )

Definition at line 1300 of file Bimage_helix.cpp.

◆ transform_voxel()

void Bimage::transform_voxel ( long  i,
Bimage *  pt,
long  nn,
Vector3< double >  oldorigin,
Vector3< double >  nuorigin,
Matrix3  affmat,
double  fill 
)

Definition at line 104 of file Bimage_transform.cpp.

◆ truncate()

int Bimage::truncate ( double  minim,
double  maxim,
double  setmin,
double  setmax 
)

Truncates image data to a given minimum and maximum.

Parameters
minimminimum.
maximmaximum.
setminvalue to set voxels smaller than minimum.
setmaxvalue 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.

◆ truncate_to_avg()

int Bimage::truncate_to_avg ( double  minim,
double  maxim 
)

Sets voxels in image data exceeding a given minimum and maximum to the average.

Parameters
minimminimum.
maximmaximum.
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.

◆ truncate_to_background()

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
minimminimum.
maximmaximum.
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.

◆ truncate_to_min_max()

int Bimage::truncate_to_min_max ( double  minim,
double  maxim 
)

Truncates image data to a given minimum and maximum.

Parameters
minimminimum.
maximmaximum.
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.

◆ tube_interpolate()

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.

◆ tube_symmetrize()

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
hunits along u vector.
kunits along v vector.
latconstlattice constant (angstrom).
zminmimimum z slice to include.
zmaxmaximum z slice to include.
radiusradius to do symmetrizing over (pixels).
norm_flagif 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.

◆ unit_cell() [1/2]

UnitCell Bimage::unit_cell ( )
inline

Definition at line 615 of file Bimage.h.

◆ unit_cell() [2/2]

void Bimage::unit_cell ( UnitCell  uc)
inline

Definition at line 608 of file Bimage.h.

◆ unpack_combined_transform()

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.

◆ unpack_transform() [1/2]

int Bimage::unpack_transform ( int  img_select,
unsigned char *  data,
FourierType  tf 
)

Definition at line 2361 of file Bimage.cpp.

◆ unpack_transform() [2/2]

int Bimage::unpack_transform ( unsigned char *  data,
FourierType  tf 
)

Definition at line 2356 of file Bimage.cpp.

◆ update_from_meta_data()

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 725 of file Bimage.cpp.

◆ values() [1/3]

vector<double> Bimage::values ( long  i)
inline

Definition at line 297 of file Bimage.h.

◆ values() [2/3]

void Bimage::values ( long  i,
vector< double >  val 
)
inline

Definition at line 303 of file Bimage.h.

◆ values() [3/3]

vector< double > Bimage::values ( long  nn,
Vector3< double >  vox 
)

Returns an array with all channel data at the given coordinates.

Parameters
nnimage index.
voxvoxel coordinates.
Returns
vector<double> value array.
The values of all channels are returned in double precision.

Definition at line 1003 of file Bimage.cpp.

◆ variance() [1/3]

int Bimage::variance ( Bimage *  pweight)

Calculates the local variance weighed with the given image.

Parameters
pweightweight 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 755 of file Bimage_stats.cpp.

◆ variance() [2/3]

int Bimage::variance ( long  kernel_size,
int  flag = 0 
)

Calculates the local variance within the given kernel.

Parameters
kernel_sizesize of kernel edge.
flagselects type of output.
Returns
int 0.
The local variance within a kernel is calculated.
The calculation is threaded if compiled with GCD or OpenMP.
Flag values:
0   variance
1   standard deviation
2   poisson excess variance

Definition at line 625 of file Bimage_stats.cpp.

◆ variance() [3/3]

int Bimage::variance ( Vector3< long >  kernel_size,
int  flag = 0 
)

Calculates the local variance within the given kernel.

Parameters
kernel_size3-value size of kernel edge.
flagselects type of output.
Returns
int 0.
The local variance within a kernel is calculated.
The calculation is threaded if compiled with GCD or OpenMP.
Flag values:
0   variance
1   standard deviation
2   poisson excess variance

Definition at line 653 of file Bimage_stats.cpp.

◆ variance_mask()

Bimage * Bimage::variance_mask ( long  kernel_size,
double  lowvar = 1e-6,
int  bkg_flag = 0 
)

Calculates a mask based on local variance.

Parameters
kernel_sizesize of kernel edge.
lowvarlow variance threshold.
bkg_flagflag 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 1364 of file Bimage_mask.cpp.

◆ variance_threshold()

double Bimage::variance_threshold ( double  lowvar)

Calculates a threshold for a local variance image.

Parameters
lowvarlow 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 1305 of file Bimage_mask.cpp.

◆ vector3()

Vector3< double > Bimage::vector3 ( long  j)

Returns a 3-value vector at the given index.

Parameters
jindex.
Returns
Vector3<double> the 3-value vector.
The index refers to compound values.

Definition at line 1041 of file Bimage.cpp.

◆ view() [1/2]

void Bimage::view ( double  vx,
double  vy,
double  vz,
double  va 
)
inline

Definition at line 596 of file Bimage.h.

◆ view() [2/2]

void Bimage::view ( View  vw)
inline

Definition at line 597 of file Bimage.h.

◆ voxel_size()

double Bimage::voxel_size ( )
inline

Definition at line 506 of file Bimage.h.

◆ within_boundaries() [1/2]

bool Bimage::within_boundaries ( long  xx,
long  yy,
long  zz 
)
inline

Definition at line 466 of file Bimage.h.

◆ within_boundaries() [2/2]

bool Bimage::within_boundaries ( Vector3< double >  loc)
inline

Definition at line 461 of file Bimage.h.

◆ write()

int Bimage::write ( Bstring &  fn)

Definition at line 2339 of file Bimage.cpp.

◆ zero_fourier_origin()

void Bimage::zero_fourier_origin ( )

Zeroes the first voxel in each image.

Definition at line 2033 of file Bimage.cpp.

◆ zero_origin()

int Bimage::zero_origin ( )

Shifts the origins to zero with wrapping.

Returns
int error code.

Definition at line 722 of file Bimage_transform.cpp.

Member Data Documentation

◆ image

Bsub_image* Bimage::image

Definition at line 202 of file Bimage.h.

◆ next

Bimage* Bimage::next

Definition at line 179 of file Bimage.h.


The documentation for this class was generated from the following files: