Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

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:

Include dependency graph

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)*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 5943 of file emdata_sparx.cpp.

#define C   (1.f-R)
 

Definition at line 5946 of file emdata_sparx.cpp.

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

#define density_protein   (1.36)
 

Definition at line 5944 of file emdata_sparx.cpp.

#define DGR_TO_RAD   QUADPI/180
 

Definition at line 6240 of file emdata_sparx.cpp.

#define DGR_TO_RAD   QUADPI/180
 

Definition at line 6240 of file emdata_sparx.cpp.

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

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

Definition at line 7286 of file emdata_sparx.cpp.

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

Definition at line 7286 of file emdata_sparx.cpp.

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

Definition at line 7286 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::filter_by_image(), EMAN::EMData::Four_ds(), EMAN::EMData::Four_shuf_ds_cen_us(), EMAN::EMData::FourInterpol(), EMAN::EMData::FourTruncate(), and EMAN::EMData::replace_amplitudes().

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

Definition at line 7287 of file emdata_sparx.cpp.

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

Definition at line 7287 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::Four_ds(), EMAN::EMData::Four_shuf_ds_cen_us(), EMAN::EMData::FourInterpol(), EMAN::EMData::FourTruncate(), and EMAN::EMData::replace_amplitudes().

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

Definition at line 2761 of file emdata_sparx.cpp.

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

Definition at line 2761 of file emdata_sparx.cpp.

Referenced by EMAN::Log::begin(), EMAN::Util::cl1(), EMAN::EMData::conjg(), frm_2d_Align(), EMAN::EMUtil::get_image_type(), EMAN::EMData::get_pow(), EMAN::EMData::oneDfftPolar(), EMAN::Wiener2DFourierProcessor::process(), EMAN::FileFourierProcessor::process_inplace(), EMAN::XYData::read_file(), read_int_and_space(), EMAN::EMData::rot_scale_trans(), EMAN::EMData::rot_scale_trans_background(), EMAN::Gatan::TagData::TagData(), EMAN::Gatan::TagEntry::TagEntry(), EMAN::Gatan::TagGroup::TagGroup(), and wustl_mm::SkeletonMaker::Volume::threshold().

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

Definition at line 990 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]
 

Definition at line 989 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::average_circ_sub(), EMAN::FourierGriddingProjector::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 6239 of file emdata_sparx.cpp.

#define QUADPI   3.141592653589793238462643383279502884197
 

Definition at line 6239 of file emdata_sparx.cpp.

#define R   (0.61803399f)
 

Definition at line 5945 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::find_3d_threshold(), EMAN::Transform::orthogonalize(), EMAN::NewLowpassGaussProcessor::process_inplace(), and EMAN::Util::triquad().

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

Definition at line 5808 of file emdata_sparx.cpp.

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

Definition at line 5808 of file emdata_sparx.cpp.

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

Definition at line 699 of file emdata_sparx.cpp.

Referenced by EMAN::EMData::calc_dist(), EMAN::EMData::calc_mutual_correlation(), EMAN::EMData::calc_sigma_diff(), EMAN::OptVarianceCmp::cmp(), EMAN::EMData::cog(), EMAN::EMData::do_radon(), EMAN::Util::get_stats_cstyle(), EMAN::EMData::little_big_dot(), and EMAN::BilateralProcessor::process_inplace().

#define X  )     X[i-1]
 

Definition at line 5809 of file emdata_sparx.cpp.

Referenced by EMAN::SVDAnalyzer::analyze(), Derivatives(), Derivatives_G(), EMAN::EMData::phase_cog(), Steepda(), Steepda_G(), EMAN::Util::svdcmp(), Utilit2(), and Utilit2_G().

#define Y  )     Y[j-1]
 

Definition at line 5810 of file emdata_sparx.cpp.

Referenced by Derivatives(), Derivatives_G(), EMAN::EMData::phase_cog(), Steepda(), Steepda_G(), Utilit2(), Utilit2_G(), and EMAN::Util::WTF().

#define Z  )     Z[k-1]
 

Definition at line 5811 of file emdata_sparx.cpp.

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


Function Documentation

float circumference EMData emdata,
int  npixel
 

Definition at line 6535 of file emdata_sparx.cpp.

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

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

06536 {
06537         int nx = emdata->get_xsize();
06538         int ny = emdata->get_ysize();
06539         int nz = emdata->get_zsize();
06540 
06541         float* data = emdata->get_data();
06542         if( ny==1 && nz==1 ) {
06543                 // 1d case
06544                 float sumf=0.0;
06545                 int   sumn=0;
06546                 for( int i=0; i < npixel; ++i ) {
06547                         sumf += data[i];
06548                         sumf += data[nx-1-i];
06549                         sumn += 2;
06550                 }
06551                 return sumf/sumn;
06552         }
06553 
06554         if( nz==1 ) {
06555                 float sumf=0.0;
06556                 int   sumn=0;
06557                 int   id=0;
06558                 for( int iy=0; iy < ny; ++iy ) {
06559                         for( int ix=0; ix < nx; ++ix ) {
06560                                 if( iy<npixel || iy>ny-1-npixel || ix<npixel || ix>nx-1-npixel ) {
06561                                     sumf += data[id];
06562                                     sumn += 1;
06563                                 }
06564                                 id++;
06565                         }
06566                 }
06567 
06568                 Assert( id==nx*ny  );
06569                 Assert( sumn == nx*ny - (nx-2*npixel)*(ny-2*npixel) );
06570                 return sumf/sumn;
06571         }
06572 
06573         // 3d cases;
06574 
06575         float sumf = 0.0;
06576         int   sumn = 0;
06577         int   id = 0;
06578         for( int iz=0; iz < nz; ++iz) {
06579                 for( int iy=0; iy < ny; ++iy) {
06580                         for( int ix=0; ix < nx; ++ix ) {
06581                                 if( iz<npixel||iz>nz-1-npixel||iy<npixel||iy>ny-1-npixel||ix<npixel||ix>nx-1-npixel) {
06582                                         sumf += data[id];
06583                                         sumn += 1;
06584                                 }
06585                                 id++;
06586                         }
06587                 }
06588         }
06589 
06590 
06591         Assert( id==nx*ny*nz);
06592         Assert( sumn==nx*ny*nz-(nx-2*npixel)*(ny-2*npixel)*(nz-2*npixel) );
06593         return sumf/sumn;
06594 }

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::Quaternion::normalize(), EMAN::MakeRadiusProcessor::process_dist_pixel(), EMAN::MaskGaussInvProcessor::process_dist_pixel(), EMAN::MaskGaussProcessor::process_dist_pixel(), EMAN::MaskNoiseProcessor::process_dist_pixel(), EMAN::MaskEdgeMeanProcessor::process_dist_pixel(), EMAN::MaskSharpProcessor::process_dist_pixel(), EMAN::RotationalSubstractProcessor::process_inplace(), EMAN::RotationalAverageProcessor::process_inplace(), EMAN::MaskGaussNonuniformProcessor::process_pixel(), EMAN::CircularMaskProcessor::process_pixel(), EMAN::PointArray::set_from_density_map(), trmesh_(), and EMAN::Util::trmsh3_().

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 4970 of file emdata_sparx.cpp.

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

04970                                                      {
04971     os <<  peak.x <<  peak.y << peak.z  << peak.value;
04972     return os;
04973 }

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

Helper function for EMData::fft_shuffle, below.

Definition at line 4006 of file emdata_sparx.cpp.

References b.

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

04006                                                                   {
04007         memcpy(temp, a, nbytes);
04008         memcpy(a, b, nbytes);
04009         memcpy(b, temp, nbytes);
04010 }


Generated on Thu Dec 9 13:46:09 2010 for EMAN2 by  doxygen 1.3.9.1