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

EMAN::ReconstructorVolumeData Class Reference

This is a Mixin class A class object encapsulating the volume data required by Reconstructors It basically stores two (pointers) to EMData objectsd stores the dimensions of the image volume. More...

#include <reconstructor.h>

Inheritance diagram for EMAN::ReconstructorVolumeData:

Inheritance graph
[legend]
Collaboration diagram for EMAN::ReconstructorVolumeData:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ReconstructorVolumeData ()
 Only constructor All member variables are zeroed.
virtual ~ReconstructorVolumeData ()
 Destructor safely frees memory.
const EMData *const get_emdata ()
 Get the main image pointer, probably redundant (not used).

Protected Member Functions

void free_memory ()
 Free allocated memorys The inherited class may have allocated image of tmp_data In either case you can safely call this function to delete either of those pointers, even if they bdb:refine_03::threed_00are NULL.
virtual void normalize_threed (const bool sqrt_damp=false, const bool wiener=false)
 Normalize on the assumption that image is a Fourier volume and that tmp_data is a volume of weights corresponding in size to this Fourier volume.
virtual void zero_memory ()
 Sends the pixels in tmp_data and image to zero Convenience only.

Protected Attributes

EMDataimage
 Inheriting class allocates this, probably in setup().
EMDatatmp_data
 Inheriting class may allocate this, probably in setup().
int nx
int nx2
int ny
int ny2
int nz
int nz2
int subnx
int subny
int subnz
int subx0
int suby0
int subz0

Private Member Functions

 ReconstructorVolumeData (const ReconstructorVolumeData &that)
 Disallow copy construction.
ReconstructorVolumeDataoperator= (const ReconstructorVolumeData &)
 Disallow assignment.

Detailed Description

This is a Mixin class A class object encapsulating the volume data required by Reconstructors It basically stores two (pointers) to EMData objectsd stores the dimensions of the image volume.

One EMData object basically stores the real pixel data, the other is used for storing normalization values. This class was originally added simply to encapsulate the the things common to FourierReconstructor, WienerFourierReconstructor and BackProjectionReconstructor. It was never expected to instantiated on its own, and is intended to be a parent of the Reconstructor class. d.woolford May 2007

Definition at line 202 of file reconstructor.h.


Constructor & Destructor Documentation

EMAN::ReconstructorVolumeData::ReconstructorVolumeData  )  [inline]
 

Only constructor All member variables are zeroed.

Definition at line 208 of file reconstructor.h.

00208 : image(0), tmp_data(0), nx(0), ny(0), nz(0), subnx(0), subny(0), subnz(0), subx0(0), suby0(0), subz0(0) {}

virtual EMAN::ReconstructorVolumeData::~ReconstructorVolumeData  )  [inline, virtual]
 

Destructor safely frees memory.

Definition at line 212 of file reconstructor.h.

References free_memory().

00212 { free_memory(); }

EMAN::ReconstructorVolumeData::ReconstructorVolumeData const ReconstructorVolumeData that  )  [private]
 

Disallow copy construction.


Member Function Documentation

void EMAN::ReconstructorVolumeData::free_memory  )  [inline, protected]
 

Free allocated memorys The inherited class may have allocated image of tmp_data In either case you can safely call this function to delete either of those pointers, even if they bdb:refine_03::threed_00are NULL.

Reimplemented in EMAN::FourierReconstructor.

Definition at line 243 of file reconstructor.h.

References image, and tmp_data.

Referenced by ~ReconstructorVolumeData().

00244                         {
00245                                 if (image != 0)  {delete image; image = 0;}
00246                                 if ( tmp_data != 0 ) { delete tmp_data; tmp_data = 0; }
00247                         }

const EMData* const EMAN::ReconstructorVolumeData::get_emdata  )  [inline]
 

Get the main image pointer, probably redundant (not used).

Definition at line 216 of file reconstructor.h.

References image.

00216 { return image; }

void ReconstructorVolumeData::normalize_threed const bool  sqrt_damp = false,
const bool  wiener = false
[protected, virtual]
 

Normalize on the assumption that image is a Fourier volume and that tmp_data is a volume of weights corresponding in size to this Fourier volume.

This means tmp_data is assumed to have have as many x pixels as image.

Definition at line 246 of file reconstructor.cpp.

References EMAN::EMData::get_data(), image, norm(), NullPointerException, nx, ny, nz, rdata, sqrt(), subnx, subny, subnz, subx0, tmp_data, and y.

Referenced by EMAN::WienerFourierReconstructor::finish(), EMAN::FourierReconstructor::finish(), and EMAN::FourierReconstructorSimple2D::finish().

00248 {
00249         float* norm = tmp_data->get_data();
00250         float* rdata = image->get_data();
00251 
00252 //      printf("%d %d %d %d %d %d\n",subnx,subny,subnz,image->get_xsize(),image->get_ysize(),image->get_zsize());
00253 
00254         // FIXME should throw a sensible error
00255         if ( 0 == norm ) throw NullPointerException("The normalization volume was null!");
00256         if ( 0 == rdata ) throw NullPointerException("The complex reconstruction volume was null!");
00257 
00258         // The math is a bit tricky to explain. Wiener filter is basically SNR/(1+SNR)
00259         // In this case, data have already been effectively multiplied by SNR (one image at a time),
00260         // so without Wiener filter, we just divide by total SNR. With Wiener filter, we just add
00261         // 1.0 to total SNR, and we're done             --steve
00262         float wfilt=0.0;
00263         if (wiener) wfilt=1.0;          
00264         
00265         for (int i = 0; i < subnx * subny * subnz; i += 2) {
00266                 float d = norm[i/2];
00267                 if (sqrt_damp) d*=sqrt(d);
00268                 if (d == 0) {
00269                         rdata[i] = 0;
00270                         rdata[i + 1] = 0;
00271                 }
00272                 else {
00273 //                      rdata[i]=1.0/d;
00274 //                      rdata[i+1]=0.0;         // for debugging only
00275                         rdata[i] /= d+wfilt;
00276                         rdata[i + 1] /= d+wfilt;
00277                 }
00278         }
00279 
00280         // enforce complex conj, only works on subvolumes if the complete conjugate plane is in the volume
00281         if (subx0==0 && subnx>1 && subny==ny && subnz==nz) {
00282                 for (int z=0; z<=nz/2; z++) {
00283                         for (int y=1; y<=ny; y++) {
00284                                 if (y==0 && z==0) continue;
00285                                 // x=0
00286                                 int i=(y%ny)*subnx+(z%nz)*subnx*subny;
00287                                 int i2=(ny-y)*subnx+((nz-z)%nz)*subnx*subny;
00288                                 float ar=(rdata[i]+rdata[i2])/2.0f;
00289                                 float ai=(rdata[i+1]-rdata[i2+1])/2.0f;
00290                                 rdata[i]=ar;
00291                                 rdata[i2]=ar;
00292                                 rdata[i+1]=ai;
00293                                 rdata[i2+1]=-ai;
00294                         }
00295                 }
00296         }
00297 
00298         if (subx0+subnx==nx && subnx>1 && subny==ny && subnz==nz) {
00299                 for (int z=0; z<=nz/2; z++) {
00300                         for (int y=1; y<=ny; y++) {
00301                                 if (y==0 && z==0) continue;
00302                                 // x=0
00303                                 int i=(y%ny)*subnx+(z%nz)*subnx*subny+subnx-2;
00304                                 int i2=(ny-y)*subnx+((nz-z)%nz)*subnx*subny+subnx-2;
00305                                 float ar=(rdata[i]+rdata[i2])/2.0f;
00306                                 float ai=(rdata[i+1]-rdata[i2+1])/2.0f;
00307                                 rdata[i]=ar;
00308                                 rdata[i2]=ar;
00309                                 rdata[i+1]=ai;
00310                                 rdata[i2+1]=-ai;
00311                         }
00312                 }
00313         }
00314 }

ReconstructorVolumeData& EMAN::ReconstructorVolumeData::operator= const ReconstructorVolumeData  )  [private]
 

Disallow assignment.

virtual void EMAN::ReconstructorVolumeData::zero_memory  )  [inline, protected, virtual]
 

Sends the pixels in tmp_data and image to zero Convenience only.

Definition at line 259 of file reconstructor.h.

References image, tmp_data, and EMAN::EMData::to_zero().

00260                         {
00261                                 if (tmp_data != 0 ) tmp_data->to_zero();
00262                                 if (image != 0 ) image->to_zero();
00263                         }


Member Data Documentation

EMData* EMAN::ReconstructorVolumeData::image [protected]
 

Inheriting class allocates this, probably in setup().

Definition at line 220 of file reconstructor.h.

Referenced by EMAN::BackProjectionReconstructor::finish(), EMAN::WienerFourierReconstructor::finish(), EMAN::FourierReconstructor::finish(), EMAN::FourierReconstructorSimple2D::finish(), free_memory(), EMAN::FourierReconstructor::free_memory(), get_emdata(), EMAN::BackProjectionReconstructor::insert_slice(), EMAN::FourierReconstructorSimple2D::insert_slice(), EMAN::FourierReconstructor::load_default_settings(), EMAN::FourierReconstructor::load_inserter(), normalize_threed(), EMAN::WienerFourierReconstructor::pixel_at(), EMAN::FourierReconstructor::pixel_at(), EMAN::BackProjectionReconstructor::setup(), EMAN::FourierReconstructor::setup(), EMAN::FourierReconstructorSimple2D::setup(), EMAN::FourierReconstructor::setup_seed(), and zero_memory().

int EMAN::ReconstructorVolumeData::nx [protected]
 

Definition at line 225 of file reconstructor.h.

Referenced by EMAN::WienerFourierReconstructor::do_compare_slice_work(), EMAN::FourierReconstructor::do_compare_slice_work(), EMAN::WienerFourierReconstructor::do_insert_slice_work(), EMAN::FourierReconstructor::do_insert_slice_work(), EMAN::BackProjectionReconstructor::insert_slice(), EMAN::FourierReconstructorSimple2D::insert_slice(), normalize_threed(), EMAN::WienerFourierReconstructor::pixel_at(), EMAN::FourierReconstructor::pixel_at(), EMAN::BackProjectionReconstructor::setup(), EMAN::FourierReconstructor::setup(), EMAN::FourierReconstructorSimple2D::setup(), and EMAN::FourierReconstructor::setup_seed().

int EMAN::ReconstructorVolumeData::nx2 [protected]
 

Definition at line 225 of file reconstructor.h.

Referenced by EMAN::WienerFourierReconstructor::pixel_at(), EMAN::FourierReconstructor::pixel_at(), EMAN::FourierReconstructor::setup(), and EMAN::FourierReconstructor::setup_seed().

int EMAN::ReconstructorVolumeData::ny [protected]
 

Definition at line 226 of file reconstructor.h.

Referenced by EMAN::WienerFourierReconstructor::do_compare_slice_work(), EMAN::FourierReconstructor::do_compare_slice_work(), EMAN::WienerFourierReconstructor::do_insert_slice_work(), EMAN::FourierReconstructor::do_insert_slice_work(), EMAN::BackProjectionReconstructor::insert_slice(), EMAN::FourierReconstructorSimple2D::insert_slice(), normalize_threed(), EMAN::WienerFourierReconstructor::pixel_at(), EMAN::FourierReconstructor::pixel_at(), EMAN::BackProjectionReconstructor::setup(), EMAN::FourierReconstructor::setup(), EMAN::FourierReconstructorSimple2D::setup(), and EMAN::FourierReconstructor::setup_seed().

int EMAN::ReconstructorVolumeData::ny2 [protected]
 

Definition at line 226 of file reconstructor.h.

Referenced by EMAN::WienerFourierReconstructor::pixel_at(), EMAN::FourierReconstructor::pixel_at(), EMAN::FourierReconstructor::setup(), and EMAN::FourierReconstructor::setup_seed().

int EMAN::ReconstructorVolumeData::nz [protected]
 

Definition at line 227 of file reconstructor.h.

Referenced by EMAN::WienerFourierReconstructor::do_compare_slice_work(), EMAN::FourierReconstructor::do_compare_slice_work(), EMAN::WienerFourierReconstructor::do_insert_slice_work(), EMAN::FourierReconstructor::do_insert_slice_work(), EMAN::BackProjectionReconstructor::insert_slice(), normalize_threed(), EMAN::WienerFourierReconstructor::pixel_at(), EMAN::FourierReconstructor::pixel_at(), EMAN::BackProjectionReconstructor::setup(), EMAN::FourierReconstructor::setup(), and EMAN::FourierReconstructor::setup_seed().

int EMAN::ReconstructorVolumeData::nz2 [protected]
 

Definition at line 227 of file reconstructor.h.

Referenced by EMAN::WienerFourierReconstructor::pixel_at(), EMAN::FourierReconstructor::pixel_at(), EMAN::FourierReconstructor::setup(), and EMAN::FourierReconstructor::setup_seed().

int EMAN::ReconstructorVolumeData::subnx [protected]
 

Definition at line 229 of file reconstructor.h.

Referenced by EMAN::WienerFourierReconstructor::do_compare_slice_work(), EMAN::FourierReconstructor::do_compare_slice_work(), normalize_threed(), EMAN::WienerFourierReconstructor::pixel_at(), EMAN::FourierReconstructor::pixel_at(), EMAN::FourierReconstructor::setup(), and EMAN::FourierReconstructor::setup_seed().

int EMAN::ReconstructorVolumeData::subny [protected]
 

Definition at line 230 of file reconstructor.h.

Referenced by EMAN::WienerFourierReconstructor::do_compare_slice_work(), EMAN::FourierReconstructor::do_compare_slice_work(), normalize_threed(), EMAN::FourierReconstructor::setup(), and EMAN::FourierReconstructor::setup_seed().

int EMAN::ReconstructorVolumeData::subnz [protected]
 

Definition at line 231 of file reconstructor.h.

Referenced by EMAN::WienerFourierReconstructor::do_compare_slice_work(), EMAN::FourierReconstructor::do_compare_slice_work(), normalize_threed(), EMAN::FourierReconstructor::setup(), and EMAN::FourierReconstructor::setup_seed().

int EMAN::ReconstructorVolumeData::subx0 [protected]
 

Definition at line 233 of file reconstructor.h.

Referenced by normalize_threed(), EMAN::WienerFourierReconstructor::pixel_at(), EMAN::FourierReconstructor::pixel_at(), EMAN::FourierReconstructor::setup(), and EMAN::FourierReconstructor::setup_seed().

int EMAN::ReconstructorVolumeData::suby0 [protected]
 

Definition at line 234 of file reconstructor.h.

Referenced by EMAN::WienerFourierReconstructor::pixel_at(), EMAN::FourierReconstructor::pixel_at(), EMAN::FourierReconstructor::setup(), and EMAN::FourierReconstructor::setup_seed().

int EMAN::ReconstructorVolumeData::subz0 [protected]
 

Definition at line 235 of file reconstructor.h.

Referenced by EMAN::WienerFourierReconstructor::pixel_at(), EMAN::FourierReconstructor::pixel_at(), EMAN::FourierReconstructor::setup(), and EMAN::FourierReconstructor::setup_seed().

EMData* EMAN::ReconstructorVolumeData::tmp_data [protected]
 

Inheriting class may allocate this, probably in setup().

Definition at line 222 of file reconstructor.h.

Referenced by EMAN::WienerFourierReconstructor::determine_slice_agreement(), EMAN::WienerFourierReconstructor::finish(), EMAN::FourierReconstructor::finish(), free_memory(), EMAN::FourierReconstructor::free_memory(), EMAN::BackProjectionReconstructor::insert_slice(), EMAN::FourierReconstructorSimple2D::insert_slice(), EMAN::FourierReconstructor::load_default_settings(), EMAN::FourierReconstructor::load_inserter(), normalize_threed(), EMAN::WienerFourierReconstructor::pixel_at(), EMAN::FourierReconstructor::pixel_at(), EMAN::FourierReconstructor::setup(), EMAN::FourierReconstructorSimple2D::setup(), EMAN::FourierReconstructor::setup_seed(), and zero_memory().


The documentation for this class was generated from the following files:
Generated on Mon Jul 19 13:07:35 2010 for EMAN2 by  doxygen 1.4.4