emdata_sparx.cpp File Reference

#include <stack>
#include "ctf.h"
#include "emdata.h"
#include <iostream>
#include <cmath>
#include <cstring>
#include <gsl/gsl_sf_bessel.h>
#include <gsl/gsl_errno.h>
#include <vector>
#include <boost/shared_ptr.hpp>

Include dependency graph for emdata_sparx.cpp:

Go to the source code of this file.

Classes

class  ctf_store

Defines

#define rdata(i, j, k)   rdata[(i-1)+((j-1)+(k-1)*ny)*nx]
#define square(x)   ((x)*(x))
#define proj(ix, iy, iz)   proj[ix-1+(iy-1+(iz-1)*ny)*nx]
#define pnewimg(ix, iy, iz)   pnewimg[ix-1+(iy-1+(iz-1)*ny)*nx]
#define in(i, j, k)   in[i+(j+(k*ny))*nx]
#define in(i, j, k)   in[i+(j+(k*ny))*nx]
#define QUADPI   3.141592653589793238462643383279502884197
#define DGR_TO_RAD   QUADPI/180
#define rdata(i, j, k)   rdata[(i-1)+((j-1)+(k-1)*ny)*nx]
#define X(i)   X[i-1]
#define Y(j)   Y[j-1]
#define Z(k)   Z[k-1]
#define avagadro   (6.023*(double)pow(10.0,23.0))
#define density_protein   (1.36)
#define R   (0.61803399f)
#define C   (1.f-R)
#define QUADPI   3.141592653589793238462643383279502884197
#define DGR_TO_RAD   QUADPI/180
#define fint(i, j, k)   fint[(i-1) + ((j-1) + (k-1)*ny)*lsd]
#define fout(i, j, k)   fout[(i-1) + ((j-1) + (k-1)*nyn)*lsdn]
#define fint(jx, jy, jz)   fint[jx + (jy + jz*ny)*nox]
#define fint(jx, jy, jz)   fint[jx + (jy + jz*ny)*nx]
#define fout(jx, jy, jz)   fout[jx + (jy + jz*ny)*nx]

Functions

float dist (int lnlen, const float *line_1, const float *line_2)
float dist_r (int lnlen, const float *line_1, const float *line_2)
void swapx (float *a, float *b, float *temp, size_t nbytes)
 Helper function for EMData::fft_shuffle, below.
ostream & operator<< (ostream &os, const Pixel &peak)
float circumference (EMData *emdata, int npixel)


Define Documentation

#define avagadro   (6.023*(double)pow(10.0,23.0))

Definition at line 4636 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::find_3d_threshold().

#define C   (1.f-R)

#define density_protein   (1.36)

Definition at line 4637 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::find_3d_threshold().

#define DGR_TO_RAD   QUADPI/180

Definition at line 4933 of file emdata_sparx.cpp.

#define DGR_TO_RAD   QUADPI/180

#define fint ( jx,
jy,
jz   )     fint[jx + (jy + jz*ny)*nx]

Definition at line 5893 of file emdata_sparx.cpp.

#define fint ( jx,
jy,
jz   )     fint[jx + (jy + jz*ny)*nox]

Definition at line 5893 of file emdata_sparx.cpp.

#define fint ( i,
j,
 )     fint[(i-1) + ((j-1) + (k-1)*ny)*lsd]

#define fout ( jx,
jy,
jz   )     fout[jx + (jy + jz*ny)*nx]

Definition at line 5894 of file emdata_sparx.cpp.

#define fout ( i,
j,
 )     fout[(i-1) + ((j-1) + (k-1)*nyn)*lsdn]

#define in ( i,
j,
 )     in[i+(j+(k*ny))*nx]

Definition at line 2123 of file emdata_sparx.cpp.

#define in ( i,
j,
 )     in[i+(j+(k*ny))*nx]

#define pnewimg ( ix,
iy,
iz   )     pnewimg[ix-1+(iy-1+(iz-1)*ny)*nx]

Definition at line 965 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::average_circ_sub().

#define proj ( ix,
iy,
iz   )     proj[ix-1+(iy-1+(iz-1)*ny)*nx]

#define QUADPI   3.141592653589793238462643383279502884197

Definition at line 4932 of file emdata_sparx.cpp.

#define QUADPI   3.141592653589793238462643383279502884197

Definition at line 4932 of file emdata_sparx.cpp.

#define R   (0.61803399f)

#define rdata ( i,
j,
 )     rdata[(i-1)+((j-1)+(k-1)*ny)*nx]

Definition at line 4501 of file emdata_sparx.cpp.

#define rdata ( i,
j,
 )     rdata[(i-1)+((j-1)+(k-1)*ny)*nx]

Definition at line 4501 of file emdata_sparx.cpp.

#define square (  )     ((x)*(x))

#define X (  )     X[i-1]

#define Y (  )     Y[j-1]

Definition at line 4503 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::phase_cog(), and EMAN::Util::WTF().

#define Z (  )     Z[k-1]

Definition at line 4504 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::phase_cog().


Function Documentation

float circumference ( EMData emdata,
int  npixel 
)

Definition at line 5128 of file emdata_sparx.cpp.

References Assert, data, EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::EMData::nx, EMAN::EMData::ny, and EMAN::EMData::nz.

05129 {
05130         int nx = emdata->get_xsize();
05131         int ny = emdata->get_ysize();
05132         int nz = emdata->get_zsize();
05133 
05134         float* data = emdata->get_data();
05135         if( ny==1 && nz==1 )
05136         {
05137             // 1d case
05138             float sumf=0.0;
05139             int   sumn=0;
05140             for( int i=0; i < npixel; ++i )
05141             {
05142                 sumf += data[i];
05143                 sumf += data[nx-1-i];
05144                 sumn += 2;
05145             }
05146             return sumf/sumn;
05147         }
05148 
05149         if( nz==1 )
05150         {
05151             float sumf=0.0;
05152             int   sumn=0;
05153             int   id=0;
05154             for( int iy=0; iy < ny; ++iy )
05155             {
05156                 for( int ix=0; ix < nx; ++ix )
05157                 {
05158                     if( iy<npixel || iy>ny-1-npixel || ix<npixel || ix>nx-1-npixel )
05159                     {
05160                         sumf += data[id];
05161                         sumn += 1;
05162                     }
05163                     id++;
05164                 }
05165             }
05166 
05167             Assert( id==nx*ny  );
05168             Assert( sumn == nx*ny - (nx-2*npixel)*(ny-2*npixel) );
05169             return sumf/sumn;
05170         }
05171 
05172         // 3d cases;
05173 
05174         float sumf = 0.0;
05175         int   sumn = 0;
05176         int   id = 0;
05177         for( int iz=0; iz < nz; ++iz)
05178         {
05179             for( int iy=0; iy < ny; ++iy)
05180             {
05181                 for( int ix=0; ix < nx; ++ix )
05182                 {
05183                     if( iz<npixel||iz>nz-1-npixel||iy<npixel||iy>ny-1-npixel||ix<npixel||ix>nx-1-npixel)
05184                     {
05185                         sumf += data[id];
05186                         sumn += 1;
05187                     }
05188                     id++;
05189                 }
05190             }
05191         }
05192 
05193 
05194         Assert( id==nx*ny*nz);
05195         Assert( sumn==nx*ny*nz-(nx-2*npixel)*(ny-2*npixel)*(nz-2*npixel) );
05196         return sumf/sumn;
05197 }

float dist ( int  lnlen,
const float *  line_1,
const float *  line_2 
)

Definition at line 452 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::cm_euc(), EMAN::FourierInserter3DMode8::insert_pixel(), EMAN::BaldwinWoolfordReconstructor::insert_pixel(), EMAN::Quaternion::normalize(), EMAN::RotationalSubstractProcessor::process_inplace(), EMAN::RotationalAverageProcessor::process_inplace(), EMAN::MaskGaussNonuniformProcessor::process_pixel(), EMAN::CircularMaskProcessor::process_pixel(), and EMAN::PointArray::set_from_density_map().

00453 {
00454         float dis2=0.0;
00455         for( int i=0; i < lnlen; ++i) {
00456                 float tmp = line_1[i] - line_2[i];
00457                 dis2 += tmp*tmp;
00458         }
00459         //return static_cast<float>(std::sqrt(dis2));
00460         return dis2;
00461 }

float dist_r ( int  lnlen,
const float *  line_1,
const float *  line_2 
)

Definition at line 463 of file emdata_sparx.cpp.

References sqrt().

00464 {
00465         double dis2 = 0.0;
00466         for( int i=0; i < lnlen; ++i ) {
00467                 float tmp = line_1[lnlen-1-i] - line_2[i];
00468                 dis2 += tmp*tmp;
00469         }
00470         return static_cast<float>(std::sqrt(dis2));
00471 }

ostream& operator<< ( ostream &  os,
const Pixel peak 
)

Definition at line 3663 of file emdata_sparx.cpp.

References EMAN::Pixel::value, EMAN::Pixel::x, EMAN::Pixel::y, and EMAN::Pixel::z.

03663                                                      {
03664     os <<  peak.x <<  peak.y << peak.z  << peak.value;
03665     return os;
03666 }

void swapx ( float *  a,
float *  b,
float *  temp,
size_t  nbytes 
) [inline]

Helper function for EMData::fft_shuffle, below.

Definition at line 3226 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::fft_shuffle().

03226                                                                   {
03227         memcpy(temp, a, nbytes);
03228         memcpy(a, b, nbytes);
03229         memcpy(b, temp, nbytes);
03230 }


Generated on Fri Nov 20 02:19:21 2009 for EMAN2 by  doxygen 1.5.6