EMAN Reference: EMData Class


addConstaddConst(float)
add a constant
addadd(EMData in)
adds 'in' to 'this'
addIncoherentaddIncoherent(EMData in)
adds 'in' to 'this'
addMaskShelladdMaskShell(int shells)
Will add additional shells/rings to an existing 1/0 mask image
addRadNoiseaddRadNoise(int n, float x0, float dx, list y, int interp)
aliPeakfloat aliPeak()
altfloat alt()
ap2riap2ri()
converts amp/pha to real/imaginary (complex only)
applyMaskapplyMask(int r,int type)
applies a circular mask to the data. type=0 is a step cutoff to the mean value type=4 is a step cutoff to zero type=1 fills in with flatband random noise
applyRadFnapplyRadFn(int n,float x0,float dx, list y,int interp=1)
autoMaskautoMask(float thresh,float filter=.1)
Attempts to automatically mask out the particle, excluding other particles in the box, etc. thresh runs from ~ -2 to 2, negative numbers for dark. protien and positive numbers for light protein (stain) filter is expressed as a fraction of the Fourier radius
azfloat az()
BilateralFiltervoid BilateralFilter(float sigma1, float sigma2, int iter=1, int localWidth=1);
Busyint Busy()
Returns 1 if data is checked out
calcAzDistcalcAzDist(int n,float a0,float da, list data,float rmin,float rmax)
calcCCFEMData calcCCF(EMData with, EMData filter=None)
cross correlation between 2 images
calcCCFXEMData calcCCFX(EMData with, int y0=0, int y1=-1, int nosum=0)
calculates sum of x-axis CCFs
calcHistcalcHist(list hist, int n, float hmin=0, float hmax=0, int add=0)
calcMCFEMData calcMCF(EMData with, EMData filter=None)
mutual correlation between 2 images
calcRadDistcalcRadDist(int n,float x0,float dx, list y)
calcRCFcalcRCF(EMData with, list sum,int NS)
cirMeanfloat cirMean()
clearCTFclearCTF()
Clear CTF parameters.
clipEMData clip(int x0, int y0, int xsize, int ysize)
EMData clip(int x0, int y0, int z0, int xsize, int ysize, int zsize)
inclusive clip. Pads if larger than data
cmCentercmCenter(int intonly=1)
center at center of mass, ignores old dx,dy
colEMData col(int n)
extract vector from matrix
commonLinescommonLines(EMData d1,EMData d2,int mode=0,int steps=180,int horiz=0)
finds common lines between 2 complex images. mode 0 is a summed dot-product mode 1 is weighted phase residualsteps is 1/2 the resolution of the )map
commonLinesRcommonLinesR(EMData data1,EMData data2,int steps=180,int horiz=0)
convoluteEMData convolute(EMData with)
copyEMData copy(int withfft=0, int withparent=1)
returns an exact copy of itself
copyHeadEMData copyHead()
copies descriptive information without any real data
CTFCmpint CTFCmp(EMData with)
used to detect if 2 images have the same CTF parameters
ctfMapctfMap(int type, XYData sf=None)
cutSlicevoid cutSlice(EMData *map,float z,Euler *ort=NULL,int interp=1,float x=0,float y=0);
this will cut a slice out of a real 3D map
dCenterfloat dCenter()
This will find the density value at the peak of the image histogram, sort of like the mode of the density
displayint display()
Display the current image. Returns 0 if success; Returns -1 on error.
distfloat dist(EMData second, int n=0)
doDWTdoDWT(int basis, int level)
in place DWT, basis/level defined elsewhere
doFFTEMData doFFT()
Apply fourier transform on the data.
doIFTEMData doIFT()
Apply inverse fourier transform on the data.
doIWTdoIWT(int basis, int level)
inverse wavelet x-form
doneSlicedoneSlice(int log=0)
once all of the slices have been added with insertSlice(), this routine does a normalization and returns a real 3d volume
doneSliceWFdoneSliceWF(int log=0)
It should only be used in conjunction with insertSliceWF
doRadon EMData doRadon()
Radon transform of image, comes out square
dotfloat dot(EMData data,int evenonly=0)
dot product of 2 images (same size !)
DWTFiltDWTFilt(int basis, int level, float thresh)
in place nonlinear threshold wavelet filter. thresh is with respect to the 'ideal' threshold
Dxfloat Dx()
Dyfloat Dy()
Dzfloat Dz()
edgeMeanfloat edgeMean()
edgeNormalizeedgeNormalize(int cir=0)
normalizes so mean -> value at edge of image, if cir=1, uses 2 pixel circular border
EMDataEMData()
construct an empty EMData instance
fastTranslatefastTranslate(int inplace=1)
fast integer-only translation
fftSliceEMData fftSlice(float alt,float az,float phi,int mode=5)
takes a slice from a 3d complex image for generating projections.
fileCounttuple fileCount(string imagefile)
Returns a tuple with the number of images in a file and the image type.
filterfilter(float highpass,float lowpass,int type)
fourier filters an image, real or imaginary
fscmp float fscmp(EMData with)
returns a quality factor based on FSC between images larger numbers indicate a better match
getATimelong getATime()
Returns access time for the image file.
getCTFlist getCTF()
Returns the CTF parameters in a list.
getEulerEuler getEuler()
getFlagsint getFlags()
getImagicHedimagicH getImagicHed()
getMRCHedmrcH getMRCHed()
getSpiHedSPIDERH getSpiHed()
Returns the header of a spider image.
gimmeFFTgimmeFFT()
gives the caller ownership of the recently obtained fourier transform, so it won't be freed automatically
hasCTFFint hasCTFF()
hasCTFint hasCTF()
hFliphFlip()
flips image horizontally
iftSliceEMData iftSlice()
This does an IFT of a volume reconstructed from slices. Includes a real-space correction for the linear interpolation in Fourier space
insertClipinsertClip(EMData block, int x0, int y0)
used for 2D only
insertSlice3DRealinsertSlice3DReal(EMData slice,float weight)
insertSliceinsertSlice(EMData slice, float alt,float az,float phi,int mode=5,float weight=1.0)
this inserts a complex slice into an image that has been setup4IS()
insertSliceWFinsertSliceWF(EMData slice, float alt,float az,float phi,int mode,list SNR,float padratio)
this inserts a complex slice into an image that has been setup4IS()
interpFT3dinterpFT3d(float x,float y,float z, list ret,int mode)
invertinvert()
multiply by -1
isComplexint isComplex()
Returns 1 if the data is in complex number mode; Returns 0 othewise.
isComplexXint isComplexX()
isFlippedint isFlipped()
Kurtosisfloat Kurtosis()
lcmptuple lcmp(EMData noisy,int keepzero=0,int invert=0)
linear comparison of 2 data sets (smaller better)
leastSquareNormalizeTotuple leastSquareNormalizeTo(EMData to, float low_thresh=FLT_MIN, float high_thresh=FLT_MAX)
littleBigDotEMData littleBigDot(EMData with, int sigma=0)
CCF in real-space, designed for cases where with is small
makeAverageCTFCmakeAverageCTFC(list in,float filtr)
averages the images in the list with CTF correction filtr is in angstroms,
makeAverageCTFCWautomakeAverageCTFCWauto(list in, string outfile=None)
This does CTF correction with a Wiener filter where the filter is estimated directly from the data
makeAverageCTFCWmakeAverageCTFCW(list in, XYData sf, list SNR=None)
averages the images in the list with CTF correction
makeAveragemakeAverage(list in,EMData sigma=None)
averages the images in the list, result in 'this' optionally makes a sigma image as well
makeAverageItermakeAverageIter(list in)
makeAverageWTmakeAverageWT(list in,EMData curves,XYData sf)
averages the images in the list with SNR weightingbut no CTF correction
makeMedianmakeMedian(list in)
Median of the images in the list, result in 'this'
makeRFPEMData makeRFP(int premasked=0,int unwrap=1)
Makes a 'rotational footprint', which is an 'unwound' autocorrelation function. if unwrap is 0 the rfp is not cached. generally the image should be edgenormalized and masked before using this
maskNormalizemaskNormalize(EMData mask,int sigmatoo=1)
Uses a 1/0 mask defining a region to use for the zero-normalization, if sigma is 0, std-dev not modified
Maxfloat Max()
MaxLoctuple MaxLoc()
Returns maxium value locations in a tuple with (max_x_loc, max_y_loc, max_z_loc)
Mean2float Mean2()
Meanfloat Mean()
meanShrink meanShrink(int i)
reduces the size of the image by a factor of i, using the average value of the pixels in a block
medianShrinkmedianShrink(int i)
reduces the size of the image by a factor of i using a local median filter
Minfloat Min()
MinLoctuple MinLoc()
Returns minimum value locations in a tuple with (min_x_loc, min_y_loc, min_z_loc)
multConstmultConst(float)
multiply by constant
multmult(EMData in,int recip=0)
multiplies 'in' by 'this', if recip, then divide
mxMult EMData mxMult(EMData second)
Namestring Name()
NImgint NImg()
Returns the number images in this image file.
normalizeMaxnormalizeMax()
mean -> 0, std dev -> 1
normalizeTotuple normalizeTo(EMData noisy,int keepzero=0,int invert=0)
This will multiply 'this' by a constant so. it is scaled to the signal in 'to'keepzero will exclude zero values, and keep them at zero in the result
normSlicetuple normSlice(EMData slice,float alt,float az,float phi)
try to make sure the slice is normalized properly
oneone()
Sets all the data values to be 1.
ParentEMData Parent()
Pathstring Path()
PathNint PathN()
pcmpfloat pcmp(EMData data, XYData snr=None)
amplitude weighted mean phase error, 'data' should be less noisy than 'this' pcmp
phifloat phi()
Pixelfloat Pixel()
returns the pixel value.
project3dEMData project3d(float alt,float az, float phi, int mode, float thr=1.0)
makes a 3d projection of a volume, mode=-1 does real space projection, 1-5 use fftslice for fourier projection
radialAverageradialAverage()
makes image circularly symmetric
radialSubtractradialSubtract()
subtracts circularly symmetric part of image
readImageint readImage(filename, n = 0, nodata = 0, imagetype = EMData.ANY)
Reads a single image from a file. If image type is not specified, the image type will be determined from file type. return 0 if succeeds; return -1 if fails.
readImagesExtlist readImagesExt(string imagefile, string ext, int n0, int n1, int nodata=0)
Read a set of filtered images with an automatically generated filename. return a list of EMData instances ranging from image n0 to image n1. If nodata is 0, only read image header information. If nodata is 1, read both image data and image header.
readImageslist readImages(string imagefile, int n0, int n1, int nodata=0)
Read a set of images. return a list of EMData instances ranging from image n0 to image n1. If nodata is 0, only read image header information. If nodata is 1, read both image data and image header.
readLSTint readLST(string filespec, int n, int nodata=0, string file_ext = None)
writes a pointer to an image file to a LST file
readMRCAreaint readMRCArea(string fsp, int x0, int y0, int xsize, int ysize)
read a rectangular area from a mrc file. works ONLY for real 2d images. Also the area MUST reside within the image.

int readMRCArea(string fsp, int x0, int y0, int z0, int xsize, int ysize, int zsize)
read a cube from a 3D mrc file. works ONLY for real 3d images. Also the area MUST reside within the image.
realFilterrealFilter(int type, float val1=0,float val2=0, float val3=0)
a variety of real-space filters
refineAlignrefineAlign(EMData with,int mode=1)
ri2apri2ap()
converts real/imaginary to amp/pha (complex only)
rot180rot180()
fast rotation by 180 degrees
rotAlignCHfloat rotAlignCH(EMData with, int irad=8, int orad=0)
rotational alignment via circular harmonic
rotAlignfloat rotAlign(EMData with)
rotational alignment using angular correlation
rotAlignPrecenfloat rotAlignPrecen(EMData with)
rotational alignment assuming centers are correct
rotateAndTranslateFastrotateAndTranslateFast(float scale=1.0)
rotate and translate using current settings behavior changes if parent is/not set
rotateAndTranslaterotateAndTranslate(float scale=1.0,float dxc=0,float dyc=0,float dzc=0,int r=0)
rotateXrotateX(int dx)
This performs a translation of each line along x with wraparound this is equivalent to a rotation when performed on 'unwrapped' maps
rowEMData row(int n)
extract vector from matrix
RTAlignEMData RTAlign(EMData with, int usedot=0, int maxshift=0)
RTAlignRadonEMData RTAlignRadon(EMData with,int maxshift=-1,EMData radonwith=None,EMData radonthis=None)
RTFAlignEMData RTFAlign(EMData with=None,EMData flip=None,int usedot=1,int maxshift=-1)
rotational, translational and flip alignment
RTFAlignRadonEMData RTFAlignRadon(EMData with,int maxshift=-1,EMData thisf=None,EMData radonwith=None ,EMData radonthis=None,EMData radonthisf=None)
rotational, translational and flip alignment with Radon transforms
RTFAlignSlowestEMData RTFAlignSlowest(EMData with,EMData flip=None,int maxshift=-1)
rotational, translational and flip alignment using exhaustive search. VERY SLOW
RTFAlignSlowEMData RTFAlignSlow(EMData with,EMData flip=None,int maxshift=-1)
rotational, translational and flip alignment using real-space methods, SLOW
serialInserialIn(int file_descriptor)
serialOutserialOut(int file_descriptor)
used ONLY for FILESERVER operation, not safe otherwise
setColsetCol(EMData d,int n)
insert vector into matrix
setComplexsetComplex(int i)
setComplexXsetComplexX(int i)
setCTFFsetCTF(list new_ctf)
Sets CTF parameters with new values from a list.

setCTFF(string s)
Sets CTF parameters with new values from a string.
setCTFsetCTF(list new_ctf)
Sets CTF parameters with new values from a list.

setCTFF(string s)
Sets CTF parameters with new values from a string.
setFlippedsetFlipped(int f)
setImagicHedsetImagicHed(imagicH hed)
setNamesetName(string name)
setParentsetParent(EMData data)
setPathsetPath(string path)
setPathNsetPathN(int n)
setPixelsetPixel(float pix)
set the pixel value.
setRAlignsetRAlign(Euler angle)
setRIsetRI(int i)
setRowsetRow(EMData d,int n)
insert vector into matrix
setSizeint setSize(int x, int y=1, int z=1)
Sets x, y, z dimension sizes
setTAlignsetTAlign(float x, float y, float z=0)
setup4IS setup4IS(int size)
setup4Slicesetup4Slice(int redo=1)
setValueAtsetValueAt(int x, int y, int z, float v)
it does not set the changed flag
sigDifffloat sigDiff()
Calculates sigma above and below the mean and returns the difference between them
Sigma2float Sigma2()
Sigmafloat Sigma()
Skewnessfloat Skewness()
subNoisesubNoise()
Subtract average noise from intensity. Negative results allowed.
subtractsubtract(EMData data)
subtracts 'data' from the current set
SumSqfloat SumSq()
swapinint swapin()
Swaps the data in from the swap file.
swapoutint swapout()
Swaps the data out to a temporary file.
transAlign3dfloat transAlign3d(EMData with,int useparent=0,int intonly=0)
translational alignment using CCF
transAligntuple transAlign(EMData with, int useparent, int intonly, int maxshift)
translational alignment using CCF
uncutSlicevoid uncutSlice(EMData *map,float z,Euler *ort=NULL,float x=0,float y=0);
Opposite of cutSlice(). It will take a slice and insert the data into a real 3D map. It does not interpolate, it uses the nearest neighbor.
unwrapEMData unwrap(int r1=-1,int r2=-1,int xs=-1,int dx=0,int dy=0,int do360=0)
maps polar coordinates to cylindrical coordinates
updateupdate()
Tells EMData to update itself in the future.
valueAtfloat valueAt(int x, int y)
Return data at a 2D position.

float valueAt(int x, int y, int z)
Return data at a 3D position.
valueAtInterpfloat valueAtInterp(float x, float y)
Returns a data value at a 2D position.
valueAtSafefloat valueAtSafe(int x, int y)
Return a data value at a 2D position. It has no locking.

float valueAtSafe(int x, int y, int z)
Return a data value at a 3D position. It has no locking.
vertACFEMData vertACF(int maxdy)
vertical autocorrelation calculated in real-space over a range of translations
vFlipvFlip()
flips image vertically
WaitWait()
Waits until the data becomes available.
waitReadyint waitReady(int readonly)
Waits for data to become available; Returns 0 if OK; Returns non-zero if any error.
writeDebugwriteDebug(int n)
write to a special graphical debug viewer
writeImageint writeImage(filename, n=0, imagetype=EMData.ANY, nolock=0, swap = 0, mode=MODE_float)
Writes a single image to a file. If image type is not specified, teh image type will be determined from given file type. return 0 if succeeds; return -1 if fails.
writeLSTint writeLST(string filespec, int n, string reffile, int refn, string comment)
xNormalizexNormalize(int mode=0)
normalizes each row in the image individually
xSizeint xSize()
Returns x dimension size
ySizeint ySize()
Returns y dimension size
zerozero()
Sets all the data values to be 0.
zSizeint zSize()
Returns z dimension size