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
class  ctf_store_new

Defines

#define rdata(i, j, k)   rdata[(i-1)+((j-1)+(k-1)*ny)*(size_t)nx]
#define square(x)   ((x)*(x))
#define proj(ix, iy, iz)   proj[ix-1+(iy-1+(iz-1)*ny)*(size_t)nx]
#define pnewimg(ix, iy, iz)   pnewimg[ix-1+(iy-1+(iz-1)*ny)*(size_t)nx]
#define in(i, j, k)   in[i+(j+(k*ny))*(size_t)nx]
#define in(i, j, k)   in[i+(j+(k*ny))*(size_t)nx]
#define QUADPI   3.141592653589793238462643383279502884197
#define DGR_TO_RAD   QUADPI/180
#define rdata(i, j, k)   rdata[(i-1)+((j-1)+(k-1)*ny)*(size_t)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)*(size_t)lsd]
#define fout(i, j, k)   fout[(i-1) + ((j-1) + (k-1)*nyn)*(size_t)lsdn]
#define fint(jx, jy, jz)   fint[jx + (jy + jz*ny)*(size_t)nox]
#define fint(jx, jy, jz)   fint[jx + (jy + jz*ny)*(size_t)nx]
#define fout(jx, jy, jz)   fout[jx + (jy + jz*ny)*(size_t)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 5925 of file emdata_sparx.cpp.

#define C   (1.f-R)

Definition at line 5928 of file emdata_sparx.cpp.

Referenced by EMAN::Util::TwoDTestFunc().

#define density_protein   (1.36)

Definition at line 5926 of file emdata_sparx.cpp.

#define DGR_TO_RAD   QUADPI/180

Definition at line 6222 of file emdata_sparx.cpp.

#define DGR_TO_RAD   QUADPI/180

Definition at line 6222 of file emdata_sparx.cpp.

Referenced by EMAN::Util::CANG().

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

Definition at line 7323 of file emdata_sparx.cpp.

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

Definition at line 7323 of file emdata_sparx.cpp.

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

Definition at line 7323 of file emdata_sparx.cpp.

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

Definition at line 7324 of file emdata_sparx.cpp.

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

Definition at line 7324 of file emdata_sparx.cpp.

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

Definition at line 2710 of file emdata_sparx.cpp.

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

Definition at line 2710 of file emdata_sparx.cpp.

Referenced by EMAN::Log::begin(), EMAN::Util::cl1(), frm_2d_Align(), EMAN::newfile_store::get_image(), EMAN::EMUtil::get_image_type(), EMAN::ImagicIO2::init_test(), EMAN::EMData::oneDfftPolar(), EMAN::Wiener2DFourierProcessor::process(), EMAN::ApplyPolynomialProfileToHelix::process_inplace(), EMAN::ModelEMCylinderProcessor::process_inplace(), EMAN::FileFourierProcessor::process_inplace(), EMAN::newfile_store::read(), EMAN::XYData::read_file(), EMAN::file_store::restart(), and EMAN::newfile_store::restart().

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

Definition at line 1005 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)*(size_t)nx]

Definition at line 1004 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::average_circ_sub(), EMAN::FourierGriddingProjector::project3d(), EMAN::MaxValProjector::project3d(), EMAN::StandardProjector::project3d(), EMAN::PointArray::projection_by_summation(), recons3d_4nn(), EMAN::PointArray::replace_by_summation(), and EMAN::Util::twoD_to_3D_ali().

#define QUADPI   3.141592653589793238462643383279502884197

Definition at line 6221 of file emdata_sparx.cpp.

#define QUADPI   3.141592653589793238462643383279502884197

Definition at line 6221 of file emdata_sparx.cpp.

#define R   (0.61803399f)

Definition at line 5927 of file emdata_sparx.cpp.

Referenced by EMAN::Transform::orthogonalize(), and EMAN::NewLowpassGaussProcessor::process_inplace().

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

Definition at line 5790 of file emdata_sparx.cpp.

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

Definition at line 5790 of file emdata_sparx.cpp.

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

Definition at line 721 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::calc_sigma_diff(), EMAN::OptVarianceCmp::cmp(), EMAN::EMData::cog(), EMAN::EMData::little_big_dot(), main(), and EMAN::BilateralProcessor::process_inplace().

#define X (  )     X[i-1]

Definition at line 5791 of file emdata_sparx.cpp.

Referenced by EMAN::SVDAnalyzer::analyze(), and EMAN::Util::svdcmp().

#define Y (  )     Y[j-1]

Definition at line 5792 of file emdata_sparx.cpp.

Referenced by EMAN::Util::WTF().

#define Z (  )     Z[k-1]

Definition at line 5793 of file emdata_sparx.cpp.


Function Documentation

float circumference ( EMData emdata,
int  npixel 
)

Definition at line 6571 of file emdata_sparx.cpp.

06576                              {
06577                 // 1d case
06578                 float sumf=0.0;
06579                 int   sumn=0;
06580                 for( int i=0; i < npixel; ++i ) {
06581                         sumf += data[i];
06582                         sumf += data[nx-1-i];
06583                         sumn += 2;
06584                 }
06585                 return sumf/sumn;
06586         }
06587 
06588         if( nz==1 ) {
06589                 float sumf=0.0;
06590                 int   sumn=0;
06591                 int   id=0;
06592                 for( int iy=0; iy < ny; ++iy ) {
06593                         for( int ix=0; ix < nx; ++ix ) {
06594                                 if( iy<npixel || iy>ny-1-npixel || ix<npixel || ix>nx-1-npixel ) {
06595                                     sumf += data[id];
06596                                     sumn += 1;
06597                                 }
06598                                 id++;
06599                         }
06600                 }
06601 
06602                 Assert( id==nx*ny  );
06603                 Assert( sumn == nx*ny - (nx-2*npixel)*(ny-2*npixel) );
06604                 return sumf/sumn;
06605         }
06606 
06607         // 3d cases;
06608 
06609         float sumf = 0.0;
06610         size_t   sumn = 0;
06611         size_t   id = 0;
06612         for( int iz=0; iz < nz; ++iz) {
06613                 for( int iy=0; iy < ny; ++iy) {
06614                         for( int ix=0; ix < nx; ++ix ) {
06615                                 if( iz<npixel||iz>nz-1-npixel||iy<npixel||iy>ny-1-npixel||ix<npixel||ix>nx-1-npixel) {
06616                                         sumf += data[id];
06617                                         sumn += 1;
06618                                 }
06619                                 id++;
06620                         }
06621                 }
06622         }
06623 
06624 
06625         Assert( id==(size_t)nx*ny*nz);
06626         Assert( sumn==(size_t)nx*ny*nz-(size_t)(nx-2*npixel)*(ny-2*npixel)*(nz-2*npixel) );
06627         return sumf/sumn;
06628 }
06629 /*
06630 Purpose: Create a new [normalized] [zero-padded]  image.

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

Definition at line 474 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::cm_euc(), 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().

00475 {
00476         float dis2=0.0;
00477         for( int i=0; i < lnlen; ++i) {
00478                 float tmp = line_1[i] - line_2[i];
00479                 dis2 += tmp*tmp;
00480         }
00481         //return static_cast<float>(std::sqrt(dis2));
00482         return dis2;
00483 }

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

Definition at line 485 of file emdata_sparx.cpp.

References sqrt().

00486 {
00487         double dis2 = 0.0;
00488         for( int i=0; i < lnlen; ++i ) {
00489                 float tmp = line_1[lnlen-1-i] - line_2[i];
00490                 dis2 += tmp*tmp;
00491         }
00492         return static_cast<float>(std::sqrt(dis2));
00493 }

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

Definition at line 4952 of file emdata_sparx.cpp.

04955                                    {

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

Helper function for EMData::fft_shuffle, below.

Definition at line 3984 of file emdata_sparx.cpp.

03988                          {


Generated on Tue Jun 11 12:40:53 2013 for EMAN2 by  doxygen 1.4.7