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

reconstructor.cpp File Reference

#include "reconstructor.h"
#include "plugins/reconstructor_template.h"
#include "ctf.h"
#include "emassert.h"
#include "symmetry.h"
#include <cstring>
#include <fstream>
#include <iomanip>
#include <boost/bind.hpp>
#include <boost/format.hpp>
#include <gsl/gsl_statistics_double.h>
#include <gsl/gsl_fit.h>
#include <iostream>
#include <algorithm>
#include <sstream>

Include dependency graph for reconstructor.cpp:

Go to the source code of this file.

Defines

#define tw(i, j, k)   tw[ i-1 + (j-1+(k-1)*iy)*ix ]
#define tw(i, j, k)   tw[ i-1 + (j-1+(k-1)*iy)*ix ]
#define tw(i, j, k)   tw[ i-1 + (j-1+(k-1)*iy)*ix ]
#define tw(i, j, k)   tw[ i-1 + (j-1+(k-1)*iy)*ix ]

Enumerations

enum  weighting_method { NONE, ESTIMATE, VORONOI }

Functions

template<typename T>
void checked_delete (T *&x)
float max2d (int kc, const vector< float > &pow_a)
float max3d (int kc, const vector< float > &pow_a)
void printImage (const EMData *line)
void circumference (EMData *win)


Define Documentation

#define tw i,
j,
 )     tw[ i-1 + (j-1+(k-1)*iy)*ix ]
 

Definition at line 3221 of file reconstructor.cpp.

#define tw i,
j,
 )     tw[ i-1 + (j-1+(k-1)*iy)*ix ]
 

Definition at line 3221 of file reconstructor.cpp.

#define tw i,
j,
 )     tw[ i-1 + (j-1+(k-1)*iy)*ix ]
 

Definition at line 3221 of file reconstructor.cpp.

#define tw i,
j,
 )     tw[ i-1 + (j-1+(k-1)*iy)*ix ]
 

Definition at line 3221 of file reconstructor.cpp.

Referenced by circumference().


Enumeration Type Documentation

enum weighting_method
 

Enumeration values:
NONE 
ESTIMATE 
VORONOI 

Definition at line 2016 of file reconstructor.cpp.

02016 { NONE, ESTIMATE, VORONOI };


Function Documentation

template<typename T>
void checked_delete T *&  x  ) 
 

Definition at line 65 of file reconstructor.cpp.

References x.

Referenced by EMAN::file_store::add_image(), EMAN::newfile_store::add_image(), EMAN::nnSSNR_ctfReconstructor::insert_slice(), EMAN::nn4_ctfReconstructor::insert_slice(), EMAN::nnSSNR_Reconstructor::insert_slice(), EMAN::nn4Reconstructor::insert_slice(), EMAN::padfft_slice(), EMAN::nn4_ctfReconstructor::~nn4_ctfReconstructor(), EMAN::nn4Reconstructor::~nn4Reconstructor(), EMAN::nnSSNR_ctfReconstructor::~nnSSNR_ctfReconstructor(), and EMAN::nnSSNR_Reconstructor::~nnSSNR_Reconstructor().

00066 {
00067     typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
00068     (void) sizeof(type_must_be_complete);
00069     delete x;
00070     x = NULL;
00071 }

void circumference EMData win  ) 
 

Definition at line 2251 of file reconstructor.cpp.

References EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), and tw.

02252 {
02253         float *tw = win->get_data();
02254         //  mask and subtract circumference average
02255         int ix = win->get_xsize();
02256         int iy = win->get_ysize();
02257         int iz = win->get_zsize();
02258         int L2 = (ix/2)*(ix/2);
02259         int L2P = (ix/2-1)*(ix/2-1);
02260 
02261         int IP = ix/2+1;
02262         int JP = iy/2+1;
02263         int KP = iz/2+1;
02264 
02265         float  TNR = 0.0f;
02266         size_t m = 0;
02267         for (int k = 1; k <= iz; ++k) {
02268                 for (int j = 1; j <= iy; ++j) {
02269                         for (int i = 1; i <= ix; ++i) {
02270                                 size_t LR = (k-KP)*(k-KP)+(j-JP)*(j-JP)+(i-IP)*(i-IP);
02271                                 if (LR<=(size_t)L2) {
02272                                         if(LR >= (size_t)L2P && LR <= (size_t)L2) {
02273                                                 TNR += tw(i,j,k);
02274                                                 ++m;
02275                                         }
02276                                 }
02277                         }
02278                 }
02279         }
02280 
02281         TNR /=float(m);
02282         for (int k = 1; k <= iz; ++k) {
02283                 for (int j = 1; j <= iy; ++j) {
02284                         for (int i = 1; i <= ix; ++i) {
02285                                 size_t LR = (k-KP)*(k-KP)+(j-JP)*(j-JP)+(i-IP)*(i-IP);
02286                                 if (LR<=(size_t)L2) tw(i,j,k) -= TNR; else tw(i,j,k) = 0.0f;
02287                         }
02288                 }
02289         }
02290 
02291 }

float max2d int  kc,
const vector< float > &  pow_a
 

Definition at line 2018 of file reconstructor.cpp.

References abs, and max.

Referenced by EMAN::nn4Reconstructor::finish().

02019 {
02020         float max = 0.0;
02021         for( int i=-kc; i <= kc; ++i ) {
02022                 for( int j=-kc; j <= kc; ++j ) {
02023                         if( i==0 && j==0 ) continue;
02024                         {
02025                                 int c = 2*kc+1 - std::abs(i) - std::abs(j);
02026                                 max = max + pow_a[c];
02027                         }
02028                 }
02029         }
02030         return max;
02031 }

float max3d int  kc,
const vector< float > &  pow_a
 

Definition at line 2033 of file reconstructor.cpp.

References abs, and max.

Referenced by EMAN::nnSSNR_ctfReconstructor::finish(), EMAN::nn4_ctfReconstructor::finish(), EMAN::nnSSNR_Reconstructor::finish(), and EMAN::nn4Reconstructor::finish().

02034 {
02035         float max = 0.0;
02036         for( int i=-kc; i <= kc; ++i ) {
02037                 for( int j=-kc; j <= kc; ++j ) {
02038                         for( int k=-kc; k <= kc; ++k ) {
02039                                 if( i==0 && j==0 && k==0 ) continue;
02040                                 // if( i!=0 )
02041                                 {
02042                                         int c = 3*kc+1 - std::abs(i) - std::abs(j) - std::abs(k);
02043                                         max = max + pow_a[c];
02044                                         // max = max + c * c;
02045                                         // max = max + c;
02046                                 }
02047                         }
02048                 }
02049         }
02050         return max;
02051 }

void printImage const EMData line  ) 
 

Definition at line 2162 of file reconstructor.cpp.

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

02163 {
02164         Assert( line->get_zsize()==1 );
02165 
02166 
02167         int nx = line->get_xsize();
02168         int ny = line->get_ysize();
02169         for( int j=0; j < ny; ++j ) {
02170                 for( int i=0; i < nx; ++i )  printf( "%10.3f ", line->get_value_at(i,j) );
02171                 printf( "\n" );
02172         }
02173 }


Generated on Fri Apr 30 15:39:08 2010 for EMAN2 by  doxygen 1.3.9.1