32#ifndef eman__emdata_h__
33#define eman__emdata_h__ 1
39#include "sparx/fundamentals.h"
42#include "sparx/emarray.h"
46#ifdef EMAN2_USING_CUDA
47#include <cuda_runtime_api.h>
68 typedef boost::multi_array_ref<float, 2>
MArray2D;
69 typedef boost::multi_array_ref<float, 3>
MArray3D;
70 typedef boost::multi_array_ref<std::complex<float>, 2>
MCArray2D;
71 typedef boost::multi_array_ref<std::complex<float>, 3>
MCArray3D;
101 #include "sparx/emdata_sparx.h"
104 #include "sphire/emdata_sphire.h"
106#ifdef EMAN2_USING_CUDA
119 explicit EMData(
const string& filename,
int image_index=0);
236 void scale(
float scale_factor);
244 void translate(
float dx,
float dy,
float dz);
283 void rotate(
float az,
float alt,
float phi);
307 cout <<
"Deprecation warning. Please consider using EMData::transform() instead " << endl;
319 void rotate_translate(
float az,
float alt,
float phi,
float dx,
float dy,
float dz);
335 float dz,
float pdx,
float pdy,
float pdz);
462 EMData *
calc_ccfx(
EMData *
const with,
int y0 = 0,
int y1 = -1,
bool nosum =
false,
bool flip =
false,
bool usez=
false);
526 EMData *
unwrap(
int r1 = -1,
int r2 = -1,
int xs = -1,
int dx = 0,
527 int dy = 0,
bool do360 =
false,
bool weight_radial=
true)
const;
541 void apply_radial_func(
float x0,
float dx, vector < float >array,
bool interp =
true);
570 vector < float >
calc_radial_dist(
int n,
float x0,
float dx,
int nwedge,
float offset,
bool inten);
600 vector <float>
calc_hist(
int hist_size = 128,
float hist_min = 0,
float hist_max = 0,
const float& brt = 0.0f,
const float& cont = 1.0f);
614 vector<float>
calc_az_dist(
int n,
float a0,
float da,
float rmin,
618 void calc_rcf(
EMData * with, vector < float >&sum_array);
681 void create_ctf_map(CtfMapType type,
XYData * sf = 0);
707 int steps = 180,
bool horizontal =
false);
720 int steps = 180,
bool horizontal =
false);
771 num = 1 << resolution;
781 std::cout <<
"Printing EMData params" << std::endl;
784 std::cout << (it->first) <<
" " << (it->second).to_str() << std::endl;
786 std::cout <<
"Done printing EMData params" << std::endl;
794 void set_xyz_origin(
float origin_x,
float origin_y,
float origin_z);
872 ClipInplaceVariables(
const int p_nx,
const int p_ny,
const int p_nz,
const int n_nx,
const int n_ny,
const int n_nz,
const int xtrans,
const int ytrans,
const int ztrans) :
877 if ( xtrans > 0 )
x_iter -= xtrans;
879 if ( ytrans > 0 )
y_iter -= ytrans;
881 if ( ztrans > 0 )
z_iter -= ztrans;
Const iterator support for the Dict object This is just a wrapper, everything is inherited from the m...
Dict is a dictionary to store <string, EMObject> pair.
ClipInplaceVariables(const int p_nx, const int p_ny, const int p_nz, const int n_nx, const int n_ny, const int n_nz, const int xtrans, const int ytrans, const int ztrans)
EMData stores an image's data and defines core image processing routines.
EMData * get_top_half() const
Get the top half of this 3D image.
void scale(float scale_factor)
scale the image by a factor.
void rotate_180()
Fast rotation by 180 degrees.
void translate(float dx, float dy, float dz)
Translate this image.
EMData * calc_fast_sigma_image(EMData *mask)
Calculates the local standard deviation (sigma) image using the given mask image.
EMData * compute_missingwedge(float wedgeangle, float start=0.05, float stop=0.5)
Find the mean and variance of voxels in the missing wedge.
EMData * rot_fp
This is a cached rotational footprint, can save much time.
void cconj()
Replace the image its complex conjugate.
void rotate(const Transform &t)
Rotate this image.
EMData * calc_flcf(EMData *with)
Calculates the cross correlation with local normalization between 2 images.
void save_byteorder_to_dict(ImageIO *imageio)
float max_3D_pixel_error(const Transform &t1, const Transform &t2, float r)
EMData()
For all image I/O.
void uncut_slice(EMData *const map, const Transform &tr) const
Opposite of the cut_slice().
EMData * window_center(int l)
Window the center of an image.
float * supp
supplementary data array
EMData * make_rotational_footprint_cmc(bool unwrap=true)
EMDataFlags
This EMDataFlags is deprecated.
@ EMDATA_GPU_RO_NEEDS_UPDATE
@ EMDATA_GPU_NEEDS_UPDATE
@ EMDATA_CPU_NEEDS_UPDATE
EMData * calc_mutual_correlation(EMData *with, bool tocorner=false, EMData *filter=0)
Calculates mutual correlation function (MCF) between 2 images.
void zero_corner_circulant(const int radius=0)
Zero the pixels in the bottom left corner of the image If radius is greater than 1,...
double dot_rotate_translate(EMData *with, float dx, float dy, float da, const bool mirror=false)
dot product of 2 images.
EMData * little_big_dot(EMData *little_img, bool do_sigma=false)
This does a normalized dot product of a little image with a big image using real-space methods.
float * rdata
image real data
EMData * calc_ccf_masked(EMData *with, EMData *withsq=0, EMData *mask=0)
Calculate cross correlation between this and with where this is assumed to have had a mask applied to...
Dict attr_dict
to store all image header info
EMData(const string &filename, int image_index=0)
Construct from an image file.
void rotate_x(int dx)
This performs a translation of each line along x with wraparound.
EMData * get_clip(const Region &area, const float fill=0) const
Get an inclusive clip.
EMData * make_rotational_footprint_e1(bool unwrap=true)
int flags
CTF data All CTF data become attribute ctf(vector<float>) in attr_dict –Grant Tang.
void apply_radial_func(float x0, float dx, vector< float >array, bool interp=true)
multiplies by a radial function in fourier space.
vector< float > calc_radial_dist(int n, float x0, float dx, int inten)
calculates radial distribution.
vector< float > calc_hist(int hist_size=128, float hist_min=0, float hist_max=0, const float &brt=0.0f, const float &cont=1.0f)
Calculates the histogram of 'this' image.
void transform(const Transform &t)
Rotate then translate the image.
void cut_slice(const EMData *const map, const Transform &tr, bool interpolate=true)
cut a 2D slice out of a real 3D map.
void add_incoherent(EMData *obj)
Adds 'obj' to 'this' incoherently.
EMData * get_rotated_clip(const Transform &xform, const IntSize &size, float scale=1.0)
This will extract an arbitrarily oriented and sized region from the image.
EMData * do_radon()
Radon Transform: an algorithm that transforms an original image into a series of equiangular projecti...
EMData * make_footprint(int type=0)
Makes a 'footprint' for the current image.
EMData * oneDfftPolar(int size, float rmax, float MAXR)
Vec3f all_translation
translation from the original location
void set_xyz_origin(float origin_x, float origin_y, float origin_z)
Set the x,y,z origin of the image.
EMData * convolute(EMData *with)
Convolutes 2 data sets.
vector< float > calc_az_dist(int n, float a0, float da, float rmin, float rmax)
Caculates the azimuthal distributions.
float * setup4slice(bool redo=true)
Set up for fftslice operations.
EMData * unwrap_largerR(int r1, int r2, int xs, float rmax_f)
EMData * extract_box(const Transform &cs, const Region &r)
Extract a box from EMData in an abritrary orrientation.
void rotate_translate(const Transform &t)
Apply a transformation to the image.
int getResolution() const
function for MarchingCubes, for 3D image display
void clip_inplace(const Region &area, const float &fill_value=0)
Clip the image inplace - clipping region must be smaller than the current region internally memory is...
void debug_print_parms()
Printing EMData params for debugging purpose.
float calc_dist(EMData *second_img, int y_index=0) const
Calculates the distance between 2 vectors.
int xoff
array index offsets
ImageIO classes are designed for reading/writing various electron micrography image formats,...
IntSize is used to describe a 1D, 2D or 3D rectangular size in integers.
Region defines a 2D or 3D rectangular region specified by its origin coordinates and all edges' sizes...
XYData defines a 1D (x,y) data set.
void process_inplace(const string &processorname, const Dict ¶ms=Dict())
This file is a part of "emdata.h", to use functions in this file, you should "#include "emdata....
EMData & operator=(const EMData &that)
EMData assignment operator Performs a deep copy.
EMData * calc_ccf(EMData *with=0, fp_flag fpflag=CIRCULANT, bool center=false)
Calculate Cross-Correlation Function (CCF).
EMData * unwrap(int r1=-1, int r2=-1, int xs=-1, int dx=0, int dy=0, bool do360=false, bool weight_radial=true) const
Maps to polar coordinates from Cartesian coordinates.
EMData * calc_ccfx(EMData *const with, int y0=0, int y1=-1, bool nosum=false, bool flip=false, bool usez=false)
Calculate Cross-Correlation Function (CCF) in the x-direction and adds them up, result in 1D.
EMData * make_rotational_footprint(bool unwrap=true)
Makes a 'rotational footprint', which is an 'unwound' autocorrelation function.
EMData(float *data, float *cudadata, const int nx, const int ny, const int nz, const Dict &attr_dict=Dict())
Construction from a data pointer for usage in cuda, dimensions must be supplied.
void common_lines(EMData *image1, EMData *image2, int mode=0, int steps=180, bool horizontal=false)
Finds common lines between 2 complex images.
void common_lines_real(EMData *image1, EMData *image2, int steps=180, bool horizontal=false)
Finds common lines between 2 real images.
boost::multi_array_ref< std::complex< float >, 3 > MCArray3D
EMData * operator+(const EMData &em, float n)
boost::multi_array_ref< float, 3 > MArray3D
boost::multi_array_ref< float, 2 > MArray2D
EMData * rdiv(const EMData &em, float n)
EMData * rsub(const EMData &em, float n)
EMData * operator-(const EMData &em, float n)
EMData * operator/(const EMData &em, float n)
EMData * operator*(const EMData &em, float n)
boost::multi_array< int, 3 > MIArray3D
boost::multi_array_ref< std::complex< float >, 2 > MCArray2D
boost::multi_array< int, 2 > MIArray2D