![]() |
Bsoft 2.1.4
Bernard's software package
|
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... | |
CompoundType | guess_compoundtype (long nc) |
bool | check_compoundtype (long nc, CompoundType ct) |
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... | |
void | set_hi_lo_resolution (double &hi, double &lo) |
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 () |
Bimage * | find (Bstring fn) |
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 (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 () |
long | 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... | |
Bimage * | split_channels () |
Splits the channels into individual sub-images. More... | |
Bimage * | split_channels_to_images () |
Splits the channels into individual images in a linked list. More... | |
void | combine_channels (long nc, CompoundType ct=TSimple) |
Combines images as channels. 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) |
Vector3< double > | real_coordinates (long i) |
template<typename T > | |
bool | within_boundaries (Vector3< T > 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_min (long idx, long ksize) |
Finds the highest value in a kernel. More... | |
long | kernel_max (long idx, long ksize) |
Finds the highest value in a kernel. More... | |
double | kernel_average (long idx, long ksize, double tmin, double tmax) |
Calculates the average value in a kernel. More... | |
double | kernel_sum (long idx, long ksize) |
Calculates the sum in a kernel. More... | |
double | kernel_neighbor_average (long idx, long ksize) |
Finds the average of neigbor values 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... | |
multimap< double, long > | kernel_order (long idx, long ksize) |
Orders the values in a kernel. More... | |
multimap< double, long > | kernel_order_neighbors (long idx, long ksize) |
Orders the neigbor values in a kernel. 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 () |
double | variance () |
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_check () |
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... | |
int | channels_to_images () |
int | images_to_channels (long nc, CompoundType ct) |
long | set_subset_selection (Bstring list) |
Sets the sub-image selections based on a list. 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 ®avg, double ®std) |
Calculates the statistics for a region in an image. More... | |
double | poisson_statistics_check () |
Checks whether the statistics conform to a Poisson distribution. More... | |
vector< double > | stats_within_radii (long nn, Vector3< double > loc, double rad_min, double rad_max) |
Calculates the statistics for an image within given radii from a location. More... | |
vector< double > | stats_in_shape (long nn, int type, Vector3< long > start, Vector3< long > end) |
Calculates the statistics for an image within the given box. More... | |
vector< double > | stats_in_poly (long nn, int nvert, Vector3< double > *poly) |
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 > ®ion, Vector3< long > &tile_size, Vector3< long > &step_size, int exceed) |
Generates a set of tile coordinates for an image. More... | |
vector< Vector3< long > > | tile_coordinates (Vector3< long > tile_size, Vector3< long > &step_size) |
Generates a set of tile coordinates to fit in the image dimensions. 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_tile_stack (Vector3< long > coords, Vector3< long > tile_size, int fill_type=0, double fill=0) |
Extracts a stack of tiles at a specified position from an image into a new image. More... | |
Bimage ** | extract_tile_stacks (vector< Vector3< long > > &coords, Vector3< long > tile_size) |
Extracts stacks of tiles at a specified positions from an image into an array of new images. 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... | |
Bimage * | orthogonal_montage (Vector3< long > voxel, Vector3< long > ext_size, int pad=0, int fill_type=0, double fill=0) |
Extracts orthogonal views around a voxel and create a montage. 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 | absolute () |
Converts to absolute values. More... | |
void | add (double v) |
Adds a constant value to an image. More... | |
void | phase_add (double v) |
Adds a constant value to a phase image and wraps as necssary. 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 | sine () |
Calculates the sine of a phase image. More... | |
void | arcsine () |
Calculates the arcsine of an image. More... | |
void | cosine () |
Calculates the cosine of a phase image. More... | |
void | arccosine () |
Calculates the arccosine of an image. More... | |
void | tangent () |
Calculates the tangent of a phase image. More... | |
void | arctangent () |
Calculates the arctangent 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... | |
Bimage * | moving_sum (long window, long step=1, int flag=0) |
Calculates a moving sum of the sub-images. More... | |
void | progressive_sum () |
Progressive sum of the sub-images. 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... | |
void | arctangent (Bimage *p) |
Calculates the inverse tangent 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 | vector_to_simple () |
A vector image is converted to a simple image. 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 | replace_half (Bimage *p) |
Replaces values for >x/2 with the given image. 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) |
Bimage * | gradient () |
Calculates the central difference gradient image. More... | |
Bimage * | gradient3x3 () |
Calculates the difference gradient image in a 3x3 kernel. More... | |
int | filter_gaussian (long kernel_size, double sigma=0) |
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 * | aniso_average (long ksize, double w) |
Calculates an anisotropic average within a kernel based on the local gradient. More... | |
int | filter_by_difference (Bimage *p) |
Calculates an anisotropic average within a kernel based on the local gradient. 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 | two_to_complex () |
Two sub-images converted to a complex image. More... | |
void | multi_channel_to_complex () |
A multi-channel image is converted to a set of complex images. More... | |
Bimage * | complex_split () |
A complex image is split into two simple images. More... | |
void | phase_to_complex () |
A phase 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 | complex_invert () |
Inverts a complex image. More... | |
int | complex_convert (ComplexConversion conv) |
Converts a complex image to a simple 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, int norm=0) |
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, Bimage *pmask=NULL) |
Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images. More... | |
int | combined_phase_product (double hires, double lores, Bimage *pmask=NULL) |
Calculates the phase 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 (fft_direction dir, int norm_flag, ComplexConversion conv) |
Fast Fourier transforms an image with a specified conversion. More... | |
int | fft (fft_direction dir, int norm_flag) |
Fast Fourier transforms an image. More... | |
int | fft (fft_plan plan, int norm_flag=1) |
Fast Fourier transforms an image. More... | |
int | fft () |
int | fft_back () |
int | fft_back (fft_plan plan, int norm_flag=1) |
int | fft (fft_direction dir, Vector3< long > tile_size, int norm_flag=1) |
Tiled Fourier transform. More... | |
int | fftz (fft_direction dir, int norm_flag=1) |
Fourier transform only of the z columns. More... | |
int | fftz () |
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_tiled_exact (long img_num, Vector3< long > tile_size, int flags=0) |
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... | |
vector< double > | powerspectrum_isotropy (long n, double &lores, double &hires) |
Calculates a measure of anisotropy in a power spectrum. More... | |
double | average_line (long xx, long yy, long zz, long nn, long len, int dir) |
long | fix_power_spectrum (int dir, double ratio) |
Removes high-intensity artifacts on the zero-frequency lines in a power spectrum. 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 ewald_wavelength=0, 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 ewald_wavelength=0, 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... | |
int | fspace_frequency_filter (double freq, double sigma) |
Applies a frequency filter to an image. More... | |
int | fspace_frequency_filter (double freq, double sigma, fft_plan planf, fft_plan planb) |
Applies a frequency filter to an image. More... | |
int | fspace_gabor_filter (Vector3< double > freq, double fsigma, double psigma) |
Applies a Gabor filter to an image. More... | |
int | fspace_gabor_filter (Vector3< double > freq, double fsigma, double psigma, fft_plan planf, fft_plan planb) |
Applies a Gabor 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... | |
vector< double > | fspace_radial (long nn, long maxrad, int flag=0) |
Calculates the radial power spectrum from a Fourier transform. More... | |
int | fspace_weigh (vector< double > &curve, int flag=0) |
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_butterworth_band (double res_hi, double res_lo, int order=16) |
Calculates a Butterworth band-pass filter profile. 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_gaussian (long nn, Vector3< double > sigma, int dir=0) |
Weighs an image's amplitudes with an anisotropic Gaussian function. More... | |
Bimage * | fspace_gradient (Vector3< double > sigma) |
Generates a image with orthogonal gradients encoded in 3-value vectors. 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... | |
double | friedel_difference () |
Calculates the difference between Friedel pairs. 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, double wavelength=0) |
Calculates a central section of a 3D fourier transform. More... | |
Bimage * | project (View *view, double resolution, FSI_Kernel *kernel, double wavelength=0, bool back=1, ComplexConversion conv=NoConversion) |
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) |
int | opposite_ewald () |
int | combine_ewald () |
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, vector< double > &fsccut) |
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... | |
int | ewald_sphere (double volt, double t) |
Imposes an Ewald sphere weighting on a 3D frequency space volume. 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... | |
Bimage * | phase_correlate (Bimage *p, double hires, double lores, Bimage *pmask=NULL) |
Calculates a phase 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... | |
int | refine_peak (long kernel_size) |
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... | |
Bimage * | align_local (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... | |
vector< Vector3< double > > | align (long ref_num, long window, long step, Bimage *pmask, double hi_res, double lo_res, double shift_limit, double edge_width, double gauss_width, Vector3< long > bin, int mode=0) |
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... | |
Bimage * | fspace_sum (int shift=0) |
Bimage * | fspace_shift_sum () |
Bimage * | fspace_subset_sums (int subset, int flag=0) |
Bplot * | fspace_ssnr (long nimg, double res_hi, double sampling_ratio) |
Bplot * | fspace_subset_ssnr (int subset, double res_hi, double sampling_ratio, int flag=0) |
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... | |
void | exponential () |
Calculates the exponential 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 emfp) |
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_minmax (double &tmin, double &tmax) |
Calculates minimum and maximum thresholds for truncation. More... | |
Bplot * | histogram_otsu_variance (long bins) |
Calculates the inter-set variance of the bisection of a historgram using the method of Otsu. More... | |
double | otsu_threshold (long bins) |
Calculates the threshold from a histogram according to Otsu. More... | |
vector< double > | otsu_variance (vector< long > h) |
Calculates the inter-set variance of the bisection of a historgram using the method of Otsu. More... | |
vector< double > | histogram_multi_thresholds (long bins, long number) |
Calculates multiple thresholds from a histogram. More... | |
vector< double > | histogram_gauss_fit (long bins, long ngauss=1) |
Fits a gaussian function to a histogram of an image. More... | |
vector< double > | histogram_gauss_fit2 (long bins, long ngauss=1) |
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, bool wrap=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, bool wrap=0) |
Creates a shape in an image and fills it with a constant value. More... | |
int | line (Vector3< double > start, Vector3< double > end, double width, int fill_type=0, double fill=0) |
Creates a line 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... | |
Bimage * | extract_edge_difference () |
Extracts all the edge pixels into a new image. 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, bool wrap=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, bool wrap=0) |
Fills a cylinder within an image with a uniform value. More... | |
int | gaussian_sphere (long nn, Vector3< double > center, double sigma, double amp, bool wrap=0) |
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 (Vector3< double > center, double minrad, double maxrad, double width, int fill_type, double fill) |
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 | chirp (double freq_scale, double freq_shift=0) |
Generates a chirp 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... | |
Vector3< long > | reciprocal_half () |
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_cyclic (int cyclic, 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... | |
Vector3< double > | test_helix_parameters (double angle, double hires, double lores, Vector3< long > mask_size, Vector3< long > mask_start, long max_iter, fft_plan planf, fft_plan planb, double &cc) |
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... | |
double | test_helix_parameters (double rise, double angle, Vector3< long > mask_size, Vector3< long > mask_start) |
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 * | filament_from_projections (double hi_res, int flag=0) |
Reconstructs a filament from a set of projections. 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... | |
int | noise_uniform_distance (long number) |
Generates an image based on a uniform random distribution of distances. More... | |
int | noise_gaussian_distance (long number, double stdev) |
Generates an image based on a gaussian random distribution of distances. 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 given thresholds. More... | |
Bimage * | mask_by_conditional_thresholds (vector< double > threshold) |
Generates a mask based on a conditional hierarchy of thresholds. 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_shell_wrap (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_combine (Bstring &select_list) |
Combines the selected levels in a multi-level mask and renumber. 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, int fill_type=0, double fill=0) |
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 * | track_gradient (double threshold, int flag=0) |
Generates a segmented image from peaks above a threshold value. 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... | |
int | filter_extremes (double tmin, double tmax, int kernel=3) |
Filters the extremes out of an image by replacing with adjacent averages. 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... | |
GSgraph | graph_setup (int connect_type) |
Initializing voxels and edges for graph-based segmentation. More... | |
GSgraph | graph_segment (int type=1, int connect_type=0, double complexity=0, long min_size=0) |
Graph-based segmentation of an image. More... | |
Bimage * | graph_segments_to_image (GSgraph &g) |
Converting a graph-based segmentation to an image. More... | |
Bimage * | graph_segments_to_mask (GSgraph &g) |
Converting a graph-based segmentation to a multi-level mask. 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 |
General image parameter class.
All floating point coordinates are in angstroms and converted using the voxel units parameters.
Bimage::Bimage | ( | ) |
Initializes an image.
The internal initialization function is called.
Bimage::Bimage | ( | const Bimage & | p | ) |
The copy constructor.
The internal copy function is called.
Bimage::Bimage | ( | Bstring & | fn, |
int | readdata, | ||
int | img_select | ||
) |
Reads an image from a file.
The internal initialization function is called.
Bimage::Bimage | ( | DataType | type, |
CompoundType | ctype, | ||
long | nx, | ||
long | ny, | ||
long | nz, | ||
long | nn | ||
) |
Initializes an image.
type | data type. |
ctype | compound type. |
nx | x dimension. |
ny | y dimension. |
nz | z dimension. |
nn | number of sub-images. The internal initialization function is called. The basic properties and size is set up and the data allocated. |
Bimage::Bimage | ( | DataType | type, |
CompoundType | ctype, | ||
Vector3< long > | size, | ||
long | nn | ||
) |
Initializes an image.
type | data type. |
ctype | compound type. |
size | image size. |
nn | number of sub-images. The internal initialization function is called. The basic properties and size is set up and the data allocated. |
Bimage::Bimage | ( | DataType | type, |
CompoundType | ctype, | ||
vector< long > | size, | ||
long | nn | ||
) |
Initializes an image.
type | data type. |
ctype | compound type. |
size | image size. |
nn | number of sub-images. |
The internal initialization function is called. The basic properties and size is set up and the data allocated.
Bimage::Bimage | ( | DataType | type, |
long | nc, | ||
long | nx, | ||
long | ny, | ||
long | nz, | ||
long | nn | ||
) |
Initializes a generic multi-channel image.
type | data type. |
nc | number of channels. |
nx | x dimension. |
ny | y dimension. |
nz | z dimension. |
nn | number of sub-images. The internal initialization function is called. The basic properties and size is set up and the data allocated. |
Initializes a generic multi-channel image.
type | data type. |
nc | number of channels. |
size | image size. |
nn | number of sub-images. The internal initialization function is called. The basic properties and size is set up and the data allocated. |
Bimage::Bimage | ( | Matrix & | mat, |
long | scale | ||
) |
Initializes an image from a 2D matrix.
mat | matrix. |
scale | integer 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. |
Bimage::~Bimage | ( | ) |
Image destructor.
All properties and associated data are deallocated.
void Bimage::absolute | ( | ) |
Converts to absolute values.
void Bimage::add | ( | Bimage * | p | ) |
Adds another image to an image.
*p | image to be added. Requirement: The images must have the same size. |
void Bimage::add | ( | Bimage * | p, |
double | scale, | ||
double | shift | ||
) |
Adds another image to an image.
*p | image to be added. |
scale | density scale to other image |
shift | density shift to other image. Requirement: The images must have the same size. |
void Bimage::add | ( | double | v | ) |
Adds a constant value to an image.
v | constant to be added. |
void Bimage::add | ( | double | xx, |
double | yy, | ||
double | zz, | ||
long | nn, | ||
double | v | ||
) |
Adds a value at a given location to neigboring data elements.
xx | x location. |
yy | y location. |
zz | z location. |
nn | image number (4 th dimension). |
v | value to add. Inverse of trilinear interpolation. |
|
inline |
|
inline |
void Bimage::add | ( | long | nn, |
Bimage * | p | ||
) |
Adds another image to a sub-image.
nn | sub-image. |
*p | image to be added. Requirement: The images must have the same size. If the FOM block is defined, it is used to accumulate a sum of: the FOM block of the added image if it exists, or otherwise the square of the data added. |
void Bimage::add | ( | long | nn, |
Bimage * | p, | ||
double | scale, | ||
double | shift | ||
) |
Adds another image to an image.
nn | sub-image. |
*p | image to be added. |
scale | density scale to other image |
shift | density shift to other image. Requirement: The images must have the same size. |
vector< Vector3< double > > Bimage::align | ( | long | ref_num, |
long | window, | ||
long | step, | ||
Bimage * | pmask, | ||
double | hi_res, | ||
double | lo_res, | ||
double | shift_limit, | ||
double | edge_width, | ||
double | gauss_width, | ||
Vector3< long > | aln_bin, | ||
int | mode = 0 |
||
) |
Aligns and sums a set of sub-images, first progressively and then iteratively.
ref_num | reference sub-image. |
window | moving sum window. |
step | moving sum interval. |
*pmask | cross-correlation mask. |
hi_res | high resolution limit. |
lo_res | low resolution limit. |
shift_limit | limit on extent of search for shift. |
edge_width | width of smoothing edge. |
gauss_width | decay coefficient for smoothing edge. |
aln_bin | 3-value vector indicating binning level. |
mode | flag to select initial alignment: 0=progressive, 1=local. |
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. The image is extensively modified and should not be used for further processing.
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.
*pref | reference 2D image. |
res_polar | polar resolution limit. |
ann_min | minimum annulus (>=0). |
ann_max | maximum annulus (< image radius). |
*prs_mask | dual mask. |
shift_limit | maximum shift from nominal origin of box. |
angle_limit | maximum rotation from original in-plane rotation angle. |
planf_1D | FFT forward plan for polar images. |
planb_1D | FFT backward plan for polar images. |
planf_2D | FFT forward plan for 2D images. |
planb_2D | FFT backward plan for 2D images. |
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.
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.
*pref | reference 2D image. |
ann_min | minimum annulus (>=0). |
ann_max | maximum annulus (< image radius). |
res_lo | low resolution limit (angstrom). |
res_hi | high resolution limit (angstrom). |
shift_limit | maximum shift from nominal origin of box. |
angle_limit | maximum rotation from original in-plane rotation angle. |
This is a simplified interface to the other function Bimage::align2D. All the fourier transform and rotation functions are handled internally.
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.
*pref | reference 2D image. |
res_hi | high resolution limit. |
res_lo | low resolution limit. |
shift_limit | maximum shift from nominal origin of box. |
angle_limit | maximum rotation from original in-plane rotation angle. |
planf | FFT forward plan. |
planb | FFT backward plan. |
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.
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.
ref_num | reference sub-image. |
*pmask | cross-correlation mask. |
hi_res | high resolution limit. |
lo_res | low resolution limit. |
shift_limit | limit on extent of search for shift. |
edge_width | width of smoothing edge. |
gauss_width | decay coefficient for smoothing edge. |
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.
Bimage * Bimage::align_local | ( | 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.
nref | reference sub-image. |
*pmask | cross-correlation mask. |
hi_res | high resolution limit. |
lo_res | low resolution limit. |
shift_limit | limit on extent of search for shift. |
planf | plan for forward Fourier transform. |
planb | plan for backward Fourier transform. |
The images are aligned against the reference images with progressive addition to reference to decrease noise.
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.
nref | reference sub-image. |
*pmask | cross-correlation mask. |
hi_res | high resolution limit. |
lo_res | low resolution limit. |
shift_limit | limit on extent of search for shift. |
planf | plan for forward Fourier transform. |
planb | plan for backward Fourier transform. |
The images are aligned against the reference images with progressive addition to reference to decrease noise.
Bimage * Bimage::align_progressive_fast | ( | long | nref, |
double | shift_limit | ||
) |
Aligns and sums a set of sub-images using a progressive algorithm.
nref | reference sub-image. |
shift_limit | limit on extent of search for shift. |
The images are aligned against the reference images with progressive addition to reference to decrease noise.
|
inline |
Bimage * Bimage::aniso_average | ( | long | ksize, |
double | w | ||
) |
Calculates an anisotropic average within a kernel based on the local gradient.
ksize | kernel radius. |
w | gradient weight (0 reverts to isotropic). |
long Bimage::apply_soft_mask | ( | long | nn, |
Bimage * | pmask, | ||
int | fill_type, | ||
double | fill | ||
) |
Applies a soft mask to a sub-image.
nn | sub-image. |
pmask | soft mask: [0,1]. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | value of edge voxels. |
The image is multiplied with the mask, filling in the remainder with the fill value. Requirement: The mask must range from 0 to 1.
void Bimage::arccosine | ( | ) |
Calculates the arccosine of an image.
The values are truncated to be within [-1,1].
void Bimage::arcsine | ( | ) |
Calculates the arcsine of an image.
The values are truncated to be within [-1,1].
void Bimage::arctangent | ( | ) |
Calculates the arctangent of an image.
The values are truncated to be within [-1,1].
void Bimage::arctangent | ( | Bimage * | p | ) |
Calculates the inverse tangent from two images.
*p | denominator (x) image. |
int Bimage::assemble_tiles | ( | Bimage * | pt, |
int | flag = 0 |
||
) |
Assembles overlapping tiles into this image.
*pt | multi-image containing tiles. |
flag | flag to set overlap handling. |
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.
int Bimage::auto_correlate | ( | double | hires, |
double | lores | ||
) |
Calculates an autocorrelation map by Fast Fourier transformation.
hires | high resolution limit. |
lores | low resolution limit. |
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.
|
inline |
|
inline |
double Bimage::average | ( | long | cc, |
double | xf, | ||
double | yf, | ||
double | zf, | ||
long | nn, | ||
double | iscale | ||
) |
Averages in 3D when scaling is less than 1.
cc | channel. |
xf | x location. |
yf | y location. |
zf | z location. |
nn | image number. |
iscale | inverse scale. |
All neighboring voxels in x, y and z are averaged and result returned.
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.
cc | channel. |
xf | x location. |
yf | y location. |
zf | z location. |
nn | image number. |
iscale | inverse scale. |
All neighboring voxels in x and y are averaged and result returned.
|
inline |
Bimage * Bimage::average_images | ( | bool | sd | ) |
Averages all sub-images and optionally calculates standard deviation image.
sd | flag to calculate linked standard deviation image. |
double Bimage::average_line | ( | long | xx, |
long | yy, | ||
long | zz, | ||
long | nn, | ||
long | len, | ||
int | dir | ||
) |
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.
*p | real space reference image. |
res_hi | upper resolution limit. |
res_lo | lower resolution limit. |
weighting | weighting type: 0, none; 1, p1-amp; 2, p2-amp; 3, both amps |
Both images are Fourier transformed and the absolute phase difference calculated and averaged.
int Bimage::back_project | ( | Bimage * | p, |
double | resolution, | ||
double | axis, | ||
fft_plan | planf, | ||
fft_plan | planb | ||
) |
|
inline |
|
inline |
|
inline |
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.
nn | sub-image. |
start | start of bar. |
end | end of bar. |
width | width of bar. |
edge_width | bar edge width. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
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.
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.
start | start of bar. |
end | end of bar. |
width | width of bar. |
edge_width | bar edge width. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
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.
|
inline |
int Bimage::bin | ( | Vector3< long > | bk | ) |
Bins by an integer size in place.
bk | 3-value vector of integer bin factors. |
An image is binned by an integer size.
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.
bin | integer bin factor. |
An image is binned by an integer size, square in 2D and cubic in 3D.
|
inline |
Bins by an integer size and returns a new image.
bk | 3-value vector of integer bin factors. |
An image is binned by an integer size.
Blends the two images, creating a new set of sub-images.
*p | second image. |
number | number of images in the series. |
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.
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.
threshold | threshold to define contiguous regions. |
min_size | minimum number of voxels to keep a region. |
max_size | maximum number of voxels to keep a region. |
setvalue | value to assign to deleted regions (typically set to threshold). |
sign | sign controlling direction of thresholding. |
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.
int Bimage::calculate_background | ( | Bimage * | pmask, |
int | flag = 0 |
||
) |
Calculates the background for each sub-image.
*pmask | foreground mask. |
flag | flag to specify where to calculate the background: [0,1] |
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).
int Bimage::calculate_background | ( | Bimage * | pmask, |
long | nn, | ||
int | flag = 0 |
||
) |
Calculates the background for one sub-image.
*pmask | foreground mask. |
nn | sub-image. |
flag | flag to specify where to calculate the background: [0,1] |
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).
int Bimage::calculate_background | ( | int | flag = 0 | ) |
Calculates the background for each sub-image.
flag | flag to specify where to calculate the background: [0,3] |
The background is taken as the average of the values outside the circle or sphere enclosed by the image.
int Bimage::calculate_background | ( | long | nn, |
int | flag | ||
) |
Calculates the background for one sub-image.
nn | sub-image. |
flag | flag to specify where to calculate the background: [0,3] |
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.
Bimage * Bimage::cartesian_to_cylindrical | ( | long | nannuli, |
long | nphi, | ||
int | flag = 0 |
||
) |
Calculates an image with cylindrical coordinates.
nannuli | number of annuli. |
nphi | number of phi angles. |
flag | switch: annulus-angle-z (0), angle-annulus-z (1), z-annulus-angle (2) |
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.
Bimage * Bimage::cartesian_to_spherical | ( | long | nannuli, |
long | nphi, | ||
long | ntheta | ||
) |
Calculates an image with spherical coordinates.
nannuli | number of annuli. |
nphi | number of phi angles. |
ntheta | number of theta angles. |
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.
void Bimage::catenate | ( | long | m, |
Bimage ** | p | ||
) |
Catenates an array of images of the same size into a multi-image structure.
m | number of images in the array. |
**p | array of images. The images must all have the same dimensions. |
double Bimage::ccmap_confidence | ( | long | nn | ) |
Calculates a confidence level to associate with a cross-correlation peak.
nn | sub-image. |
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
int Bimage::center | ( | int | fill_type = 0 , |
double | fill = 0 |
||
) |
Centers an image.
fill_type | fill type for filling empty regions. |
fill | value to fill in empty regions. |
int Bimage::center_wrap | ( | ) |
Centers an image with wrapping.
Bimage * Bimage::central_section | ( | Matrix3 | mat, |
double | resolution, | ||
FSI_Kernel * | kernel, | ||
double | wavelength = 0 |
||
) |
Calculates a central section of a 3D fourier transform.
mat | 3x3 rotation or skewing matrix. |
resolution | high resolution limit. |
*kernel | frequency space interpolation kernel. |
wavelength | for Ewald sphere projection, default zero, ± for front or back curvature. |
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.
int Bimage::change_symmetry | ( | Bsymmetry & | symold, |
Bsymmetry & | symnu, | ||
double | radius, | ||
double | z_slope | ||
) |
Changes the symmetry order for cyclic and dihedral maps.
*symold | original symmetry. |
*symnu | new symmetry. |
radius | radius in voxels of repeating units. |
z_slope | slope along z to adjust radius. |
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.
Resizes a "standard" transform.
nusize | new image size. |
A standard transform is resized by inserting or removing rows or columns in the middle of the data set.
void Bimage::change_type | ( | char * | string | ) |
Get the data type from a string.
*string | string describing the data type. |
void Bimage::change_type | ( | char | letter | ) |
Get the data type indicated by a single letter code.
letter | letter indicating data type. This function is used in optional command-line arguments to indicate a new data type for an image. |
void Bimage::change_type | ( | DataType | nutype | ) |
Change the data to the new type.
nutype | new data type. |
|
inline |
|
inline |
int Bimage::channels_to_images | ( | ) |
void Bimage::check | ( | ) |
Checks an image for reasonable properties.
bool Bimage::check_compoundtype | ( | long | nc, |
CompoundType | ct | ||
) |
bool Bimage::check_if_same_image_size | ( | Bimage * | p | ) |
Check if two images are the same size.
*p | image to check. |
The function returns the answer and leaves the calling function to deal with the result.
bool Bimage::check_if_same_size | ( | Bimage * | p | ) |
Check if two images are the same size.
*p | image to check. |
The function returns the answer and leaves the calling function to deal with the result.
long Bimage::check_neighbors | ( | long | idx | ) |
Check neighbors in region map and assign a value if a neighbor is assigned.
idx | index in multi-image. |
double Bimage::check_point_group | ( | Bstring & | check_string | ) |
Checks for the requested symmetries.
&check_string | string with requested point groups. |
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.
void Bimage::check_resolution | ( | double & | resolution | ) |
Checks that the resolution falls within reasonable limits.
&resolution | resolution (modified). The resolution is set to between the real size and the 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.
int Bimage::chirp | ( | double | freq_scale, |
double | freq_shift = 0 |
||
) |
Generates a chirp image.
freq_scale | frequency scale. |
freq_shift | frequency shift (radians). |
|
inline |
CMYK< double > Bimage::cmyk | ( | long | j | ) |
Returns a color value at the given index.
j | index. |
The index refers to compound values.
int Bimage::color_blue | ( | double | cmin, |
double | cmax, | ||
int | flag = 0 |
||
) |
Converts a gray-scale image to blue.
cmin | lower grayscale boundary. |
cmax | upper grayscale boundary. |
flag | sets the type of conversion |
A grayscale image is converted to blue between the given minimum and maximum.
int Bimage::color_combine | ( | Bimage * | p | ) |
Combines two colored images.
*p | second image. |
Each pair of voxels is summed and the result truncated to 255.
int Bimage::color_green | ( | double | cmin, |
double | cmax, | ||
int | flag = 0 |
||
) |
Converts a gray-scale image to green.
cmin | lower grayscale boundary. |
cmax | upper grayscale boundary. |
flag | sets the type of conversion |
A grayscale image is converted to green between the given minimum and maximum.
int Bimage::color_red | ( | double | cmin, |
double | cmax, | ||
int | flag = 0 |
||
) |
Converts a gray-scale image to red.
cmin | lower grayscale boundary. |
cmax | upper grayscale boundary. |
flag | sets the type of conversion |
A grayscale image is converted to red between the given minimum and maximum.
Bimage * Bimage::color_spectrum | ( | double | cmin, |
double | cmax | ||
) |
Colorizes an image to a spectrum.
cmin | lower grayscale boundary. |
cmax | upper grayscale boundary. |
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.
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.
void Bimage::combine_channels | ( | long | nc, |
CompoundType | ct = TSimple |
||
) |
Combines images as channels.
nc | number of channels to create. |
ct | compound type. The input image is replaced with a new image. If the compound type is single value, the compound type is inferred from the number of channels. |
int Bimage::combine_ewald | ( | ) |
int Bimage::combined_complex_product | ( | ) |
Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images.
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.
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.
*pmask | binary mask (only 0 and 1), NULL if not desired. |
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.
int Bimage::combined_complex_product | ( | double | hires, |
double | lores, | ||
Bimage * | pmask = NULL |
||
) |
Calculates the complex conjugate product of a complex image resulting from combining and Fourier transforming two real space images.
hires | high resolution limit. |
lores | low resolution limit. |
*pmask | binary mask (only 0 and 1), NULL if not desired. |
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.
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.
hires | high resolution limit. |
lores | low resolution limit. |
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.
int Bimage::combined_phase_product | ( | double | hires, |
double | lores, | ||
Bimage * | pmask = NULL |
||
) |
Calculates the phase product of a complex image resulting from combining and Fourier transforming two real space images.
hires | high resolution limit. |
lores | low resolution limit. |
*pmask | binary mask (only 0 and 1), NULL if not desired. |
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 phase product . The result is scaled by the size, yielding the phase the correlation coefficient when the product is backtransformed into the phasecorrelation map.
bool Bimage::compatible | ( | Bimage * | p | ) |
Check if this image has the same number of channels and data type as another.
*p | reference image. |
The function returns the answer and leaves the calling function to deal with the result.
Complex< double > Bimage::complex | ( | long | j | ) |
Returns a complex value at the given index.
j | index. |
The index refers to compound values.
int Bimage::complex_apply_dual_mask | ( | Bimage * | pmask | ) |
Applies a dual mask to a complex image.
*pmask | mask (converted to floating point). |
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.
int Bimage::complex_apply_mask | ( | Bimage * | pmask | ) |
Applies a mask to a complex image.
*pmask | mask (converted to floating point). |
Wherever the mask is <= 0, the data is set to zero. Requirement: The two images must be the same size. No statistics are calculated.
int Bimage::complex_apply_negative_mask | ( | Bimage * | pmask | ) |
Applies a negative mask to a complex image.
*pmask | mask (converted to floating point). |
Wherever the mask is >= 0, the data is set to zero. Requirement: The two images must be the same size. No statistics are calculated.
int Bimage::complex_bandpass | ( | double | hires, |
double | lores | ||
) |
Bandpasses a Fourier transform.
hires | high resolution limit. |
lores | low resolution limit. |
Requirement: a complex Fourier transform. All data outside the band limits are set to zero.
void Bimage::complex_conjugate | ( | ) |
Calculates the complex conjugate image.
int Bimage::complex_conjugate_product | ( | Bimage * | p, |
int | norm = 0 |
||
) |
Calculates the product of a complex image with the conjugate of a second.
*p | complex image. |
norm | normalize. |
Complex conjugate product: (a + ib)*(c - id) = (a*c + b*d) + i(b*c - a*d). Normalization is determined by the norm flag: 1 square root of the power sum product of the two images 2 the power sum of the first image Requirement: The two images must be the same size. No statistics are calculated.
Calculates the product of a complex image with the conjugate of a second.
*p | complex image. |
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.
int Bimage::complex_convert | ( | ComplexConversion | conv | ) |
Converts a complex image to a simple image.
conv | a flag for converting the complex image. |
int Bimage::complex_invert | ( | ) |
Inverts a complex image.
The image is scaled by the remaining total power, i.e., the sum of the intensities.
int Bimage::complex_multiply | ( | Bimage * | p | ) |
Calculates the product of a complex image with a simple image.
*p | simple image. |
Requirement: The two images must be the same size. No statistics are calculated.
double Bimage::complex_normalize | ( | ) |
Normalizes the power in a complex image.
The first element is set to zero. The image is scaled by the remaining total power, i.e., the sum of the intensities.
double Bimage::complex_power | ( | ) |
Calculates the power in a complex image.
The first element is set to zero. The image is scaled by the remaining total power, i.e., the sum of the intensities.
int Bimage::complex_product | ( | Bimage * | p | ) |
Calculates the complex product of two complex images.
*p | complex image. |
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.
Bimage * Bimage::complex_split | ( | ) |
A complex image is split into two simple images.
The imaginary part is written into the new image. The complex image is replaced by its real part.
void Bimage::complex_to_amplitudes | ( | ) |
The amplitudes from a complex image is written to a simple image.
void Bimage::complex_to_imaginary | ( | ) |
The imaginary part of a complex image is written to a simple image.
void Bimage::complex_to_intensities | ( | ) |
The intensities from a complex image is written to a simple image.
void Bimage::complex_to_phases | ( | ) |
The phases from a complex image is written to a simple image.
void Bimage::complex_to_real | ( | ) |
The real part of a complex image is written to a simple image.
void Bimage::complex_to_signed_amplitudes | ( | ) |
The signed amplitudes from a complex image is written to a simple image.
|
inline |
long Bimage::compound_type | ( | CompoundType | ct | ) |
|
inline |
Bstring Bimage::compound_type_string | ( | ) |
Get the string representation of a datatype.
double Bimage::convert_to_helix | ( | double | helix_rise, |
double | helix_angle, | ||
Vector3< double > | offset | ||
) |
Converts a map to a helix.
helix_rise | rise per asymmetric unit |
helix_angle | rotation angle per asymmetric unit. |
offset | offset in the xy plane. |
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
int Bimage::convolve | ( | Bimage * | pkernel | ) |
Convolves an image with an arbitrary size convolution filter.
*pkernel | kernel encoded as an image. |
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.
int Bimage::convolve_chunk | ( | Bimage * | pkernel, |
float * | nudata, | ||
long | i, | ||
long | len | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
Bimage * Bimage::copy | ( | ) |
Copies the header information and data of an image into a new image structure.
Bimage * Bimage::copy | ( | long | nu_nimg | ) |
Copies the header information and data of an image into a new image structure.
nu_nimg | new number of images (if < 1, keep the old number) |
|
inline |
Bimage * Bimage::copy_header | ( | long | nu_nimg | ) |
Copy an image structure into a new one.
nu_nimg | new number of images (if < 1, keep the old number) |
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.
int Bimage::correct_background | ( | Bimage * | pmask, |
int | flag = 0 |
||
) |
Corrects the background for each sub-image.
*pmask | foreground mask. |
flag | flag to specify where to calculate the background: [0,3] |
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.
int Bimage::correct_background | ( | int | flag = 0 | ) |
Corrects the background for each sub-image.
flag | flag to specify where to calculate the background: [0,1] |
The background is taken as the average of the values outside the circle or sphere enclosed by the image.
int Bimage::correct_background | ( | long | nn, |
int | flag | ||
) |
Corrects the background for one sub-image.
nn | sub-image. |
flag | flag to specify where to calculate the background: [0,3] |
The background is taken as the average of the values outside the circle or sphere enclosed by the image.
double Bimage::correlate | ( | Bimage * | p | ) |
Calculates correlation coefficient between two images.
*p | image to correlate with. |
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.
double Bimage::correlate | ( | Bimage * | p, |
double | rmin, | ||
double | rmax, | ||
Bimage * | pmask = NULL , |
||
int | flag = 0 |
||
) |
Calculates a correlation coefficient between two images.
*p | second image. |
rmin | minimum radius (pixel units). |
rmax | maximum radius (pixel units). |
*pmask | mask (can be NULL). |
flag | flag to modify second image. |
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)
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.
*polref | reference image polar power spectrum transform. |
ann_min | low resolution cutoff (in inverse pixels). |
ann_max | high resolution cutoff (in inverse pixels). |
ang_min | minimum angle to test for (radians). |
ang_max | maximum angle to test for (radians). |
planf | FFT forward plan. |
planb | FFT backward plan. |
&cc_max | pointer to correlation coefficient for return. |
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).
double Bimage::correlation_coefficient | ( | Vector3< double > | shift | ) |
Calculates a coefficient from a Fourier correlation transform given a shift.
shift | real space shift. |
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.
void Bimage::cosine | ( | ) |
Calculates the cosine of a phase image.
The values must be in radians.
Bimage * Bimage::cross_correlate | ( | Bimage * | p, |
double | hires, | ||
double | lores, | ||
Bimage * | pmask, | ||
fft_plan | planf, | ||
fft_plan | planb | ||
) |
write_img("pccp.mrc", pc, 0);
Calculates a cross-correlation map by Fast Fourier transformation.
*p | second image. |
hires | high resolution limit. |
lores | low resolution limit. |
*pmask | binary mask (only 0 and 1), NULL if not desired. |
FFTW library (www.fftw.org). Two equally sized multi-image 1D, 2D and 3D real space data sets are packed into a complex data set and transformed forward. The transform is unpacked before the first transform is multiplied with the complex conjugate of the second transform. This is then back-transformed to obtain the cross-correlation map in real space. The low resolution limit can be 0, in which case no limits are applied. The resultant cross-correlation image data type is floating point.
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.
*p | second image. |
hires | high resolution limit. |
lores | low resolution limit. |
planf | forward transform plan. |
planb | backward transform plan. |
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.
Bimage * Bimage::cross_correlate_fspace | ( | Bimage * | p, |
double | hires, | ||
double | lores, | ||
double | shift_limit | ||
) |
Calculates a cross-correlation map by Fast Fourier transformation.
*p | second image. |
hires | high resolution limit. |
lores | low resolution limit. |
shift_limit | maximum real space shift. |
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.
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.
*p | second image. |
hires | high resolution limit. |
lores | low resolution limit. |
planf | FFT forward plan. |
planb | FFT backward plan. |
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.
Calculates a masked cross-correlation map by Fast Fourier transformation.
*p | second image. |
*pmask | binary mask (only 0 and 1), NULL if not desired. |
FFTW library (www.fftw.org). Two equally sized multi-image 1D, 2D and 3D real space data sets are packed into a complex data set and transformed forward. The transform is unpacked 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.
int Bimage::cylinder | ( | Vector3< double > | center, |
double | radius, | ||
double | height, | ||
double | width, | ||
int | fill_type = 0 , |
||
double | fill = 0 , |
||
bool | wrap = 0 |
||
) |
Fills a cylinder within an image with a uniform value.
center | three vector center of cylinder. |
radius | cylinder radius. |
height | cylinder heigth. |
width | gaussian width of smoothing function. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
wrap | wrap around boundaries (default not). |
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}.
int Bimage::cylindrical_shells | ( | ) |
Calculates an image with slices representing cylindrical shell projections.
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.
|
inline |
unsigned char * Bimage::data_alloc | ( | DataType | type, |
CompoundType | ctype, | ||
long | nx, | ||
long | ny, | ||
long | nz, | ||
long | nn | ||
) |
Allocate image data with size parameters.
type | data type. |
ctype | compound type. |
nx | x dimension. |
ny | y dimension. |
nz | z dimension. |
nn | number of sub-images. |
The image parameters are set and a new data block allocated.
unsigned char * Bimage::data_alloc | ( | long | nbytes | ) |
Allocate image data.
nbytes | number of bytes to allocate. |
Any old data block is deleted.
|
inline |
|
inline |
|
inline |
unsigned char * Bimage::data_assign | ( | unsigned char * | nudata | ) |
Assign image data.
*nudata | allocated data pointer. |
Note: The size of the data block must correspond to the image dimensions!
void Bimage::data_delete | ( | ) |
Deallocates the image data.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
long Bimage::data_type_bits | ( | ) | const |
Returns the size of the datatype in bits.
The Bit type returns 1.
double Bimage::data_type_max | ( | ) |
Get the maximum of a datatype.
This function is used for returning the maximum value a data type can hold.
double Bimage::data_type_min | ( | ) |
Get the minimum of a datatype.
This function is used for returning the minimum value a data type can hold.
long Bimage::data_type_size | ( | ) | const |
Returns the size of the datatype in bytes.
The Bit type returns 1.
Bstring Bimage::data_type_string | ( | ) |
Get the string representation of a datatype.
|
inline |
Bimage * Bimage::defocus_scale | ( | long | nn, |
double | df, | ||
double | df2, | ||
double | iCL2, | ||
int | fill_type | ||
) |
long Bimage::delete_images | ( | Bstring | list, |
int | retain = 0 |
||
) |
Retains or deletes sub-images from a multi-image structure.
list | list of sub-images to retain or delete. |
retain | 0=delete list, 1=retain list. |
Sub-images specified in a list are either retained or deleted. The new data replaces the old data.
|
inline |
double Bimage::density | ( | long | nn, |
Vector3< double > | coord, | ||
double | radius, | ||
double & | sigma | ||
) |
Calculates the density in a sphere around a coordinate in an image.
nn | sub-image number. |
coord | position of density in map (voxels). |
radius | spherical radius. |
sigma | standard deviation result. |
The density origin is positioned on the component.
int Bimage::distort_elliptically | ( | double | angle, |
double | shift | ||
) |
Transforms a tubular cylinder to an elliptical profile.
angle | angle of elliptical maximum. |
shift | outward shift at elliptical maximum radius. |
The density is shifted towards or away from the origin by a specific amount and in a direction determined by an elliptical profile.
void Bimage::divide | ( | Bimage * | p, |
double | scale = 1 , |
||
double | shift = 0 |
||
) |
Divides the first image by the second.
*p | other image. |
scale | density scale to apply to other image |
shift | density shift to apply to other image. The image is divided by the other with exceptions: image /= other*scale + shift Both images are converted to floating point. |
void Bimage::divide_one | ( | Bimage * | p, |
double | scale = 1 , |
||
double | shift = 0 |
||
) |
Divides the first image by the first sub-image of the second.
*p | other image. |
scale | density scale to apply to other image |
shift | density shift to apply to other image. The image is divided by the other with exceptions: image /= other*scale + shift Both images are converted to floating point. |
double Bimage::dyad_interpolate | ( | long | i, |
int | norm_flag = 1 |
||
) |
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.
type | type of edge: 0=rectangle, 1=oval, 2=cylinder |
rect | three-value size of the area to be smoothed. |
start | three-value start for smoothing. |
width | gaussian width of smoothing function. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | value of edge voxels. |
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.
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.
nn | sub-image. |
type | type of edge: 0=rectangle, 1=oval, 2=cylinder |
rect | three-value size of the area to be smoothed. |
start | three-value start for smoothing. |
width | gaussian width of smoothing function. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | value of edge voxels. |
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.
Bimage * Bimage::edge_mask | ( | int | type, |
Vector3< long > | rect, | ||
Vector3< double > | start, | ||
double | width | ||
) |
Creates a mask with the edge approaching zero.
type | type of edge: 0=rectangle, 1=oval, 2=cylinder |
rect | three-value size of the area to be masked. |
start | three-value start for mask. |
width | gaussian width of smoothing function. |
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.
int Bimage::enlarge | ( | Vector3< long > | scale | ) |
Enlarges an image by an inetger scale.
scale | three-value scale. |
An image is enlarged by integer amounts. The new data replaces the old data.
|
inline |
int Bimage::ewald_sphere | ( | double | volt, |
double | t | ||
) |
Imposes an Ewald sphere weighting on a 3D frequency space volume.
volt | acceleration voltage (angstrom). |
t | thickness. |
void Bimage::exponential | ( | ) |
Calculates the exponential of the image data.
The image is first converted to floating point. The new data replaces the old data. Image statistics are recalculated.
Bimage * Bimage::extract | ( | long | n1, |
long | n2 | ||
) |
Extracts a set of sub-images into new image structure.
n1 | first sub-image to extract. |
n2 | last sub-image to extract. |
Bimage * Bimage::extract | ( | long | nn | ) |
Extracts one sub-image into new image structure.
nn | image number to extract. |
|
inline |
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.
nn | image number to extract. |
loc | extraction location. |
size | extraction size. |
ori | extraction origin. |
mat | orientation matrix. |
|
inline |
Bimage * Bimage::extract | ( | long | nn, |
Vector3< long > | coords, | ||
Vector3< long > | ext_size, | ||
int | fill_type = 0 , |
||
double | fill = 0 |
||
) |
Extracts a region of one sub-image into new image structure.
nn | image number to extract. |
coords | extraction start. |
ext_size | extraction size. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
Bimage * Bimage::extract_edge_difference | ( | ) |
Extracts all the edge pixels into a new image.
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.
img_num | image number from which to extract filament. |
width | width of filament image to extract. |
axis | helical axis alignment: x=1, y=2, z=3. |
nspline | number of coordinates in spline curve. |
*spline | spline curve. |
A single filament is extracted and returned.
Bimage * Bimage::extract_line | ( | long | nn, |
Vector3< double > | start, | ||
Vector3< double > | end, | ||
long | width | ||
) |
Extracts a line from an image into a new image.
nn | image number from which to extract. |
start | 3-vector start of line. |
end | 3-vector end of line. |
width | width of integration perpendicular to line. |
The line values extracted are the interpolated values along the vector defined by start and end coordinates..
Bimage * Bimage::extract_magnify | ( | long | nn, |
Vector3< long > | center, | ||
Vector3< long > | ext_size, | ||
double | scale | ||
) |
Extracts a region from an image to magnify.
nn | image number to extract. |
center | center of region to magnify. |
ext_size | size of region to magnify. |
scale | dimensional scaling. |
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.
Bimage * Bimage::extract_shell | ( | long | nn, |
double | minrad, | ||
double | maxrad | ||
) |
Extracts a shell from an image into a new image.
nn | image number from which to extract, -1 indicates all images. |
minrad | minimum shell radius. |
maxrad | maximum shell radius. |
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.
Bimage * Bimage::extract_show | ( | int | aflag | ) |
Converts a slice from an image to a 2D plane for display.
aflag | averaging flag. |
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.
int Bimage::extract_show_chunk | ( | Bimage * | pshow, |
int | aflag, | ||
long | i, | ||
long | len | ||
) |
Bimage * Bimage::extract_slice | ( | long | nz | ) |
Extracts a given slice or slices from an image.
nz | slice number to extract. |
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.
Bimage * Bimage::extract_tetrahedron | ( | Vector3< double > * | tet, |
int | fill_type = 0 , |
||
double | fill = 0 |
||
) |
Extracts a tetrahedral part of the image.
*tet | four 3-value vectors defining the tetrahedron. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
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.
Bimage * Bimage::extract_tile_stack | ( | Vector3< long > | coords, |
Vector3< long > | tile_size, | ||
int | fill_type = 0 , |
||
double | fill = 0 |
||
) |
Extracts a stack of tiles at a specified position from an image into a new image.
coords | coordinates for the tile origins. |
tile_size | 3-vector size of extracted image. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
A stack of tiles of specified size are extracted from all the sub-images in an image structure, using given coordinates for the tiles. The origins of the tiles are inserted into the sub-image origin fields. The old data is not affected.
Bimage ** Bimage::extract_tile_stacks | ( | vector< Vector3< long > > & | coords, |
Vector3< long > | tile_size | ||
) |
Extracts stacks of tiles at a specified positions from an image into an array of new images.
Extracts a set of tiles at specified positions from an image into a new image.
coords | coordinates for the tile origins. |
tile_size | 3-vector size of extracted image. |
Stacks of tiles of specified size are extracted from all the sub-images in an image structure, using given coordinates for the tiles. The origins of the tiles are inserted into the sub-image origin fields. The old data is not affected.
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.
nn | image number from which to extract. |
start | 3-vector start for first tile to be extracted. |
region | 3-vector size of part of image to be extracted (0 = whole image). |
tile_size | 3-vector size of extracted image. |
step_size | 3-vector size of tile intervals. |
exceed | flag to allow tiles to exceed the input image size. |
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.
Extracts a set of tiles from an image into a new image.
nn | image number from which to extract. |
tile_size | 3-vector size of extracted image. |
fraction | overlap fraction to aim for. |
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.
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.
nn | image number from which to extract, -1 indicates all images. |
coords | coordinates for the tile origins. |
tile_size | 3-vector size of extracted image. |
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.
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.
nn | image number to extract. |
loc | extraction location. |
size | extraction size. |
ori | extraction origin. |
mat | orientation matrix. |
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.
length | length in z. |
helix_rise | helical subunit rise in angstrom. |
helix_angle | helical subunit rotation in radians. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | value of edge voxels. |
The helical axis is at the origin and alongthe a axis.
|
inline |
int Bimage::fft | ( | fft_direction | dir, |
int | norm_flag | ||
) |
Fast Fourier transforms an image.
dir | direction of transformation (FFTW_FORWARD or FFTW_BACKWARD) |
norm_flag | normalization: 0=none, 1=sqrtN, 2=N. |
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.
int Bimage::fft | ( | fft_direction | dir, |
int | norm_flag, | ||
ComplexConversion | conv | ||
) |
Fast Fourier transforms an image with a specified conversion.
dir | direction of transformation (FFTW_FORWARD or FFTW_BACKWARD) |
norm_flag | normalization: 0=none, 1=sqrtN, 2=N. |
conv | a flag for converting after transform. |
int Bimage::fft | ( | fft_direction | dir, |
Vector3< long > | tile_size, | ||
int | norm_flag = 1 |
||
) |
Tiled Fourier transform.
dir | direction of transformation (FFTW_FORWARD or FFTW_BACKWARD) |
tile_size | tile size. |
norm_flag | normalization: 0=none, 1=sqrtN, 2=N. |
The 2d/3d image is tiled, each tile transformed and phase shifted. The tiles are then averaged and returned as a new image.
int Bimage::fft | ( | fft_plan | plan, |
int | norm_flag = 1 |
||
) |
Fast Fourier transforms an image.
plan | Fourier transform plan. |
norm_flag | normalization: 0=none, 1=sqrtN, 2=N. |
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.
|
inline |
|
inline |
fft_plan Bimage::fft_setup | ( | fft_direction | dir, |
int | opt = 0 |
||
) |
Sets up a plan for fast Fourier transforms.
dir | direction of transformation (FFTW_FORWARD or FFTW_BACKWARD) |
opt | optimization (0=FFTW_ESTIMATE, 1=FFTW_MEASURE, 2=FFTW_PATIENT, 3=FFTW_EXHAUSTIVE). |
FFTW library (www.fftw.org). The size and direction determines the plan. Both FFTW versions 2 and 3 are supported.
|
inline |
int Bimage::fftz | ( | fft_direction | dir, |
int | norm_flag = 1 |
||
) |
Fourier transform only of the z columns.
dir | direction of transformation (FFTW_FORWARD or FFTW_BACKWARD) |
norm_flag | normalization: 0=none, 1=sqrtZ, 2=Z. |
Only the z columns are transformed.
Bimage * Bimage::filament_density | ( | double | width | ) |
Estimates the density per pixel length of a filament.
width | filament width (pixels). |
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.
Bimage * Bimage::filament_from_projections | ( | double | hi_res, |
int | flag = 0 |
||
) |
Reconstructs a filament from a set of projections.
hi_res | high resolution limit. |
flag | 0=sequential, 1=random. |
The views are set at equally spaced angles around the z-axis.
Bplot * Bimage::filament_width | ( | long | width, |
long | lim_lo, | ||
long | lim_hi | ||
) |
Estimates the width of a filament.
width | window size. |
lim_lo | minimum filament width. |
lim_hi | maximum filament width. |
The filament axis must be along the y axis.
|
inline |
|
inline |
|
inline |
int Bimage::fill_gaps | ( | long | step | ) |
Fill the voxels that are not calculated.
step | step increment for voxels with proper values. |
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.
TypePointer Bimage::fill_value | ( | double | v | ) |
int Bimage::filter_average | ( | long | kernel_size | ) |
Applies an averaging filter to an image.
kernel_size | length of kernel edge (typically 3). |
A kernel of a given size is passed over the image and the average value within the kernel assigned to the central voxel.
int Bimage::filter_average | ( | Vector3< long > | k | ) |
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.
sigma1 | sigma for distance weighting function. |
sigma2 | sigma for density difference weighting function. |
kernel_type | kernel type for range filter. |
kernel_radius | kernel radius. |
The kernel is multiplied with each area surrounding the current voxel. Kernel types: 1. Gaussian 2. Lorentzian 3. Tukey
int Bimage::filter_bilateral_chunk | ( | Bimage * | pkernel, |
double | sigma2, | ||
int | kernel_type, | ||
float * | nudata, | ||
long | i, | ||
long | len, | ||
int | first | ||
) |
int Bimage::filter_by_difference | ( | Bimage * | p | ) |
Calculates an anisotropic average within a kernel based on the local gradient.
*p | image to compare with. |
int Bimage::filter_dog | ( | double | sigma1, |
double | sigma2 | ||
) |
Convolves the image with a difference of gausians kernel.
sigma1 | sigma for the inner gaussian. |
sigma2 | sigma for the outer gaussian. |
int Bimage::filter_extremes | ( | ) |
Filters the extremes out of a micrograph image.
Segmentation is used to identify large contiguous regions of high and low values, and these regions are set to the average.
int Bimage::filter_extremes | ( | double | tmin, |
double | tmax, | ||
int | kernel = 3 |
||
) |
Filters the extremes out of an image by replacing with adjacent averages.
tmin | minimum. |
tmax | maximum. |
kernel | kernel edge size. |
Pixels smaller than the minimum or larger than the maximum are set to the average within a defined kernel.
int Bimage::filter_extremes | ( | int | mod_flag | ) |
Filters the extremes out of an image.
mod_flag | modification flag (0=set to avg, 1=set to min_max). |
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.
int Bimage::filter_gaussian | ( | long | kernel_size, |
double | sigma = 0 |
||
) |
Applies a gaussian filter to an image.
kernel_size | length of kernel edge. |
sigma | gaussian decay. |
The image is comvolved with a Gaussian kernel. If the sigma value is zero, it is set to a sixth of the kernel size.
int Bimage::filter_ortho | ( | int | type | ) |
Convolves the image with an orthogonal kernel with wrapping.
type | type of kernel: 0=gradient magnitude, 1=laplacian. |
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.
Bimage * Bimage::filter_peak | ( | long | kernel_size | ) |
Finds the peaks in an image.
kernel_size | length of kernel edge (typically 3). |
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.
int Bimage::filter_rank | ( | long | kernel_size, |
double | rank | ||
) |
Applies a median filter to an image.
kernel_size | length of kernel edge (typically 3). |
rank | which value in the kernel to retain. |
A kernel of a given size is passed over the image and the median value within the kernel assigned to the central voxel.
int Bimage::filter_rank_chunk | ( | long | kernel_size, |
double | rank, | ||
float * | nudata, | ||
long | i, | ||
long | len | ||
) |
int Bimage::filter_rolling_ball | ( | long | radius, |
double | scale | ||
) |
Apply a rolling ball filter.
radius | radius of rolling ball. |
scale | density scale. |
int Bimage::filter_sinc | ( | ) |
Weighs an image with a sinc function.
This filter compensates for trilinear interpolation during reconstruction. The origin must be properly defined.
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.
*pmask | binary mask (only 0 and 1). |
hires | high resolution limit. |
lores | low resolution limit. |
radius | search radius (if < 1, default 1e30). |
sigma | attenuation around radius. |
refine_flag | set to refine shift to subpixel resolution. |
FFTW library (www.fftw.org). Two equally sized multi-image 1D, 2D and 3D data sets are transformed forward, the first transform multiplied by the complex conjugate of the second transform, followed by backward transformation and rescaling by 1/(N*N). Data beyond the resolution set in the first image structure are not used. Therefore the correct setting of units and resolution in the image are required. Defaults for the units are usually 1 Angstrom/voxel and a zero resolution would include the whole image (i.e., no resolution limitation). A shift vector for each pair of images is calculated to determine the cross-correlation peak to sub-pixel resolution. Note: The first image is the reference and the shift returned is to transform the second to fit the first.
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.
sym | point group. |
binfac | binning for faster searching (limited to 1,2,3). |
hires | high resolution limit in angstroms. |
lores | low resolution limit in angstroms. |
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}).
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.
angle_start | start value for angle. |
angle_end | end value for angle. |
angle_step | step size for angle. |
bin | bin image for faster searching (limited to 1,2,3). |
hires | high resolution limit in angstroms. |
lores | low resolution limit in angstroms. |
radius | radius for mask (voxels). |
An incremental search is done for the rotation angle, with the rise inferred from the cross-correlation shift.
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.
rise_start | start value for rise. |
rise_end | end value for rise. |
rise_step | step size for rise. |
angle_start | start value for angle. |
angle_end | end value for angle. |
angle_step | step size for angle. |
bin | bin image for faster searching (limited to 1,2,3). |
radius | radius for mask (voxels). |
An incremental search is done for the rise and rotation angle.
int Bimage::find_peak | ( | double | radius = 1e30 , |
double | sigma = 0 |
||
) |
Finds the peak in an image to the nearest voxel.
radius | search radius (if < 1, default 1e30). |
sigma | attenuation around radius. |
An image is searched for the global maximum (typically used to find the shift vector in a cross-correlation map). The peak vectors returned are in actual pixel coordinates (no wrapping). The location around which to search is taken from the image origins.
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.
excl_dist | exclusion distance between peaks. |
&ncoor | number of coordinates. |
&threshold_min | minimum threshold to choose peaks. |
&threshold_max | maximum threshold to choose peaks. |
pix_min | minimum peak width. |
pix_max | maximum peak width. |
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.
Bimage * Bimage::find_peaks | ( | long | kernelsize | ) |
Finds peaks in a map with periodic boundaries.
kernelsize | size of kernel side (must be ≥3). |
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.
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.
sym | point group. |
angle_step | angular step size for search. |
binfac | binning for faster searching (limited to 1,2,3). |
hires | high resolution limit in angstroms. |
lores | low resolution limit in angstroms. |
flags | flag to search only for minor axes. |
The point group symmetry operations are applied to an image with an orientation defined by the reference symmetry axis (default {0,0,1}).
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.
*pref | reference image. |
*pmask | binary mask (only 0 and 1). |
hires | high resolution limit. |
lores | low resolution limit. |
radius | search radius (if < 1, default 1e30). |
sigma | attenuation around radius. |
refine_flag | set to refine shift to subpixel resolution. |
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.
Vector3< double > Bimage::find_shift | ( | Bimage * | pref, |
Bimage * | pmask, | ||
double | hires, | ||
double | lores, | ||
double | radius, | ||
double | sigma, | ||
int | refine_flag, | ||
double & | cc | ||
) |
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.
*pref | reference image. |
*pmask | binary mask (only 0 and 1). |
hires | high resolution limit. |
lores | low resolution limit. |
radius | search radius (if < 1, default 1e30). |
sigma | attenuation around radius. |
refine_flag | set to refine shift to subpixel resolution. |
planf | forward Fourier transform plan. |
planb | backward Fourier transform plan. |
&cc | correlation coefficient |
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.
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.
*pref | reference image. |
hires | high resolution limit. |
lores | low resolution limit. |
radius | search radius (if < 1, default 1e30). |
sigma | attenuation around radius. |
refine_flag | set to refine shift to subpixel resolution. |
planf | forward Fourier transform plan. |
planb | backward Fourier transform plan. |
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.
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.
nn | sub-image to align. |
*pref | reference image. |
*pmask | binary mask for cross-correlation (only 0 and 1). |
hi_res | high resolution limit. |
lo_res | low resolution limit. |
shift_limit | search radius (if < 1, default 1e30). |
planf | forward Fourier transform plan. |
planb | backward Fourier transform plan. |
The shift is returned as the origin of each sub-image relative to the reference origin.
Vector3< double > Bimage::find_shift_in_transform | ( | double | shift_limit | ) |
Finds the shift by brute force backtransformation for selected shifts.
shift_limit | maximum real space 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.
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.
*ptemp | symmetric template. |
&sym | symmetry. |
phi_step | phi angle step size (radians). |
theta_step | theta angle step size (radians). |
alpha_step | rotation angle step size (radians). |
shift | shift to impose before symmetrization. |
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.
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.
*ptemp | template image. |
*pmask | reciprocal space mask. |
hires | high resolution limit. |
lores | low resolution limit. |
bin | level of image binning. |
planf | forward Fourier transform plan. |
planb | backward Fourier transform plan. |
A template is cross-correlated with the input image including bandpass filtering to target the size of the template particle.
Vector3< double > Bimage::fit_peak | ( | ) |
Fits an elliptic parabole to locate the position of the peak to sub-voxel resolution.
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.
long Bimage::fix_power_spectrum | ( | int | dir, |
double | ratio | ||
) |
Removes high-intensity artifacts on the zero-frequency lines in a power spectrum.
dir | line direction: 1=horizontal, 2=vertical, 3=both. |
ratio | threshold ratio. |
void Bimage::fix_type | ( | ) |
Determines the replacement data type.
An integer data type is switched between signed and unsigned.
|
inline |
|
inline |
int Bimage::friedel_apply | ( | ) |
Applies Friedel symmetry.
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.
double Bimage::friedel_check | ( | ) |
Checks Friedel symmetry.
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.
double Bimage::friedel_difference | ( | ) |
Calculates the difference between Friedel pairs.
The differences between each the complex 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.
Bplot * Bimage::fsc | ( | double | hi_res, |
double | sampling_ratio, | ||
vector< double > & | fsccut | ||
) |
Bplot * Bimage::fsc_dpr | ( | double | hi_res, |
double | sampling_ratio = 1 , |
||
int | flag = 0 |
||
) |
Calculates an FSC and DPR curves from two images.
hi_res | high resolution limit. |
sampling_ratio | radial sampling ratio (1 for per voxel sampling). |
flag | if 1 calculate only the FSC. |
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) )
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.
*p | second image. |
*pmask | mask. |
hi_res | high resolution limit. |
*cutoff | correlation threshold(s). |
mask_level | mask level index. |
size | kernel size. |
pad | padding factor. |
vedge | edge size. |
step | voxel step size. |
taper | kernel tapering function. |
fill | background fill value. |
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.
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.
*p | second image. |
hi_res | high resolution limit. |
*cutoff | correlation threshold(s). |
thickness | shell thickness. |
step | step size between shells. |
minrad | minimum radius. |
maxrad | maximum radius. |
pad | padding factor. |
smooth | flag for edge smooting. |
fill | background fill value. |
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.
cv | complex value from 2D transform. |
m | location in 3D relative to origin. |
part_weight | weight to assign to value (usually 1). |
interp_type | interpolation type (0=nearest neighbor, 1=weighted nearest neigbor, 2=trilinear). |
int Bimage::fspace_amp_one | ( | ) |
Sets all amplitudes to one.
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.
int Bimage::fspace_amp_threshold | ( | double | threshold | ) |
Filters the amplitudes of the Fourier transform of an image.
threshold | Miminum amplitude to accept. |
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.
int Bimage::fspace_background | ( | ) |
Calculates the background for a Fourier transform.
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.
res_hi | high resolution limit. |
res_lo | low resolution limit. |
width | gaussian width of edge. |
planf | forward Fourier transform plan. |
planb | backward Fourier transform plan. |
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.
int Bimage::fspace_bandpass | ( | double | res_hi, |
double | res_lo = 0 , |
||
double | width = 0 |
||
) |
Applies a bandpass filter to an image.
res_hi | high resolution limit. |
res_lo | low resolution limit. |
width | gaussian width of edge. |
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.
int Bimage::fspace_butterworth_band | ( | double | res_hi, |
double | res_lo, | ||
int | order = 16 |
||
) |
Calculates a Butterworth band-pass filter profile.
res_hi | high resolution limit. |
res_lo | low resolution limit. |
order | Buttorworth filter order. |
The image is Fourier transformed and weighed with a gaussian curve: Fnew = F*(1/sqrt(1+(s/shi)^n) - 1/sqrt(1+(s/slo)^n))
vector< double > Bimage::fspace_default_bands | ( | double | res_lo, |
double | res_hi | ||
) |
Sets up default frequency space bands to generate a mask.
res_lo | low resolution limit (angstrom). |
res_hi | high resolution limit (angstrom). |
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.
double Bimage::fspace_fit_B_factor | ( | double | res_hi = 0 | ) |
Determines the overall B-factor of an image.
res_hi | high resolution limit. |
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
int Bimage::fspace_frequency_filter | ( | double | freq, |
double | sigma | ||
) |
Applies a frequency filter to an image.
freq | frequency or inverse frequency. |
sigma | gaussian envelope width around frequency. |
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 filter imposes a guassian envelope at the given frequency. If the frequency value is greater than one, it is assumed to be given as the inverse.
Applies a frequency filter to an image.
freq | frequency or inverse frequency. |
sigma | gaussian envelope width around frequency. |
planf | forward Fourier transform plan. |
planb | backward Fourier transform plan. |
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 filter imposes a guassian envelope at the given frequency. If the frequency value is greater than one, it is assumed to be given as the inverse.
int Bimage::fspace_gabor_filter | ( | Vector3< double > | freq, |
double | fsigma, | ||
double | psigma | ||
) |
Applies a Gabor filter to an image.
freq | frequency or inverse frequency location. |
fsigma | gaussian envelope width in the direction of the frequency vector. |
psigma | gaussian envelope width perpendicular to the frequency vector. |
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 filter imposes a guassian envelope at the given frequency location. If the frequency vector size is greater than one, it is assumed to be given as the inverse.
int Bimage::fspace_gabor_filter | ( | Vector3< double > | freq, |
double | fsigma, | ||
double | psigma, | ||
fft_plan | planf, | ||
fft_plan | planb | ||
) |
Applies a Gabor filter to an image.
freq | frequency or inverse frequency direction location. |
fsigma | gaussian envelope width in the direction of the frequency vector. |
psigma | gaussian envelope width perpendicular to the frequency vector. |
planf | forward Fourier transform plan. |
planb | backward Fourier transform plan. |
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 filter imposes a guassian envelope at the given frequency location. If the frequency vector size is greater than one, it is assumed to be given as the inverse.
Generates a image with orthogonal gradients encoded in 3-value vectors.
sigma | Gaussian sigma values. |
The image is Fourier transformed if needed. An anisotropic weight function is calculated at each voxel and applied to the transform.
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.
img_num | sub-image number. |
m | location in image. |
kernel | interpolation kernel. |
long Bimage::fspace_maximum_radius | ( | double | resolution, |
double | sampling_ratio = 1 |
||
) |
Calculates the maximum radius in frequency space from a given resolution.
resolution | high resolution limit. |
sampling_ratio | frequency space sampling (default 1 pixel/sample). |
The maximum radius is either the physical image size divided by the resolution, or Nyquist frequency.
int Bimage::fspace_normalize | ( | ) |
Normalizes an image's amplitudes.
int Bimage::fspace_normalize_radial | ( | Bimage * | pmask, |
double | resolution = 0 , |
||
int | flag = 0 |
||
) |
Normalizes an image's amplitudes.
*pmask | reciprocal space mask (0 & 1, indicating inclusion of structure factors). |
resolution | high resolution limit. |
flag | flag to calculate power (0) or amplitude (1). |
int Bimage::fspace_pack_2D | ( | Bimage * | p, |
Matrix3 | mat, | ||
double | hi_res, | ||
double | lo_res, | ||
Vector3< double > | scale, | ||
double | ewald_wavelength = 0 , |
||
double | part_weight = 1 , |
||
int | interp_type = 0 |
||
) |
Packs a 2D Fourier transform into a 3D reciprocal space volume.
*p | 2D particle image transform. |
mat | rotation matrix. |
hi_res | high resolution limit. |
lo_res | low resolution limit (infinite if 0). |
scale | scale of reconstruction and particle magnification. |
ewald_wavelength | Ewald sphere wavelength, if 0, not applied. |
part_weight | weight of particle (usually 1). |
interp_type | interpolation type (0=nearest neighbor, 1=weighted nearest neigbor, 2=trilinear). |
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. The Ewald sphere offset is stored in the third scale element. Positive or negative for the corresponding sphere, or zero if not applied.
int Bimage::fspace_pack_2D | ( | Bimage * | p, |
View | asu_view, | ||
Bsymmetry & | sym, | ||
double | hi_res, | ||
double | lo_res, | ||
Vector3< double > | scale, | ||
double | ewald_wavelength = 0 , |
||
double | part_weight = 1 , |
||
int | interp_type = 0 |
||
) |
Packs a 2D Fourier transform into a 3D reciprocal space volume.
*p | 2D particle image transform. |
asu_view | view of asymmetric unit. |
*sym | point group symmetry. |
hi_res | high resolution limit. |
lo_res | low resolution limit (infinite if 0). |
scale | scale of reconstruction and particle magnification. |
ewald_wavelength | Ewald sphere wavelength, if 0, not applied. |
part_weight | weight of particle (usually 1). |
interp_type | interpolation type (0=nearest neighbor, 1=weighted nearest neigbor, 2=trilinear). |
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.
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.
*p | 2D particle image transform. |
ft_size | Fourier transform size. |
scale | scale of reconstruction and particle magnification. |
hi_res | high resolution limit. |
lo_res | low resolution limit (infinite if 0). |
matr | central section orientation matrix. |
mat | image orientation matrix. |
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;
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.
*p | 3D particle image transform. |
hi_res | high resolution limit. |
threshold | threshold to exclude low intensities. |
The image is added up to the high resolution limit and excluding low intensities as defined by the threshold.
int Bimage::fspace_positive | ( | ) |
Sets the image to positive definite.
vector< double > Bimage::fspace_radial | ( | long | nn, |
long | maxrad, | ||
int | flag = 0 |
||
) |
Calculates the radial power spectrum from a Fourier transform.
nn | sub-image number. |
maxrad | maximum radius (i.e., high resolution limit). |
flag | flag to calculate power (0) or amplitude (1), and not normalize (2). |
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.
Bimage * Bimage::fspace_radial_power | ( | double | resolution, |
double | sampling_ratio = 1 |
||
) |
Calculates the radial power spectrum from a Fourier transform.
resolution | high resolution limit. |
sampling_ratio | frequency space sampling (default 1 pixel/sample). |
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.
long Bimage::fspace_reconstruction_add | ( | Bimage * | p | ) |
Adds all components to a reconstruction.
*p | frequency space reconstruction to add. |
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.
long Bimage::fspace_reconstruction_snr | ( | ) |
Calculates the SNR map.
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.
int Bimage::fspace_reconstruction_stats | ( | double | resolution, |
double | sampling_ratio = 1 |
||
) |
Calculates Fourier shell statistics.
resolution | high resolution limit. |
sampling_ratio | frequency space sampling (default 1 pixel/sample). |
The average FOM and number of FOM values in each resolution shell is determined.
long Bimage::fspace_reconstruction_weigh | ( | ) |
Weighs a reconstruction.
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.
Resizes an image in frequency space to avoid interpolation.
pref | reference. |
int Bimage::fspace_resize | ( | double | scale, |
double | res_hi, | ||
double | res_lo | ||
) |
Resizes an image in frequency space to avoid interpolation.
scale | isotropic scaling. |
res_hi | high resolution limit. |
res_lo | low resolution limit. |
int Bimage::fspace_scale | ( | long | nn, |
vector< double > & | scale, | ||
Bimage * | pmask = NULL |
||
) |
int Bimage::fspace_scale | ( | vector< double > & | scale, |
Bimage * | pmask = NULL |
||
) |
|
inline |
int Bimage::fspace_sqrt_amp | ( | ) |
Change the amlitudes to their square roots.
int Bimage::fspace_square_amp | ( | ) |
Change the amlitudes to their squares.
Bplot * Bimage::fspace_ssnr | ( | long | nimg, |
double | res_hi, | ||
double | sampling_ratio | ||
) |
Bplot * Bimage::fspace_subset_ssnr | ( | int | subset, |
double | res_hi, | ||
double | sampling_ratio, | ||
int | flag = 0 |
||
) |
Bimage * Bimage::fspace_subset_sums | ( | int | subset, |
int | flag = 0 |
||
) |
Bimage * Bimage::fspace_sum | ( | int | shift = 0 | ) |
int Bimage::fspace_translate | ( | long | nn, |
Vector3< double > | shift | ||
) |
Translates an image in frequency space to avoid interpolation.
nn | sub-image to transform. |
shift | 3-value real space shift vector. |
int Bimage::fspace_translate | ( | Vector3< double > | shift | ) |
Translates an image in frequency space to avoid interpolation.
shift | 3-value real space shift vector. |
Weighs an image's amplitudes with the radial power spectrum of another.
*pref | reference image. |
*pmask | reciprocal space mask (0 & 1, indicating inclusion of structure factors). |
resolution | high resolution limit. |
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.
int Bimage::fspace_weigh | ( | vector< double > & | curve, |
int | flag = 0 |
||
) |
int Bimage::fspace_weigh_accumulated_dose | ( | vector< double > | dose | ) |
Weighs an image's amplitudes with the accumulated dose.
dose | array containing accumulated dose and parameters. |
The amplitudes are weighed using: 1. with 2 parameters: the formula of Grant and Grigorieff (2015). 2. with 3 parameters: exponential decay.
int Bimage::fspace_weigh_B_factor | ( | double | B, |
double | resolution = 0 |
||
) |
Weighs an image's amplitudes with B-factor (gaussian) curve.
B | B factor. |
resolution | high resolution limit. |
The image is Fourier transformed and weighed with a gaussian curve: Fnew = F*exp(-B*s2/4)
int Bimage::fspace_weigh_C_curve | ( | double | resolution = 0 | ) |
Weighs an image's amplitudes with the carbon scattering curve.
resolution | high resolution limit. |
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.
int Bimage::fspace_weigh_dose | ( | double | dose_per_frame, |
int | flag = 0 |
||
) |
Weighs an image's amplitudes with the accumulated dose.
dose_per_frame | electron dose per frame. |
flag | 0=Grant, 1=exponential decay. |
The image is Fourier transformed and the amplitudes weighed using the formula of Grant and Grigorieff (2015) or an exponential decay curve.
int Bimage::fspace_weigh_dose | ( | long | nn, |
double | dose_per_frame, | ||
vector< double > | critdose | ||
) |
int Bimage::fspace_weigh_FSC_curve | ( | Bplot * | plot, |
double | resolution = 0 |
||
) |
Weighs an image's amplitudes with a given FSC curve.
*plot | FSC plot. |
resolution | high resolution limit. |
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.
int Bimage::fspace_weigh_gaussian | ( | long | nn, |
Vector3< double > | sigma, | ||
int | dir = 0 |
||
) |
Weighs an image's amplitudes with an anisotropic Gaussian function.
nn | image index. |
sigma | Gaussian sigma values. |
dir | derivative direction: 0=none, 1=x, 2=y, 3=z. |
The image must be a complex Fourier transform. An anisotropic weight function is calculated at each voxel and applied to the transform.
int Bimage::fspace_weigh_LoG | ( | double | resolution, |
double | sigma | ||
) |
Weighs an image's amplitudes with a Laplacian-of-Gaussian function.
resolution | high resolution limit. |
sigma | gaussian sigma. |
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.
Weighs a transform with a ramp.
resolution | high resolution limit. |
axis | tilt axis for single tilt series (radians). |
planf | 2D forward Fourier transform plan. |
planb | 2D backward Fourier transform plan. |
Requirements: The data must be complex float and the FOM block must be allocated.
Weighs a transform with a ramp.
resolution | high resolution limit. |
planf | 2D forward Fourier transform plan. |
planb | 2D backward Fourier transform plan. |
Requirements: The data must be complex float and the FOM block must be allocated.
int Bimage::fspace_weigh_RPS_curve | ( | Bplot * | plot, |
double | resolution = 0 |
||
) |
Weighs an image's amplitudes with a given RPS curve.
*plot | RPS plot. |
resolution | high resolution limit. |
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.
int Bimage::gaussian_sphere | ( | long | nn, |
Vector3< double > | center, | ||
double | sigma, | ||
double | amp, | ||
bool | wrap = 0 |
||
) |
Fills a gaussian sphere within an image with a uniform value.
nn | sub-image. |
center | center of sphere. |
sigma | Gaussian sigma value. |
amp | amplitude. |
wrap | wrap around boundaries. |
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}.
void Bimage::get | ( | Bstring | tag | ) |
Prints out header information associated with a tag string.
tag | tag string. |
Recognized tags: size, ch(annel), x, y, z, im(age), sam(pling), ori(gen), view, min(imum), max(imum), av(erage), st(andard deviation), var(iance), stat(istics), text, json
double Bimage::get | ( | long | nn, |
long | xx, | ||
long | yy, | ||
long | zz, | ||
long | cc = 0 |
||
) |
Returns the data value at the given coordinates.
nn | image index. |
xx | x coordinate. |
yy | y coordinate. |
zz | z coordinate. |
cc | channel index. |
The elemental data value is returned in double precision.
double Bimage::get | ( | long | nn, |
Vector3< double > | vox, | ||
long | cc = 0 |
||
) |
Returns the data value at the given coordinates.
nn | image index. |
vox | voxel coordinates. |
cc | channel index. |
The elemental data value is returned in double precision.
|
inline |
|
inline |
Bimage * Bimage::gradient | ( | ) |
Calculates the central difference gradient image.
The central differences are calculated in the three orthogonal directions and written into 3-value vectors.
Bimage * Bimage::gradient3x3 | ( | ) |
Calculates the difference gradient image in a 3x3 kernel.
The central differences are calculated in the three orthogonal directions and written into 3-value vectors.
int Bimage::gradient_correction | ( | ) |
Calculates and corrects for a linear gradient across an image.
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.
GSgraph Bimage::graph_segment | ( | int | type = 1 , |
int | connect_type = 0 , |
||
double | complexity = 0 , |
||
long | min_size = 0 |
||
) |
Graph-based segmentation of an image.
type | segmentation type: 1=threshold, 2=statistical region merging. |
connect_type | connection type: 0=direct neighbors, 1=all neighbors. |
complexity | a value determining the number of segments. |
min_size | minimum segment size. |
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.
Converting a graph-based segmentation to an image.
g | graph segmentation. |
Converting a graph-based segmentation to a multi-level mask.
g | graph segmentation. |
GSgraph Bimage::graph_setup | ( | int | connect_type | ) |
Initializing voxels and edges for graph-based segmentation.
connect_type | connection type: 0=direct neighbors, 1=all neighbors. |
Edges are set up with 6 or 26 neighbors.
CompoundType Bimage::guess_compoundtype | ( | long | nc | ) |
int Bimage::hanning_taper | ( | double | fill = 0 | ) |
Apply Hanning taper window to the image.
fill | value of edge voxels. |
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
Calculates a set of height images from a 3D density map.
*views | linked list of views. |
threshold | density threshold to consider as object. |
A set of height images is calculated according to a list of views.
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.
helix_rise | helical subunit rise in angstrom. |
helix_angle | helical subunit rotation in radians. |
scale | scale of cross section. |
hires | high resolution limit. |
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.
double Bimage::helix_interpolate | ( | long | i, |
double | helix_rise, | ||
double | helix_angle, | ||
int | zmin, | ||
int | zmax, | ||
double | radius, | ||
int | norm_flag = 1 |
||
) |
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.
thickness | segment thickness. |
angle_start | start value for angle. |
angle_end | end value for angle. |
angle_step | step size for angle. |
bin | bin image for faster searching (limited to 1,2,3). |
hires | high resolution limit in angstroms. |
lores | low resolution limit in angstroms. |
radius | radius for mask (voxels). |
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.
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 | ||
) |
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.
helix_rise | rise per asymmetric unit (angstrom). |
helix_angle | rotation angle per asymmetric unit (radians). |
dyad_axis | dyad axis indicator: 2=dyad axis on x-axis, otherwise none. |
zmin | mimimum z slice to include. |
zmax | maximum z slice to include. |
radius | radius to do symmetrizing over (pixels). |
norm_flag | if 1, normalize |
The data between the z limits are replicated along the helical axis according to the helical rise and rotation to fill the new volume.
Bplot * Bimage::histogram | ( | long | bins | ) |
Calculates the histogram of an image.
bins | number of bins in the 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. If the postscript file name is given, a postscript plot is produced.
vector< long > Bimage::histogram | ( | long | bins, |
double & | scale, | ||
double & | offset | ||
) |
Calculates the histogram of an image.
bins | number of bins in the histogram. |
&scale | scale. |
&offset | offset. |
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.
Bplot * Bimage::histogram_counts | ( | int | flags = 0 | ) |
Finds the peaks in a quantized image from the histogram.
flags | 1=plot, 2=convert image. |
A histogram of an image with quantized data is calculated. The peaks are determined and the image converted.
vector< double > Bimage::histogram_gauss_fit | ( | long | bins, |
long | ngauss = 1 |
||
) |
Fits a gaussian function to a histogram of an image.
bins | number of bins in the histogram. |
ngauss | number of gaussians. |
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.
vector< double > Bimage::histogram_gauss_fit2 | ( | long | bins, |
long | ngauss = 1 |
||
) |
Bplot * Bimage::histogram_gauss_plot | ( | long | bins, |
long | ngauss = 1 |
||
) |
Fits a gaussian function to a histogram of an image.
bins | number of bins in the histogram. |
ngauss | number of gaussians. |
A histogram of an image is calculated with a given number of bins.
int Bimage::histogram_minmax | ( | double & | tmin, |
double & | tmax | ||
) |
Calculates minimum and maximum thresholds for truncation.
&tmin | minumum threshold. |
&tmax | maxumum threshold. |
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.
vector< double > Bimage::histogram_multi_thresholds | ( | long | bins, |
long | number | ||
) |
Calculates multiple thresholds from a histogram.
bins | number bins in histogram. |
number | number of clusters (one more than thresholds). |
Reference: PS.Liao, TS.Chen, and PC. Chung, Journal of Information Science and Engineering, vol 17, 713-727 (2001)
Bplot * Bimage::histogram_otsu_variance | ( | long | bins | ) |
Calculates the inter-set variance of the bisection of a historgram using the method of Otsu.
bins | number bins in histogram. |
Reference: NOBUYUKI OTSU, IEEE TRANSACTIONS ON SYSTEMS, MAN, AND CYBERNETICS, VOL. SMC-9, NO. 1, JANUARY 1979
Bplot * Bimage::histogram_poisson_fit | ( | long | bins, |
int | flag = 0 |
||
) |
Fits a poisson function to a histogram of an image.
bins | number of bins in the histogram. |
flag | 1=plot. |
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.
int Bimage::histomatch | ( | Bimage * | p, |
long | bins | ||
) |
Fits two images by matching the histogram of the second to the first.
*p | second image. |
bins | number of bins in the histograms. |
Both images are converted to floating point.
|
inline |
|
inline |
|
inline |
|
inline |
void Bimage::images | ( | long | nn | ) |
int Bimage::images_to_channels | ( | long | nc, |
CompoundType | ct | ||
) |
int Bimage::images_to_slices | ( | ) |
Changes the 2D images to slices in a 3D image.
int Bimage::impose_superpixels | ( | Bimage * | pmask, |
vector< Bsuperpixel > & | seg, | ||
int | impose | ||
) |
Impose superpixel features onto an image.
*pmask | mask defining superpixels. |
seg | array of superpixels. |
impose | flag to select feature |
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
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int Bimage::information | ( | ) |
Prints out header information for an image.
int Bimage::integer_interpolation | ( | int | integer_factor | ) |
int Bimage::integer_interpolation | ( | int | integer_factor, |
int | odd | ||
) |
Interpolates by an integer scale with a density-preserving overlapping kernel.
integer_factor | integer interpolation factor. |
odd | flag to ensure the dimensions are odd. |
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.
Bimage * Bimage::intensities_phase_colored | ( | double | scale | ) |
Generates a power spectrum with phases colored according to a color wheel.
scale | amplitude scaling. |
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)
Bimage * Bimage::internal_volume | ( | double | threshold | ) |
Calculates the internal volume of a shell.
threshold | threshold to define density. |
Bimage * Bimage::internal_volume | ( | double | threshold, |
int | mask_out_freq | ||
) |
Calculates the internal volume of a shell.
threshold | threshold to define density. |
mask_out_freq | mask output frequency. |
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.
cc | channel. |
xx | x location. |
yy | y location. |
zz | z location. |
nn | image number. |
fill | fill value if outside boundaries. |
Trilinear interpolation.
|
inline |
|
inline |
|
inline |
int Bimage::interpolate_gaps | ( | long | step | ) |
Interpolate the voxels that are not calculated.
step | step increment for voxels with proper values. |
Sparse voxels calculated on a regular grid with the given step size are used to fill intermediate voxels with linearly interpolated values.
|
inline |
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.
cc | channel. |
xx | x location. |
yy | y location. |
zz | z location. |
nn | image number. |
Trilinear interpolation with wrapping around periodic image boundaries.
|
inline |
|
inline |
void Bimage::inverse | ( | double | minval = 0 | ) |
Calculates the inverse of the image.
minval | the minimum absolute value considered not zero. The inverse of every pixel is calculated. If the minumum value is given as zero, zero pixels are retained. |
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.
double Bimage::kernel_average | ( | long | idx, |
long | ksize, | ||
double | tmin, | ||
double | tmax | ||
) |
Calculates the average value in a kernel.
idx | index in multi-image. |
ksize | kernel edge half size. |
tmin | miminum to exclude. |
tmax | maximum to exclude |
int Bimage::kernel_gaussian | ( | double | sigma, |
double | max | ||
) |
Generates a gaussian kernel image.
sigma | gaussian width. |
max | kernel maximum. |
|
inline |
int Bimage::kernel_laplacian_of_gaussian | ( | double | sigma, |
double | max | ||
) |
Generates a laplacian-of-gaussian kernel.
sigma | gaussian width. |
max | kernel maximum. |
|
inline |
long Bimage::kernel_max | ( | long | idx, |
long | ksize | ||
) |
Finds the highest value in a kernel.
idx | index in multi-image. |
ksize | kernel edge half size |
long Bimage::kernel_max_neigbor | ( | long | idx, |
long | ksize | ||
) |
Finds the highest value in a kernel excluding the central voxel.
idx | index in multi-image. |
ksize | kernel edge half size |
long Bimage::kernel_max_wrap | ( | long | idx, |
long | ksize | ||
) |
Finds the highest value in a kernel with wrapping.
idx | index in multi-image. |
ksize | kernel edge half size |
long Bimage::kernel_min | ( | long | idx, |
long | ksize | ||
) |
Finds the highest value in a kernel.
idx | index in multi-image. |
ksize | kernel edge half size |
double Bimage::kernel_neighbor_average | ( | long | idx, |
long | ksize | ||
) |
Finds the average of neigbor values in a kernel.
idx | index in multi-image. |
ksize | kernel edge half size. |
multimap< double, long > Bimage::kernel_order | ( | long | idx, |
long | ksize | ||
) |
Orders the values in a kernel.
idx | index in multi-image. |
ksize | kernel edge half size |
multimap< double, long > Bimage::kernel_order_neighbors | ( | long | idx, |
long | ksize | ||
) |
Orders the neigbor values in a kernel.
idx | index in multi-image. |
ksize | kernel edge half size |
double Bimage::kernel_sum | ( | long | idx, |
long | ksize | ||
) |
Calculates the sum in a kernel.
idx | index in multi-image. |
ksize | kernel edge half size. |
Bimage * Bimage::kmeans_segment | ( | long | nregion = 2 , |
long | max_iter = 10 , |
||
double | ratio = 1 |
||
) |
Segments an image based on K-means.
nregion | number of regions. |
max_iter | maximum number of iterations. |
ratio | balance between density and distance. |
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.
|
inline |
|
inline |
void Bimage::largest | ( | Bimage * | p | ) |
Selects the largest of each pixel from two images.
*p | other image. |
Extracts all the regions associated with a multi-level mask.
*pmask | multi-level mask map. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | value of edge voxels. |
The feature index is found in a feature map and the corresponding voxels in the density maps are extracted.
int Bimage::level_masked_stats | ( | Bimage * | pmask | ) |
Caclulates statistics for all the regions defined by a multi-level mask.
*pmask | multi-level mask map. |
The input data is replaced by the average for each region. A linked image is created to hold the variance for each region.
long Bimage::levelmask_add | ( | Bimage * | pmask, |
int | add_level = 1 |
||
) |
Adds a bilevel mask to a level mask.
pmask | bilevel mask to add. |
add_level | the level index to add. |
Where the bilevel mask is one, the level mask is set to given level value.
Calculates a multi-level mask to indicate asymmetric units.
*sym | symmetry structure. |
index | asu index (<1 means all). |
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.
double Bimage::levelmask_average_region_size | ( | ) |
Calculates the average size of regions in a level mask.
long Bimage::levelmask_clean | ( | ) |
Removes empty levels from a multi-level mask.
The mask is converted to an integer mask.
long Bimage::levelmask_collapse | ( | ) |
Collapse a multi-level mask to a binary mask.
All non-zero segments are converted to ones.
Bimage * Bimage::levelmask_color_by_size | ( | ) |
Color a multi-level mask based on the volumes of regions.
long Bimage::levelmask_colorize | ( | ) |
Colorizes a multi-level mask with random color assignments.
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.
long Bimage::levelmask_combine | ( | Bstring & | select_list | ) |
Combines the selected levels in a multi-level mask and renumber.
&select_list | comma_separated list of levels to select. |
The new data replaces the old data. The result is a multi-level mask where the selected levels are combined into one. Image statistics are recalculated.
long Bimage::levelmask_dilate | ( | ) |
Dilates a level mask.
Traditional 3^dim kernel dilation. Any pixel with a value of 1 turns all of its neighbors to a value of 1.
long Bimage::levelmask_dilate | ( | int | times | ) |
Dilates a level mask.
times | number of dilation operations. |
Traditional 3^dim kernel dilation. Any pixel with a value of 1 turns all of its neighbors to a value of 1.
int Bimage::levelmask_region_size | ( | ) |
Convert a mask to reflect region sizes.
long Bimage::levelmask_select | ( | Bimage * | pmask | ) |
Selects regions overlapping a mask.
pmask | overlap template mask. |
The input mask can be of any form. All non-zero parts of this mask is used.
long Bimage::levelmask_select | ( | Bstring & | select_list, |
int | flag = 0 |
||
) |
Retains the selected levels in a multi-level mask.
&select_list | comma_separated list of levels to select. |
flag | 0=binary mask, 1=multi-level mask. |
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.
long Bimage::levelmask_select | ( | long | nn, |
Vector3< long > | voxel | ||
) |
Retains the selected levels in a multi-level mask.
nn | image number. |
voxel | voxel with level to select. |
The new data replaces the old data. Image statistics are recalculated.
Bplot * Bimage::levelmask_size_histogram | ( | ) |
Color a multi-level mask based on the volumes of regions.
long Bimage::levelmask_switch | ( | long | index1, |
long | index2 | ||
) |
Switches two segments in a multi-level mask.
index1 | first index. |
index2 | second index. |
If the two indices are not found, the mask is not modified.
long Bimage::levelmask_symmetrize | ( | Bsymmetry & | sym | ) |
Symetrizes a multi-level mask.
sym | point group symmetry. |
int Bimage::limit_levels | ( | int | nlevels | ) |
Converts a full gray scale image to a limited level image.
nlevels | number of levels. |
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.
int Bimage::line | ( | Vector3< double > | start, |
Vector3< double > | end, | ||
double | width, | ||
int | fill_type = 0 , |
||
double | fill = 0 |
||
) |
Creates a line in an image and fills it with a constant value.
start | three-value start of line. |
end | three-value end of line. |
width | gaussian width of smoothing function. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
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.
int Bimage::line_powerspectra | ( | fft_plan | plan | ) |
Calculates the 1D power spectrum of each line in an image.
plan | fft plan. |
Each line is transformed to a power spectrum in place.
Linear least squares fit of two images.
*p | second image. |
*pmask | mask to limit calculation to a certain region. |
max_exclude | maximum percentage of outlying points to exclude. |
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.
Bimage * Bimage::local_filter | ( | Bimage * | pmask, |
int | mask_level, | ||
Bimage * | resmap, | ||
int | size, | ||
Vector3< long > | vedge | ||
) |
Applies a local resolution filter to a map.
*pmask | mask of areas to generate. |
mask_level | mask level. |
*resmap | local resolution map. |
size | kernel size. |
vedge | edge size. |
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.
void Bimage::logarithm | ( | ) |
Calculates the logarithm of the image data.
The image is first converted to floating point, or intensities for complex data. The logarithm is calculated to place the minmum at zero and scale it to the standard deviation: data - min new_data = log ------------- + 1 std The new data replaces the old data. Image statistics are recalculated.
long Bimage::mask | ( | Bimage * | pmask, |
double | fill | ||
) |
Masks an image.
*pmask | binary mask. |
fill | value to use where mask is zero. |
If the mask value for that pixel is 0, the image pixel is changed to the fill value. Otherwise it is left alone.
Bimage * Bimage::mask_by_conditional_thresholds | ( | vector< double > | threshold | ) |
Generates a mask based on a conditional hierarchy of thresholds.
threshold | array of gray scale levels. |
A multi-level mask is generated using the given threshold values. Image statistics are recalculated.
Bimage * Bimage::mask_by_threshold | ( | double | threshold | ) |
Generates a mask based on an image at a given threshold.
threshold | gray scale level. |
A binary mask is generated using the given threshold. Image statistics are recalculated.
Bimage * Bimage::mask_by_thresholds | ( | vector< double > | threshold | ) |
Generates a mask based on an image at given thresholds.
threshold | array of gray scale levels. |
A multi-level mask is generated using the given threshold values. Image statistics are recalculated.
long Bimage::mask_close | ( | int | times = 1 | ) |
Closes a binary mask.
times | the number of times to dilate and erode the mask. |
Closing a mask is a dilation followed by an erosion.
long Bimage::mask_combine | ( | Bimage * | p, |
int | operation | ||
) |
Combines two masks with different operations.
*p | second mask. |
operation | combining operation. |
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.
long Bimage::mask_dilate | ( | long | times = 1 | ) |
Dilates a binary mask.
times | the number of times to dilate the mask. |
Traditional 3^dim kernel dilation. Any pixel with a value of 1 turns all of its neighbors to a value of 1.
long Bimage::mask_dilate_erode | ( | unsigned char | dir | ) |
Dilates or erodes a binary mask.
dir | 0=erode, 1=dilate. |
Traditional 3^dim kernel dilation. Any pixel with a value of 1 turns all of its neighbors to a value of 1.
long Bimage::mask_erode | ( | long | times = 1 | ) |
Erodes a binary mask.
times | the number of times to erode the mask |
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.
Zeroes everything outside the mask and return the excised feature.
*pmask | mask. |
The mask must be the same size as the image.
long Bimage::mask_fill | ( | Vector3< long > | voxel | ) |
Fills an empty part of a mask indicated by the given voxel.
voxel | point from which to fill the mask. |
int Bimage::mask_fspace_banded | ( | vector< double > & | band | ) |
Generate reciprocal space mask based on a specification of bands.
&band | array of number pairs, each a shell and value. |
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.
Resizes a reciprocal space mask.
nusize | new mask size. |
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.
Matrix Bimage::mask_interface_matrix | ( | int | img_num | ) |
Calculates the interfaces between regions.
img_num | sub-image number. |
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.
long Bimage::mask_invert | ( | ) |
Inverts a mask.
The mask is assumed to be in range [0,1]. new_mask = 1 - old_mask. Image statistics of the mask are recalculated.
long Bimage::mask_merge_delete | ( | long | min_size, |
long | min_if | ||
) |
Calculates the interfaces between regions and deletes/merges small ones.
min_size | minimum size to accept regions, small ones are deleted/merged. |
min_if | minimum interface size to consider a small region connected. |
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.
long Bimage::mask_missing_cone | ( | Vector3< double > | ori, |
double | mis_ang, | ||
double | resolution | ||
) |
Generates a mask with a missing cone.
ori | image origin. |
mis_ang | cone angle from xy plane. |
resolution | high resolution limit. |
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.
Generates a missing mask from an example image.
ori | image origin. |
resolution | high resolution limit. |
mis_type | missing region type: wedge. |
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.
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.
ori | image origin. |
tilt_axis1 | tilt axis angle 1. |
tilt_axis2 | tilt axis angle 2. |
tilt_neg1 | negative tilt angle for axis 1. |
tilt_pos1 | positive tilt angle for axis 1. |
tilt_neg2 | negative tilt angle for axis 2. |
tilt_pos2 | positive tilt angle for axis 2. |
resolution | high resolution limit. |
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.
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.
ori | image origin. |
tilt_axis | tilt axis angle. |
tilt_neg | negative tilt angle. |
tilt_pos | positive tilt angle. |
resolution | high resolution limit. |
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.
long Bimage::mask_open | ( | int | times = 1 | ) |
Opens a binary mask.
times | the number of times to erode and dilate the mask. |
Opening a mask is an erosion followed by a dilation.
long Bimage::mask_pack_plane | ( | Matrix3 | mat, |
double | hi_res, | ||
double | scale | ||
) |
Packs a 2D mask into a 3D reciprocal space volume.
mat | affine orientation matrix. |
hi_res | high resolution limit. |
scale | scale. |
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.
Generates a mask on one side of a plane.
origin | any point on plane. |
normal | plane normal. |
The given image is used to generate a binary mask of the same size.
long Bimage::mask_rectangle | ( | double | length, |
double | width, | ||
double | rect_angle, | ||
int | wrap | ||
) |
Generates a mask along an axis within a 2D image.
length | length along axis (pixels). |
width | width perpendicular to axis (pixels). |
rect_angle | angle from x-axis (radians). |
wrap | flag to wrap around boundaries. |
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.
long Bimage::mask_region_interfaces | ( | int | reg_num | ) |
Reports the whole interface matrix or interfaces for one region only.
reg_num | region to report for (<0 whole interface matrix). |
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.
|
inline |
|
inline |
long Bimage::mask_split | ( | long | voxels_per_level | ) |
Converts a mask to a multilevel mask with a given number of voxels per level.
voxels_per_level | number of voxels per level. |
The new data replaces the old data. Image statistics are recalculated.
long Bimage::mask_stats | ( | ) |
Calculates statistics for a mask.
The mask can be any type, but the regions in the mask are rounded to the nearest integer for counting statistics.
long Bimage::mask_symmetrize | ( | Bsymmetry & | sym | ) |
Symetrizes a mask.
sym | point group symmetry. |
double Bimage::mass_at_threshold | ( | long | img_num, |
double | threshold, | ||
double | rho | ||
) |
Calculates the mass from the density threshold.
img_num | sub-image number (first = 0). |
threshold | density threshold. |
rho | protein density in Da/A3. |
An image is assumed to have density represented by higher (white) values.
double Bimage::mass_threshold | ( | long | img_num, |
double | mol_weight, | ||
double | rho | ||
) |
Finds the density threshold associated with a particular molecular weight.
img_num | sub-image number (first = 0,). |
mol_weight | molecular weight. |
rho | protein density in Da/A3. |
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.
int Bimage::max_in_kernel | ( | long | ksize | ) |
|
inline |
|
inline |
double Bimage::maximum_included_radius | ( | ) |
Returns the radius of the enclosed sphere or circle.
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.
int Bimage::median_bin | ( | int | binning | ) |
Bins by an integer size, selecting the kernel median.
binning | integer bin factor. |
An image is binned by an integer size, square in 2D and cubic in 3D.
double Bimage::merge_amplitudes_and_phases | ( | Bimage * | pamp | ) |
Merges the amplitudes from one map with the phases of another.
*pamp | amplitude image (simple or complex). |
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.
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.
*pref | reference Fourier transform. |
res_hi | high resolution limit. |
res_lo | low resolution limit. |
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.
|
inline |
void Bimage::meta_data_retain_one_image | ( | long | img_num | ) |
Erases all sub-image records from the meta data except one.
img_num | sub-image number. |
void Bimage::meta_data_update | ( | ) |
Update metadata from the sub-image information.
The sub-image information is encoded in the metadata in JSON format.
|
inline |
|
inline |
int Bimage::mirror | ( | ) |
Inverts/mirrors each image through its origin.
Each image in a Bimage structure is inverted.
int Bimage::moments | ( | long | max_order | ) |
Prints out moments for all sub-images.
int Bimage::moments | ( | long | max_order, |
long | nn | ||
) |
Prints out moments for one sub-image.
max_order | maximum order. |
nn | sub-image. |
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.
cols | columns in montage. |
rows | rows in montage. |
first | first slice in montage. |
skip | number of slices to skip. |
flip | flip the order of panels on: 1=x axis, 2=y axis. |
The slices of a 3D image are packed into a 2D montage. The background value for the image is used for empty regions.
Bimage * Bimage::moving_sum | ( | long | window, |
long | step = 1 , |
||
int | flag = 0 |
||
) |
Calculates a moving sum of the sub-images.
window | number of successive images to sum. |
step | intervals between windows. |
flag | if set, calculate average. |
Each successive subset of sub-images of size set by the window parameter are summed. Where the window extends beyond the limits for the number of images, the summation is just over the existing images. The number of images depends on the step size.
void Bimage::multi_channel_to_complex | ( | ) |
A multi-channel image is converted to a set of complex images.
The input image channels are written into the real part of the complex image.
void Bimage::multiply | ( | Bimage * | p | ) |
Multiplies all sub-images with the first sub-image of the other image.
*p | image multiplier. The other image is multiplied with the first. Both images are converted to floating point. |
void Bimage::multiply | ( | Bimage * | p, |
double | scale, | ||
double | shift = 0 |
||
) |
Multiplies an image with another image.
*p | image multiplier. |
scale | density scale to other image |
shift | density shift to other image. Requirement: The images must have the same size. |
void Bimage::multiply | ( | double | v | ) |
Multiplies an image with a constant value.
v | constant multiplier. |
|
inline |
void Bimage::multiply | ( | long | nn, |
Bimage * | p | ||
) |
Multiplies a sub-image with another image.
nn | sub-image to multiply. |
*p | image multiplier. Requirement: The images must have the same size. |
void Bimage::multiply | ( | long | nn, |
double | v | ||
) |
Multiplies a sub-image with a constant value.
nn | sub-image. |
v | constant multiplier. |
Bimage * Bimage::nad | ( | double | ht, |
long | zw, | ||
double | lambda, | ||
double | C, | ||
double | alpha | ||
) |
Denoises a 3D density map by non-linear anisotropic diffusion.
ht | time step size, 0 < ht <= 0.25. |
zw | slab size for piece-wise denoising. |
lambda | lamda parameter for EED. |
C | coherence parameter for CED. |
alpha | . |
The diffusion tensor is calculated with the aim of enhancing edges (EED) or planes (CED).
Bimage * Bimage::nad_2D | ( | double | ht, |
double | lambda, | ||
double | C, | ||
double | alpha | ||
) |
Denoises a 2D image by non-linear anisotropic diffusion.
ht | time step size, 0 < ht <= 0.25. |
lambda | lamda parameter for EED. |
C | coherence parameter for CED. |
alpha | . |
The diffusion tensor is calculated with the aim of enhancing edges (EED) or planes (CED).
int Bimage::noise_gaussian | ( | double | ravg = 0 , |
double | rstd = 1 |
||
) |
Generates an image with a gaussian random distribution of densities.
ravg | average. |
rstd | standard deviation. |
The image is populated 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.
int Bimage::noise_gaussian_distance | ( | long | number, |
double | stdev | ||
) |
Generates an image based on a gaussian random distribution of distances.
number | number of hits to place |
stdev | standard deviation. |
The image is populated with single hits at distances with a uniform random distrubution within the image boundaries. Statistics are calculated before returning.
int Bimage::noise_logistical | ( | double | ravg, |
double | rstd | ||
) |
Generates an image with a gaussian random distribution of densities.
ravg | average. |
rstd | standard deviation. |
The image is populated 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.
int Bimage::noise_poisson | ( | double | ravg | ) |
Generates an image with a poisson random distribution of densities.
ravg | average. |
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.
int Bimage::noise_spectral | ( | double | alpha | ) |
Generates a noise map with a defined spectral decay.
alpha | spectral decay. |
Uniform random phases are generated and the amplitudes are set to: amp = s^(-alpha/2).
int Bimage::noise_uniform | ( | double | rmin, |
double | rmax | ||
) |
Generates an image with a uniform random distribution of densities.
rmin | minimum density value. |
rmax | maximum density value. |
The image is populated 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.
int Bimage::noise_uniform_distance | ( | long | number | ) |
Generates an image based on a uniform random distribution of distances.
number | number of hits to place |
The image is populated with single hits at distances with a uniform random distrubution within the image boundaries. Statistics are calculated before returning.
int Bimage::normalize | ( | double | average, |
double | stdev, | ||
int | norm_type | ||
) |
Normalizes a set of images to a desired average and standard deviation.
average | desired average. |
stdev | desired standard deviation (if 0, use defaults). |
norm_type | type of determining the effective average and standard deviation: 0=simple, 1=Gaussian, 2=Poisson. |
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.
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.
imgnum | sub-image number. |
average | desired average. |
stdev | desired standard deviation (if 0, use defaults). |
norm_type | type of determining the effective average and standard deviation: 0=simple, 1=Gaussian, 2=Poisson. |
bins | number of histogram bins required to fit distributions. |
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.
int Bimage::normalize_local | ( | long | kernel_size | ) |
Normalizes by subtracting local average and dividing by local standard deviation.
kernel_size | size of kernel edge. |
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.
int Bimage::normalize_local | ( | Vector3< long > | kernel | ) |
Normalizes by subtracting local average and dividing by local standard deviation.
kernel | size of kernel edge. |
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.
int Bimage::one_color | ( | int | color, |
double | cmin, | ||
double | cmax, | ||
int | flag = 0 |
||
) |
Converts a gray-scale image to a single color.
color | color selection (0=red, 1=green, 2=blue). |
cmin | lower grayscale boundary. |
cmax | upper grayscale boundary. |
flag | sets the type of conversion. |
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
Adds two images together, adjusting for size difference.
&p | image to add. |
The second image is added to the first: image1 = image1 + image2*scale + shift The resultant image size is the bigger of the two.
Assigns an image.
The internal copy function is called.
double Bimage::operator[] | ( | long | j | ) | const |
Returns the data value at the given index.
j | index. |
The elemental data value is returned in double precision.
|
inline |
int Bimage::opposite_ewald | ( | ) |
Calculates multiple copies oriented according to views.
views | orientations for new images. |
Each image in a Bimage structure is rotated to the corresponding view.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Bimage * Bimage::orthogonal_montage | ( | Vector3< long > | voxel, |
Vector3< long > | ext_size, | ||
int | pad = 0 , |
||
int | fill_type = 0 , |
||
double | fill = 0 |
||
) |
Extracts orthogonal views around a voxel and create a montage.
voxel | voxel of intersection. |
ext_size | size of slices to extract. |
pad | padding size. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
Only the desired region is extracted from the original image. The fill value is taken from the image background.
Extracts orthogonal views around a voxel.
nn | image number to extract. |
voxel | voxel of intersection. |
ext_size | size of slices to extract. |
Only the desired region is extracted from the original image. The fill value is taken from the image background.
double Bimage::otsu_threshold | ( | long | bins | ) |
Calculates the threshold from a histogram according to Otsu.
bins | number bins in histogram. |
Reference: NOBUYUKI OTSU, IEEE TRANSACTIONS ON SYSTEMS, MAN, AND CYBERNETICS, VOL. SMC-9, NO. 1, JANUARY 1979
vector< double > Bimage::otsu_variance | ( | vector< long > | h | ) |
Calculates the inter-set variance of the bisection of a historgram using the method of Otsu.
h | histogram. |
Reference: NOBUYUKI OTSU, IEEE TRANSACTIONS ON SYSTEMS, MAN, AND CYBERNETICS, VOL. SMC-9, NO. 1, JANUARY 1979
int Bimage::pack_transform | ( | int | img_select, |
unsigned char * | data, | ||
FourierType | tf | ||
) |
int Bimage::pack_transform | ( | unsigned char * | data, |
FourierType | tf | ||
) |
Packs two real images into one complex image.
*p | second image. |
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.
int Bimage::pad | ( | long | sz, |
int | fill_type = 0 , |
||
double | fill = 0 |
||
) |
Pads an image to a new size with a given fill value.
sz | new size. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | value to use when padding the 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.
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.
sz | new size. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | value to use when padding the 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.
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.
sz | new size. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | value to use when padding the 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.
Pads an image to a new size with a given fill value.
sz | new size. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | value to use when padding the 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.
|
inline |
|
inline |
|
inline |
|
inline |
double Bimage::peak_sigma | ( | long | nn, |
Vector3< long > | coor, | ||
long | kernel_size | ||
) |
Calculates a sigma value for a cross-correlation peak.
nn | sub-image. |
coor | coordinates in the image. |
kernel_size | kernel size to fit the gaussian. |
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)))
Bplot * Bimage::percentiles | ( | ) |
Calculates the percentiles from the histogram of an image.
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.
Calculates an average within a periodic frame.
period | size of periodic frame. |
void Bimage::phase_add | ( | double | v | ) |
Adds a constant value to a phase image and wraps as necssary.
v | constant to be added. |
int Bimage::phase_colour_wheel | ( | ) |
Generates a phase color wheel.
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.
Calculates a phase correlation map by Fast Fourier transformation.
*p | second image. |
hires | high resolution limit. |
lores | low resolution limit. |
*pmask | binary mask (only 0 and 1), NULL if not desired. |
FFTW library (www.fftw.org). Two equally sized multi-image 1D, 2D and 3D real space data sets are packed into a complex data set and transformed forward. The transform is unpacked before the first transform is multiplied with the complex conjugate of the second transform. This is then back-transformed to obtain the phase correlation map in real space. The low resolution limit can be 0, in which case no limits are applied. The resultant phase correlation image data type is floating point.
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.
*p | real space reference image. |
type | 0=phase angle difference, 1=phase angle sum, 2=cos(angle), 4=scale by amplitude product |
res_hi | upper resolution limit. |
res_lo | lower resolution limit. |
Both images are Fourier transformed and the cosine of the phase difference calculated.
int Bimage::phase_flip | ( | Bimage * | pd | ) |
Flips the phases of an image based on a phase difference map.
*pd | reciprocal space phase difference map. |
int Bimage::phase_shift | ( | long | nn, |
Vector3< double > | shift | ||
) |
Phase shifts a complex sub-image.
nn | sub-image to transform. |
shift | three-value real space shift vector. |
A real space translation with wrapping is equivalent to phase shifting in reciprocal space.
int Bimage::phase_shift | ( | Vector3< double > | shift | ) |
Phase shifts a complex image.
shift | three-value real space shift vector. |
A real space translation with wrapping is equivalent to phase shifting in reciprocal space.
int Bimage::phase_shift_to_center | ( | ) |
Phase shifts a set of reflections to the nominal center of the image origin.
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.
int Bimage::phase_shift_to_origin | ( | ) |
Phase shifts a set of reflections to the image origin.
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.
void Bimage::phase_to_complex | ( | ) |
A phase image is converted to a complex image.
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.
nn | sub-image. |
*p | image to place. |
loc | location in large image of small image origin. |
radius | radial mask to transfer small image. |
scale | density scale to apply to second image. |
shift | density shift to apply to second image. |
operation | operation to apply. |
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.
int Bimage::place_central_part | ( | Bimage * | p, |
long | nn | ||
) |
Packs a tile into a new composite image, retaining only the central part.
*p | image = tiles. |
nn | tile image (can be a sub-image). |
The overlaps between tiles are divided between the neighboring tiles. The tile placement is in the sub-image origins.
int Bimage::place_with_addition | ( | Bimage * | p, |
long | nn | ||
) |
Packs a tile into a new composite image with addition within overlap.
*p | image = tiles. |
nn | tile image (can be a sub-image). |
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.
int Bimage::place_with_overlap | ( | Bimage * | p, |
long | nn | ||
) |
Packs a tile into a new composite image with weighted overlap.
*p | image = tiles. |
nn | tile image (can be a sub-image). |
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.
Bplot * Bimage::plot | ( | ) |
Converts a one-dimensional image into a plot.
Each image generates one plot with each channel converted to a curve.
double Bimage::poisson_statistics_check | ( | ) |
Checks whether the statistics conform to a Poisson distribution.
A warning is issued when the variance/average differs more than 5% from one.
Bimage * Bimage::polar_power_spectrum | ( | double | resolution, |
long | num_angle | ||
) |
Calculates the polar power spectrum of a 2D transform amplitude or intensity image.
resolution | high resolution limit. |
num_angle | number of angles to use for interpolation. |
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.
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.
nangles | number of angles in each annulus. |
ann_min | minimum annulus (pixels). |
ann_max | maximum annulus (pixels). |
dann | width of annulus (pixels). |
zmin | minimum z (pixels). |
zmax | maximum z (pixels). |
zinc | increment in z (pixels). |
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.
void Bimage::power | ( | double | v | ) |
Calculates the power of an image.
v | power value. |
int Bimage::power_spectrum | ( | int | flags = 0 | ) |
Calculates a power spectrum.
flags | 1=norm, 2=avg, 4=shift, 8=log. |
All the sub-images are Fourier transformed. The flags variable controls options based on 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 16 do edge smoothing to get rid of the cross artifact 32 fix peaks on the horizontal zero-line 64 fix peaks on the vertical zero-line
vector< double > Bimage::powerspectrum_isotropy | ( | long | n, |
double & | lores, | ||
double & | hires | ||
) |
Calculates a measure of anisotropy in a power spectrum.
n | sub-image number. |
&lores | low resolution limit. |
&hires | high resolution limit |
Prepares a tiled power spectrum from an image for determining CTF parameters.
img_num | sub-image to transform. |
tile_size | tile size (if (0,0,0) don't tile). |
flags | 1=norm, 2=avg, 4=shift, 8=log. |
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
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.
tile_size | tile size (if (0,0,0) don't tile). |
tilt_axis | tilt axis angle (in radians). |
tilt_angle | tilt angle (in radians). |
tilt_offset | offset perpendicular to tilt axis (in pixels). |
defocus | average defocus to adjust for change in focus. |
iCL2 | inverse of product of spherical aberration and wavelenght squared. |
flags | 1=norm, 2=avg, 4=shift, 8=log, 16=add. |
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
Bimage * Bimage::powerspectrum_tiled_exact | ( | long | img_num, |
Vector3< long > | tile_size, | ||
int | flags = 0 |
||
) |
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.
img_num | sub-image to transform. |
tile_size | tile size (if (0,0,0) don't tile). |
tilt_axis | tilt axis angle (in radians). |
tilt_offset | offset perpendicular to tilt axis (in pixels). |
flags | 1=norm, 2=avg, 4=shift, 8=log. |
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
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.
img_num | sub-image to transform. |
tile_size | tile size (if (0,0,0) don't tile). |
tilt_axis | tilt axis angle (in radians). |
tilt_angle | tilt angle (in radians). |
defocus | average defocus to adjust for change in focus. |
iCL2 | inverse of product of spherical aberration and wavelenght squared. |
flags | 1=norm, 2=avg, 4=shift, 8=log. |
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
vector< double > Bimage::pps_angular_correlation | ( | Bimage * | pref, |
double | res_hi, | ||
double | res_lo, | ||
long | nang, | ||
fft_plan | planf | ||
) |
void Bimage::progressive_sum | ( | ) |
Progressive sum of the sub-images.
Each sub-image is summed with all previous sub-images.
Bimage * Bimage::project | ( | char | axis, |
int | flags = 1 |
||
) |
Projects a 3D image to a 2D image down one of the three major axes.
axis | axis of projection. |
flags | 1=scale projection, 2=minimum, 4=maximum. |
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.
Bimage * Bimage::project | ( | View * | view, |
double | resolution, | ||
FSI_Kernel * | kernel, | ||
double | wavelength = 0 , |
||
bool | back = 1 , |
||
ComplexConversion | conv = NoConversion |
||
) |
Calculates a set of projections as central sections from a 3D fourier transform.
*view | linked list of views. |
resolution | high resolution limit. |
*kernel | frequency space interpolation kernel. |
wavelength | for Ewald sphere projection, default zero, ± for front or back curvature. |
back | flag to backtransform the projections. |
conv | conversion type. |
The map is Fourier transformed and shifted to its phase origin. For each view, a central section or Ewald sphere projection is calculated using reciprocal space interpolation. All the projections are phase shifted to a central origin. The projections may be back-transformed to real space as specified by the back flag. The image is converted as specified by the conversion flag: 0 no conversion. 1 real. 2 imaginary. 3 amplitude. 4 intensity.
Calculates a set of projections from a 3D density map.
*view | linked list of views. |
norm_flag | flag to normalize projection. |
A set of projections is calculated according to a list of views.
int Bimage::pure_color | ( | ) |
Generates a pure color image without intensity.
Pure color is defined as: col col = -------- sum(col)
int Bimage::quadric | ( | double * | param | ) |
Generates a quadric surface over the whole image.
param | 7-value array of parameters. |
int Bimage::quadric_correct | ( | vector< double > | param | ) |
Corrects for a quadric surface.
param | 7-value array of parameters. |
vector< double > Bimage::quadric_fit | ( | ) |
Fits the whole image to a quadric surface.
A quadric surface is defined as: v = a0 + a1*dx + a2*dy + a3*dz + a4*dx^2 + a5*dy^2 + a6*dz^2
|
inline |
double Bimage::R_factor | ( | Bimage * | p | ) |
Calculates an R factor between two images.
*p | second image. |
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.
Calculates the radial average of an image.
minrad | minimum radius in voxels. |
maxrad | maximum radius in voxels. |
rad_step | step size in voxels. |
*pmask | mask to limit calculation. |
wrap | flag to wrap the data. |
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.
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.
minrad | minimum radius in voxels. |
maxrad | maximum radius in voxels. |
rad_step | step size in voxels. |
ellipticity | ratio of major and minor axes. |
angle | angle of major axis. |
*pmask | mask to limit calculation. |
wrap | flag to wrap the data. |
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.
Bimage * Bimage::radial | ( | long | minrad, |
long | maxrad, | ||
double | rad_step = 1 , |
||
int | wrap = 0 |
||
) |
Calculates the radial average of an image.
minrad | minimum radius in voxels. |
maxrad | maximum radius in voxels. |
rad_step | step size in voxels. |
wrap | flag to wrap the data. |
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.
Bimage * Bimage::radial_coverage | ( | double | threshold, |
double | rad_step = 1 |
||
) |
Calculates the coverage in each radial shell.
threshold | density threshold to distinguish for- and background. |
rad_step | radial step size (voxels). |
double * Bimage::radial_fit | ( | Bimage * | pref | ) |
Fits a radial profile to a reference radial profile.
*pref | reference radial profile as a 1D image. |
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.
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.
rad_start | starting radius (voxels). |
rad_end | ending radius (voxels). |
rad_step | radial step size (voxels). |
spherical_fraction | fraction of spherical section (requires symmetry). |
*sym | symmetry for non-spherical sections. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | value to fill in excluded regions. |
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.
int Bimage::radial_shells | ( | ) |
Calculates an image with slices representing radial shell projections.
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.
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.
rad_start | minimum radius in voxels. |
rad_end | maximum radius in voxels. |
rad_step | step size in voxels. |
spherical_fraction | ratio of major and minor axes. |
*sym | point group symmetry. |
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.
Generates a full 2D or 3D image from a radial profile in a 1D image.
nusize | size of image to expand to. |
origin | origin for radial profile. |
It assumes the resultant image is square or cubic.
unsigned char * Bimage::read_data | ( | ifstream * | fimg, |
int | img_select, | ||
int | sb, | ||
int | vax, | ||
long | pad | ||
) |
Read image data in a generalized style.
*fimg | file descriptor: file opened in calling function. |
img_select | image selection: if -1, all images, if >= 0, one image. |
sb | flag activates byte swapping. |
vax | indicate vax style floating point - activates conversion. |
pad | any interspersed control or separation bytes. |
|
inline |
|
inline |
|
inline |
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.
red_min | beginning of red gradient (most negative). |
white_min | end of red gradient (fade into white). |
white_max | beginning of blue gradient (start with white). |
blue_max | end of blue gradient (most positive) |
A grayscale image is converted to RGB and colored with blue positive, red negative, and white in between.
int Bimage::refine_peak | ( | ) |
Refines the position of a peak to sub-voxel resolution.
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). The image origin is modified to reflect the shift in pixels.
int Bimage::refine_peak | ( | long | kernel_size | ) |
Refines the position of a peak to sub-voxel resolution.
kernel_size | edge length of kernel. |
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). The image origin is modified to reflect the peak position in pixels.
int Bimage::refine_peak_new | ( | ) |
Refines the position of a peak to sub-voxel resolution.
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).
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.
*pmask | a mask holding region assignments. |
idx | the first voxel of a region. |
region_number | the region number that voxels are assigned. |
threshold | the level to define background. |
sign | sign controlling direction of thresholding. |
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.
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.
*pmask | region map (if NULL, generate from high threshold). |
threshold_hi | the level to pick initial regions. |
threshold_lo | the lowest level to include voxels in regions. |
threshold_step | the incremental change in threshold. |
fill_borders | flag to assign borders between regions (default not). |
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).
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.
kernel_size | size of kernel to determine peaks. |
threshold | the lowest level to include voxels in regions. |
flood | flag to flood to the threshold. |
wrap | flag to wrap the kernel around image boundaries. |
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.
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.
threshold_first | the level to pick initial regions. |
threshold_last | the lowest level to include voxels in regions. |
threshold_step | the incremental change in threshold. |
Bimage * Bimage::regions | ( | double | threshold, |
int | sign | ||
) |
Segments an image into contiguous regions.
threshold | the level at which things are ignored. |
sign | sign controlling direction of thresholding. |
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.
double Bimage::relative_density | ( | Bimage * | pmask | ) |
Calculates the relative density in a region defined by a mask.
*pmask | a 4 level mask. |
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
int Bimage::replace | ( | Bimage * | img | ) |
Replaces the data with that from the given image.
*img | source image. |
The input image must be the same size as the receiving image.
int Bimage::replace | ( | long | nn, |
Bimage * | img, | ||
long | nr, | ||
double | fill | ||
) |
Replaces one sub-image in an image structure.
nn | image number to replace. |
*img | source image. |
nr | source sub-image number. |
fill | fill vlue. |
The input image may have a different size as the receiving image.
int Bimage::replace | ( | long | nn, |
Bimage * | img, | ||
long | nr = 0 |
||
) |
Replaces one sub-image in an image structure.
nn | image number to replace. |
*img | source image. |
nr | source sub-image number. |
The input image must be the same size as the receiving image.
int Bimage::replace_half | ( | Bimage * | p | ) |
Replaces values for >x/2 with the given image.
*p | second image. |
long Bimage::replace_maxima | ( | double | threshold | ) |
Replaces maxima above a threshold using local averages.
threshold | threshold. |
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.
int Bimage::replicate_asymmetric_unit | ( | Bsymmetry & | sym | ) |
Calculates a full map from one asymmetric unit.
*sym | symmetry structure. |
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.
int Bimage::rescale | ( | double | scale, |
double | shift | ||
) |
Rescales the image data with a given multiplier and offset.
scale | multiplier. |
shift | addition or offset. |
The new data is calculated as: new_datum = datum*scale + shift The new data replaces the old data. Image statistics are recalculated.
int Bimage::rescale | ( | long | nn, |
double | scale, | ||
double | shift | ||
) |
Rescales the image data with a given multiplier and offset.
nn | sub-image. |
scale | multiplier. |
shift | addition or offset. |
Requirement: The images must have the same size.
int Bimage::rescale_to_avg_std | ( | double | nuavg, |
double | nustd | ||
) |
Rescales the image data to a given average and standard deviation.
nuavg | new average. |
nustd | new standard deviation. |
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.
int Bimage::rescale_to_avg_std | ( | double | nuavg, |
double | nustd, | ||
Bimage * | pmask | ||
) |
Rescales the image data to a given average and standard deviation.
nuavg | new average. |
nustd | new standard deviation. |
*pmask | statistical calculations limited to the masked region. |
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.
int Bimage::rescale_to_avg_std | ( | long | nn, |
double | nuavg, | ||
double | nustd | ||
) |
Rescales the image data to a given average and standard deviation.
nn | sub-image. |
nuavg | new average. |
nustd | new standard deviation. |
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.
int Bimage::rescale_to_min_max | ( | double | numin, |
double | numax | ||
) |
Rescales the image data to a given minimum and maximum.
numin | new minimum. |
numax | new maximum. |
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.
int Bimage::rescale_to_min_max | ( | long | nn, |
double | numin, | ||
double | numax | ||
) |
Rescales the image data to a given minimum and maximum.
nn | sub-image. |
numin | new minimum. |
numax | new maximum. |
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.
int Bimage::resize | ( | Vector3< long > | nusize, |
Vector3< long > | translate, | ||
int | fill_type = 0 , |
||
double | fill = 0 |
||
) |
Resizes without interpolation or rescaling.
nusize | new image size three-value vector. |
translate | three-value translation vector. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER |
fill | value to fill in new regions. |
An image is resized with translation and filling of new regions with a given value.
Bimage * Bimage::resize_copy | ( | Vector3< long > | nusize, |
Vector3< long > | translate, | ||
int | fill_type = 0 , |
||
double | fill = 0 |
||
) |
Resizes without interpolation or rescaling.
nusize | new image size three-value vector. |
translate | three-value translation vector. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER |
fill | value to fill in new regions. |
An image is resized with translation and filling of new regions with a given value.
Resizes without interpolation or rescaling.
nusize | new image size three-value vector. |
translate | three-value translation vector. |
An image is resized with translation and filling of new regions with a given value.
Resizes with wrapping without interpolation or rescaling.
nusize | new image size three-value vector. |
translate | three-value translation vector. |
An image is resized with translation and filling of new regions with a given value.
void Bimage::reslice | ( | Bstring | order | ) |
Switches axes of an image.
order | string encoding the reslicing order. Reslicing refers to switching the axes of a multidimensional image. The equivalent is rotation around angles that are multiples of pi/2. The reslicing is encoded as a string of x, y and z, with the order and sign indicating the type of reslicing to be done. The new data replaces the old data. |
|
inline |
RGB< double > Bimage::rgb | ( | long | j | ) |
Returns a color value at the given index.
j | index. |
The index refers to compound values.
void Bimage::rgb_to_rgba | ( | ) |
An alpha channel is added to a RGB color image.
The alpha channel value is set to 255.
RGBA< double > Bimage::rgba | ( | long | j | ) |
Returns a color value at the given index.
The index refers to compound values.
j | index. |
void Bimage::rgba_to_rgb | ( | ) |
The alpha channel is delete from an RGBA color image.
int Bimage::rotate | ( | ) |
Rotates an image using parameters defined in the image in place.
The image is rotated according to the view and origin encoded for the sub-image.
int Bimage::rotate | ( | double | angle | ) |
Rotates an image around the z-axis by the given angle in place.
angle | rotation angle in radians. |
The image is rotated according to the axis and angle given.
int Bimage::rotate | ( | Matrix3 | mat | ) |
Rotates an image using the specified matrix.
mat | 3x3 rotation matrix. |
An image is rotated according to the input matrix. The input image origin is the rotation center.
int Bimage::rotate | ( | Vector3< double > | axis, |
double | angle | ||
) |
Rotates an image using an axis and angle in place.
axis | 3-value rotation axis. |
angle | rotation angle in radians. |
The image is rotated according to the axis and angle given.
Rotates an image using the specified shift and matrix.
translate | translation after rotation. |
mat | 3x3 rotation matrix. |
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.
Rotates an image to a specified view in place.
translate | translation after rotation. |
*view | view vector and angle. |
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.
Rotates an image using parameters defined in the image.
nusize | 3-value new image size. |
The image is rotated according to the view and origin encoded for the sub-image.
Rotates an image around the z-axis by the given angle.
nusize | 3-value new image size. |
angle | rotation angle in radians. |
The image is rotated according to the axis and angle given.
Rotates an image using the specified matrix.
nusize | new image size. |
mat | 3x3 rotation matrix. |
An image is rotated according to the input matrix. The input image origin is the rotation center.
Rotates an image using an axis and angle.
nusize | 3-value new image size. |
axis | 3-value rotation axis. |
angle | rotation angle in radians. |
The image is rotated according to the axis and angle given.
Rotates an image to a specified view.
nusize | 3-value new image size. |
translate | translation after rotation. |
*view | view vector and angle. |
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.
Rotates an image to a specified view.
nusize | 3-value new image size. |
*view | view vector and angle. |
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.
int Bimage::rotate | ( | View | view | ) |
Rotates an image to a specified view in place.
*view | view vector and angle. |
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.
Rotates an image to a specified view and adds it to another image.
*p | the image to rotate and add (modified). |
origin | origin in input image. |
*view | view vector and angle. |
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.
double Bimage::rotate_correlate | ( | Vector3< double > | axis, |
double | angle | ||
) |
Rotates a copy of an image and correlates it with the original.
axis | rotation axis. |
angle | rotation angle. |
This mainly used to determine the symmetry of a map.
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 | ||
) |
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 | ||
) |
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.
mat | rotation matrix. |
hires | high resolution limit in angstroms. |
lores | low resolution limit in angstroms. |
radius | search radius. |
sigma | soften search radius cutoff. |
refine_flag | refine shift. |
planf | forward Fourier transform plan. |
planb | backward Fourier transform plan.k |
&cc | correlation coefficient |
The point group symmetry operations are applied to an image with an orientation defined by the reference symmetry axis (default {0,0,1}).
Rotates a 3D map and calculates the height along the z-axis.
mat | 3x3 rotation or skewing matrix. |
translate | 3-value vector for translation after transformation. |
threshold | density threshold to consider as object. |
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.
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.
mat | 3x3 rotation or skewing matrix. |
translate | 3-value vector for translation after transformation. |
radial_cutoff | spherical cutoff to apply. |
norm_flag | flag to normalize projection. |
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.
long Bimage::rotate_to_axis | ( | Bsymmetry & | sym, |
long | axis, | ||
long | axis_flag | ||
) |
Rotates to a symmetry axis.
*sym | symmetry structure. |
axis | desired symmetry axis order. |
axis_flag | view modifier. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
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.
pref | reference/template image. |
pmask | mask to limit correlation calculation (can be NULL). |
scalemin | minimum scaling to start search. |
scalemax | maximum scaling to end search. |
step | scaling search step size. |
Scales and image to the given reference, searching for the correct scale.
pref | reference/template image. |
pmask | mask to limit correlation calculation (can be NULL). |
Scales and image to the given reference.
pref | reference/template image. |
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.
helix_rise | rise per asymmetric unit (angstrom). |
helix_angle | rotation angle per asymmetric unit (radians). |
seam_shift | translation along the seam (subunit height units). |
dyad_axis | dyad axis indicator: 2=dyad axis on x-axis, otherwise none. |
zmin | mimimum z slice to include. |
zmax | maximum z slice to include. |
radius | radius to do symmetrizing over (pixels). |
norm_flag | if 1, normalize |
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.
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.
*ptemp | the template to be searched for. |
*views | list of views to search. |
hires | high resolution limit. |
lores | low resolution limit. |
search_radius | radius for shift search. |
*pmask | mask for cross-correlation (ignored if NULL). |
&currview | best current view to return. |
&currshift | best current shift to return. |
The template is rotated and cross-correlated to find the best fit. The views must be calculated externally to allow for custom sets.
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.
*ptemp | the template to be searched for. |
*view | views. |
alpha | rotation around view vector, <0 = use 2*PI (radians). |
alpha_step | angular step size around view vector (radians). |
hires | high resolution limit. |
lores | low resolution limit. |
*pmask | mask for cross-correlation (ignored if NULL). |
threshold | threshold value, if 0, threshold = FOMmax/2. |
The template is rotated and cross-correlated to find the best fit. The views must be calculated externally to allow for custom sets.
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.
*ptemp | the template to be searched for. |
view | view. |
hires | high resolution limit. |
lores | low resolution limit. |
*pmask | mask for cross-correlation (ignored if NULL). |
threshold | threshold value, if 0, threshold = FOMmax/2. |
*pfit | view image with FOM block to hold results. |
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.
long Bimage::select_images | ( | Bstring | list | ) |
void Bimage::set | ( | long | j, |
CMYK< double > | color | ||
) |
Sets a color value at the given index.
j | index. |
color | color value. The index refers to compound values. |
void Bimage::set | ( | long | j, |
Complex< double > | cv | ||
) |
Sets a complex value at the given index.
j | index. |
cv | complex value. The index refers to compound values. |
void Bimage::set | ( | long | j, |
double | v | ||
) |
Sets a single value at the given index.
j | index. |
v | value. |
void Bimage::set | ( | long | j, |
RGB< double > | color | ||
) |
Sets a color value at the given index.
j | index. |
color | color value. The index refers to compound values. |
void Bimage::set | ( | long | j, |
RGBA< double > | color | ||
) |
Sets a color value at the given index.
j | index. |
color | color value. The index refers to compound values. |
void Bimage::set | ( | long | j, |
Vector3< double > | vec | ||
) |
Sets a 3-value vector at the given index.
j | index. |
vec | 3-value vector. The index refers to compound values. |
void Bimage::set | ( | long | j, |
View | view | ||
) |
Sets a 3-value vector at the given index.
j | index. |
view | 4-value view. The index refers to compound values. |
void Bimage::set_hi_lo_resolution | ( | double & | hi, |
double & | lo | ||
) |
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.
xx | x location. |
yy | y location. |
zz | z location. |
nn | image number (4 th dimension). |
v | value to assess and set. All neighboring voxels are checked and set to the given value if it is larger. |
long Bimage::set_subset_selection | ( | Bstring | list | ) |
Sets the sub-image selections based on a list.
list | list of sub-images to select. |
The data is not altered.
|
inline |
|
inline |
int Bimage::shape | ( | int | type, |
Vector3< long > | rect, | ||
Vector3< double > | start, | ||
double | width, | ||
int | fill_type = 0 , |
||
double | fill = 0 , |
||
bool | wrap = 0 |
||
) |
Creates a shape in an image and fills it with a constant value.
type | type of shape: 0=rectangle, 1=oval, 2=cylinder |
rect | three-value size of the area to be filled. |
start | three-value start of area. |
width | gaussian width of smoothing function. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
wrap | wrap around boundaries (default not). |
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.
int Bimage::shape | ( | long | nn, |
int | type, | ||
Vector3< long > | rect, | ||
Vector3< double > | start, | ||
double | width, | ||
int | fill_type = 0 , |
||
double | fill = 0 , |
||
bool | wrap = 0 |
||
) |
Creates a shape in an image and fills it with a constant value.
type | type of edge: 0=rectangle, 1=oval, 2=cylinder |
nn | sub-image. |
rect | three-value size of the area to be filled. |
start | three-value start of area. |
width | gaussian width of smoothing function. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
wrap | wrap around boundaries (default not). |
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.
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.
nn | sub-image. |
center | center of shell. |
minrad | minimum radius of shell. |
maxrad | maximum radius of shell. |
width | gaussian width of smoothing function. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
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}.
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.
center | center of shell. |
minrad | minimum radius of shell. |
maxrad | maximum radius of shell. |
width | gaussian width of smoothing function. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
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}.
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.
nn | sub-image. |
center | center of shell. |
minrad | minimum radius of shell. |
maxrad | maximum radius of shell. |
width | gaussian width of smoothing function. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
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}.
int Bimage::shell_wrap | ( | Vector3< double > | center, |
double | minrad, | ||
double | maxrad, | ||
double | width, | ||
int | fill_type, | ||
double | fill | ||
) |
Fills a shell within an image with a uniform value.
center | center of shell. |
minrad | minimum radius of shell. |
maxrad | maximum radius of shell. |
width | gaussian width of smoothing function. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
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}.
int Bimage::shift | ( | long | nn, |
Vector3< double > | vec, | ||
int | fill_type = 0 , |
||
double | fill = 0 |
||
) |
Shifts one sub-image.
nn | sub-image. |
vec | 3-value real space shift vector. |
fill_type | fill type for filling empty regions. |
fill | value to fill in empty regions. |
int Bimage::shift | ( | Vector3< double > | vec, |
int | fill_type = 0 , |
||
double | fill = 0 |
||
) |
Shifts an image.
vec | 3-value real space shift vector. |
fill_type | fill type for filling empty regions. |
fill | value to fill in empty regions. |
int Bimage::shift_background | ( | double | bkg | ) |
Sets the background for each sub-image to a given value.
bkg | new background value. |
The background is taken as the average of the values outside the circle or sphere enclosed by the image.
int Bimage::shift_wrap | ( | long | nn, |
Vector3< double > | vec | ||
) |
Shifts one sub-image with wrapping.
nn | sub-image. |
vec | 3-value real space shift vector. |
int Bimage::shift_wrap | ( | Vector3< double > | vec | ) |
Shifts an image.
vec | 3-value real space shift vector. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Shrinks an image to a new size with wrapping of the excluded edges.
nusize | new image size three-value vector. |
translate | three-value translation vector. |
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.
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.
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).
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.
void Bimage::sine | ( | ) |
Calculates the sine of a phase image.
The values must be in radians.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int Bimage::slices_to_images | ( | ) |
Changes the slices in a 3D image into a set of 2D images.
void Bimage::smallest | ( | Bimage * | p | ) |
Selects the smallest of each pixel from two images.
*p | other image. |
double Bimage::snvariance | ( | double | snradius | ) |
Calculates the ratio of variance inside and outside a given radius.
snradius | radius of signal. |
The region outside the radial limit is considered noise and the region inside is considered signal plus noise.
|
inline |
|
inline |
int Bimage::sphere | ( | Vector3< double > | center, |
double | radius, | ||
double | width = 0 , |
||
int | fill_type = 0 , |
||
double | fill = 0 , |
||
bool | wrap = 0 |
||
) |
Fills a sphere within an image with a uniform value.
center | three vector center of sphere. |
radius | sphere radius. |
width | gaussian width of smoothing function. |
fill_type | FILL_AVERAGE, FILL_BACKGROUND, FILL_USER. |
fill | fill value. |
wrap | wrap around boundaries (default not). |
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}.
Bimage * Bimage::split_channels | ( | ) |
Splits the channels into individual sub-images.
The channels are converted to successive sets of images.
Bimage * Bimage::split_channels_to_images | ( | ) |
Splits the channels into individual images in a linked list.
Each channels is converted to a separate image in the list.
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.
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.
|
inline |
|
inline |
long Bimage::statistics | ( | ) |
Calculates the statistics for an image.
long Bimage::statistics | ( | Bimage * | pmask, |
double & | regavg, | ||
double & | regstd | ||
) |
Calculates the statistics for a region in an image.
*pmask | region. |
®avg | region average to be calculated. |
®std | region standard deviation to be calculated. |
long Bimage::statistics | ( | long | img_num | ) |
Calculates the statistics for a sub-image.
img_num | sub-image number. |
long Bimage::stats_in_mask | ( | long | nn, |
Bimage * | pmask | ||
) |
Calculates the statistics for an image for each level in a mask.
nn | sub-image number. |
*pmask | mask with two or more levels |
vector< double > Bimage::stats_in_poly | ( | long | nn, |
int | nvert, | ||
Vector3< double > * | poly | ||
) |
Calculates the statistics for an image within the given polyhedron.
nn | sub-image number. |
nvert | number of polygon vertices. |
*poly | array of polygon vertices. |
If a voxel lies within the specified polyhedron, it is included in the statistical calculations. Return vector: num, min, max, avg, std
vector< double > Bimage::stats_in_shape | ( | long | nn, |
int | type, | ||
Vector3< long > | start, | ||
Vector3< long > | end | ||
) |
Calculates the statistics for an image within the given box.
nn | sub-image number. |
type | type of selection: 1=rectangle, 2=ellipse. |
start | starting coordinates. |
end | ending coordinates. |
If a voxel lies within the specified box, it is included in the statistical calculations. Return vector: num, min, max, avg, std
vector< double > Bimage::stats_within_radii | ( | long | nn, |
Vector3< double > | loc, | ||
double | rad_min, | ||
double | rad_max | ||
) |
Calculates the statistics for an image within given radii from a location.
nn | sub-image number. |
loc | center of shell. |
rad_min | minimum radius (pixel units). |
rad_max | maximum radius (pixel units). |
If a voxel lies within the specified radii, it is included in the statistical calculations. Return vector: num, min, max, avg, std
int Bimage::subimage_information | ( | ) |
Prints out header information for all sub-images.
void Bimage::subtract | ( | Bimage * | p | ) |
Subtracts another image from an image.
*p | image to be added. Requirement: The images must have the same size. |
int Bimage::subtract_background | ( | ) |
Subtracts the background for each sub-image.
The background is taken from the sub-image structures.
void Bimage::sum | ( | long | m, |
Bimage ** | p | ||
) |
Sums an array of images with their FOM blocks.
m | number of images in the array. |
**p | array of images. The images must all have the same dimensions. |
void Bimage::sum_images | ( | ) |
Adds all sub-images.
vector< Bsuperpixel > Bimage::superpixels | ( | long | step, |
double | colorweight = 0.2 , |
||
long | iterations = 10 , |
||
double | stop = 1 |
||
) |
Segment the image into superpixels.
step | initial superpixel intervals. |
colorweight | weight of color differences compared to spatial distances. |
iterations | maximum number of iterations. |
stop | stopping condition as a percent of voxel changes. |
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.
vector< Bsuperpixel > Bimage::superpixels | ( | long | step, |
double | colorweight = 0.2 , |
||
long | iterations = 10 , |
||
long | bin_levels = 1 , |
||
double | stop = 1 |
||
) |
vector< Bsuperpixel > Bimage::superpixels_from_mask | ( | long | cc, |
long | step | ||
) |
Create superpixels from a multilevel mask.
cc | number of channels in the original image. |
step | distance limit to determine neigbors. |
int Bimage::superpixels_update | ( | Bimage * | pmask, |
vector< long > | vstep, | ||
double | colorweight, | ||
vector< Bsuperpixel > & | seg | ||
) |
Bimage * Bimage::surface_to_topograph | ( | double | threshold, |
int | dir = 0 |
||
) |
Converts a 3D image to a 2D height image.
threshold | threshold to define the surface (assuming positive density). |
dir | direction: 0=bottom up, 1=top down. |
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.
|
inline |
|
inline |
Applies point group symmetry to an image.
sym | point group. |
ref_view | reference view vector and rotation angle. |
flag | flag to normalize after symmetrization. |
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.
|
inline |
int Bimage::symmetrize_cylinder | ( | ) |
Calculates a cylindrically symmetrized map.
The image is replaced with its cylindrically symmetrized version.
Bimage * Bimage::symmetrize_cylinder | ( | int | flag | ) |
Calculates a cylindrically symmetrized map.
flag | 0: |
A 2D cylindrically symmetrized average is calculated.
|
inline |
|
inline |
Finds the symmetry equivalent orientation of a particle with respect to a template.
*pref | template to test against (same size as input image). |
*pmask | mask to limit correlation calculation. |
*sym | symmetry structure. |
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.
Finds the cyclic symmetry equivalent orientation of a particle with respect to a template.
*pref | template to test against (same size as input image). |
*pmask | mask to limit correlation calculation. |
*sym | symmetry structure. |
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.
void Bimage::tangent | ( | ) |
Calculates the tangent of a phase image.
The values must be in radians.
Vector3< double > Bimage::test_helix_parameters | ( | double | angle, |
double | hires, | ||
double | lores, | ||
Vector3< long > | mask_size, | ||
Vector3< long > | mask_start, | ||
long | max_iter, | ||
fft_plan | planf, | ||
fft_plan | planb, | ||
double & | cc | ||
) |
double Bimage::test_helix_parameters | ( | double | rise, |
double | angle, | ||
Vector3< long > | mask_size, | ||
Vector3< long > | mask_start | ||
) |
Bimage * Bimage::thickness | ( | double | reference, |
double | emfp | ||
) |
Calculates a thickness based on intensities with respect to a reference.
reference | reference intensity. |
emfp | proportionaility coefficient. |
The thickness for each pixel is: t = emfp * ln(Iref/Ipix) If Ipix <= 0, t = 0
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.
&start | 3-vector start for first tile to be extracted. |
®ion | 3-vector size of part of image to be extracted (0 = whole image). |
&tile_size | 3-vector size of extracted image. |
&step_size | 3-vector size of intervals between tiles. |
exceed | flag to allow tiles to exceed the input image size. |
Calculating the coordinates of tiles of a specified size and within a specified region within the image. The overlap is specified by the step size and a flag indicates the option to exceed the bounds of the image. The old data is not affected.
vector< Vector3< long > > Bimage::tile_coordinates | ( | Vector3< long > | tile_size, |
Vector3< long > & | step_size | ||
) |
Generates a set of tile coordinates to fit in the image dimensions.
tile_size | 3-vector size of extracted image. |
&step_size | 3-vector size of intervals between tiles. |
Calculating the coordinates of tiles of a specified size to fit within the bounds of the image. The overlap is specified by the given step size, which is adjusted to fit the image bounds. The old data is not affected.
Bimage * Bimage::tile_mask | ( | long | step | ) |
Converts a mask to a tiled multilevel mask.
step | isotropic tile edge size. |
The old data is unmodified.
|
inline |
long Bimage::to_mask | ( | double | threshold | ) |
Change the image to a mask.
threshold | set mask above this value. |
The input image is effectively thresholded and a mask with 0 and 1 generated. The new data type is unsigned char/byte.
Converts a 2D AFM image to a 3D density map.
*psd | 2D standard deviation image. |
nz | z dimension of the new 3D map. |
density | density inside the surface (Da/A3). |
resolution | sigma bounds. |
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
Bimage * Bimage::track_gradient | ( | double | threshold, |
int | flag = 0 |
||
) |
Generates a segmented image from peaks above a threshold value.
threshold | the lowest level to include voxels in regions. |
flag | Track towards maxima (0) or minima (1). |
Every voxel with a value above (below) the threshold is tagged by a pointer pointing to the highest (lowest) value within a kernel of 3x3x3. A peak is defined as pointing to itself, while every other voxel points towards a peak.
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.
nn | sub-image to process. |
nusize | 3-value new image size. |
scale | 3-value scale factor vector to apply. |
origin | 3-value origin for rotation and skewing. |
translate | 3-value vector for translation after transformation. |
mat | 3x3 rotation or skewing matrix. |
fill_type | fill type for filling empty regions. |
fill | value to fill in empty regions. |
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.
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.
scale | 3-value scale factor vector to apply. |
origin | 3-value origin for rotation and skewing. |
translate | 3-value vector for translation after transformation. |
mat | 3x3 rotation or skewing matrix. |
fill_type | fill type for filling empty regions. |
fill | value to fill in empty regions. |
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.
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.
nusize | 3-value new image size. |
scale | 3-value scale factor vector to apply. |
origin | 3-value origin for rotation and skewing. |
translate | 3-value vector for translation after transformation. |
mat | 3x3 rotation or skewing matrix. |
fill_type | fill type for filling empty regions. |
fill | value to fill in empty regions. |
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.
int Bimage::transform_lines | ( | ) |
void Bimage::transform_voxel | ( | long | i, |
Bimage * | pt, | ||
long | nn, | ||
Vector3< double > | oldorigin, | ||
Vector3< double > | nuorigin, | ||
Matrix3 | affmat, | ||
double | fill | ||
) |
int Bimage::truncate | ( | double | minim, |
double | maxim, | ||
double | setmin, | ||
double | setmax | ||
) |
Truncates image data to a given minimum and maximum.
minim | minimum. |
maxim | maximum. |
setmin | value to set voxels smaller than minimum. |
setmax | value to set voxels larger than maximum. |
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.
int Bimage::truncate_to_avg | ( | double | minim, |
double | maxim | ||
) |
Sets voxels in image data exceeding a given minimum and maximum to the average.
minim | minimum. |
maxim | maximum. |
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.
int Bimage::truncate_to_background | ( | double | minim, |
double | maxim | ||
) |
Sets voxels in image data exceeding a given minimum and maximum to the image background.
minim | minimum. |
maxim | maximum. |
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.
int Bimage::truncate_to_min_max | ( | double | minim, |
double | maxim | ||
) |
Truncates image data to a given minimum and maximum.
minim | minimum. |
maxim | maximum. |
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.
double Bimage::tube_interpolate | ( | long | i, |
int | h, | ||
int | k, | ||
double | latconst, | ||
int | zmin, | ||
int | zmax, | ||
double | radius, | ||
int | norm_flag = 1 |
||
) |
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.
h | units along u vector. |
k | units along v vector. |
latconst | lattice constant (angstrom). |
zmin | mimimum z slice to include. |
zmax | maximum z slice to include. |
radius | radius to do symmetrizing over (pixels). |
norm_flag | if 1, normalize |
The data between the z limits are replicated along the helical axis according to the lattice parameters to fill the new volume.
void Bimage::two_to_complex | ( | ) |
Two sub-images converted to a complex image.
|
inline |
|
inline |
|
inline |
Bimage * Bimage::unpack_combined_transform | ( | ) |
Unpacks a complex transform obtained from two real images.
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.
int Bimage::unpack_transform | ( | int | img_select, |
unsigned char * | data, | ||
FourierType | tf | ||
) |
int Bimage::unpack_transform | ( | unsigned char * | data, |
FourierType | tf | ||
) |
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.
|
inline |
|
inline |
vector< double > Bimage::values | ( | long | nn, |
Vector3< double > | vox | ||
) |
Returns an array with all channel data at the given coordinates.
nn | image index. |
vox | voxel coordinates. |
The values of all channels are returned in double precision.
|
inline |
int Bimage::variance | ( | Bimage * | pweight | ) |
Calculates the local variance weighed with the given image.
pweight | weight image. |
The local variance is calculated using the given image as kernel weights. The calculation is threaded if compiled with GCD or OpenMP.
int Bimage::variance | ( | long | kernel_size, |
int | flag = 0 |
||
) |
Calculates the local variance within the given kernel.
kernel_size | size of kernel edge. |
flag | selects type of output. |
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
int Bimage::variance | ( | Vector3< long > | kernel_size, |
int | flag = 0 |
||
) |
Calculates the local variance within the given kernel.
kernel_size | 3-value size of kernel edge. |
flag | selects type of output. |
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
Bimage * Bimage::variance_mask | ( | long | kernel_size, |
double | lowvar = 1e-6 , |
||
int | bkg_flag = 0 |
||
) |
Calculates a mask based on local variance.
kernel_size | size of kernel edge. |
lowvar | low variance threshold. |
bkg_flag | flag to generate a background with value -1. |
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.
double Bimage::variance_threshold | ( | double | lowvar | ) |
Calculates a threshold for a local variance image.
lowvar | low variance threshold. |
A threshold is calculated to define the foreground and background. Excluded regions are defined by a low variance parameter.
Vector3< double > Bimage::vector3 | ( | long | j | ) |
Returns a 3-value vector at the given index.
j | index. |
The index refers to compound values.
void Bimage::vector_to_simple | ( | ) |
A vector image is converted to a simple image.
The new value for each voxel is the length of each vector.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int Bimage::write | ( | Bstring & | fn | ) |
void Bimage::zero_fourier_origin | ( | ) |
Zeroes the first voxel in each image.
int Bimage::zero_origin | ( | ) |
Shifts the origins to zero with wrapping.
Bsub_image* Bimage::image |
Bimage* Bimage::next |