#include <reconstructor.h>
Inheritance diagram for EMAN::ReconstructorVolumeData:
Public Member Functions | |
ReconstructorVolumeData () | |
Only constructor All member variables are zeroed. | |
virtual | ~ReconstructorVolumeData () |
Destructor safely frees memory. | |
const EMData * | 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 | |
EMData * | image |
Inheriting class allocates this, probably in setup(). | |
EMData * | tmp_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. | |
ReconstructorVolumeData & | operator= (const ReconstructorVolumeData &) |
Disallow assignment. |
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 206 of file reconstructor.h.
|
Only constructor All member variables are zeroed.
Definition at line 212 of file reconstructor.h. 00212 : image(0), tmp_data(0), nx(0), ny(0), nz(0), subnx(0), subny(0), subnz(0), subx0(0), suby0(0), subz0(0) {}
|
|
Destructor safely frees memory.
Definition at line 216 of file reconstructor.h. References free_memory(). 00216 { free_memory(); }
|
|
Disallow copy construction.
|
|
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, and EMAN::FourierPlaneReconstructor. Definition at line 247 of file reconstructor.h. 00248 { 00249 if (image != 0) {delete image; image = 0;} 00250 if ( tmp_data != 0 ) { delete tmp_data; tmp_data = 0; } 00251 }
|
|
Get the main image pointer, probably redundant (not used).
Definition at line 220 of file reconstructor.h. 00220 { return image; }
|
|
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 258 of file reconstructor.cpp. References EMAN::EMData::get_data(), image, norm(), NullPointerException, nx, ny, nz, rdata, sqrt(), subnx, subny, subx0, tmp_data, and y. Referenced by EMAN::WienerFourierReconstructor::finish(), EMAN::FourierReconstructor::finish(), and EMAN::FourierReconstructorSimple2D::finish(). 00260 { 00261 float* norm = tmp_data->get_data(); 00262 float* rdata = image->get_data(); 00263 00264 // printf("%d %d %d %d %d %d\n",subnx,subny,subnz,image->get_xsize(),image->get_ysize(),image->get_zsize()); 00265 00266 // FIXME should throw a sensible error 00267 if ( 0 == norm ) throw NullPointerException("The normalization volume was null!"); 00268 if ( 0 == rdata ) throw NullPointerException("The complex reconstruction volume was null!"); 00269 00270 // The math is a bit tricky to explain. Wiener filter is basically SNR/(1+SNR) 00271 // In this case, data have already been effectively multiplied by SNR (one image at a time), 00272 // so without Wiener filter, we just divide by total SNR. With Wiener filter, we just add 00273 // 1.0 to total SNR, and we're done --steve 00274 float wfilt=0.0; 00275 if (wiener) wfilt=1.0; 00276 00277 for (size_t i = 0; i < (size_t)subnx * subny * subnz; i += 2) { 00278 float d = norm[i/2]; 00279 if (sqrt_damp) d*=sqrt(d); 00280 if (d == 0) { 00281 rdata[i] = 0; 00282 rdata[i + 1] = 0; 00283 } 00284 else { 00285 // rdata[i]=1.0/d; 00286 // rdata[i+1]=0.0; // for debugging only 00287 rdata[i] /= d+wfilt; 00288 rdata[i + 1] /= d+wfilt; 00289 } 00290 } 00291 00292 // enforce complex conj, only works on subvolumes if the complete conjugate plane is in the volume 00293 if (subx0==0 && subnx>1 && subny==ny && subnz==nz) { 00294 for (int z=0; z<=nz/2; z++) { 00295 for (int y=1; y<=ny; y++) { 00296 if (y==0 && z==0) continue; 00297 // x=0 00298 size_t i=(size_t)(y%ny)*subnx+(size_t)(z%nz)*subnx*subny; 00299 size_t i2=(size_t)(ny-y)*subnx+(size_t)((nz-z)%nz)*subnx*subny; 00300 float ar=(rdata[i]+rdata[i2])/2.0f; 00301 float ai=(rdata[i+1]-rdata[i2+1])/2.0f; 00302 rdata[i]=ar; 00303 rdata[i2]=ar; 00304 rdata[i+1]=ai; 00305 rdata[i2+1]=-ai; 00306 } 00307 } 00308 } 00309 00310 if (subx0+subnx==nx && subnx>1 && subny==ny && subnz==nz) { 00311 for (int z=0; z<=nz/2; z++) { 00312 for (int y=1; y<=ny; y++) { 00313 if (y==0 && z==0) continue; 00314 // x=0 00315 size_t i=(size_t)(y%ny)*subnx+(size_t)(z%nz)*subnx*subny+subnx-2; 00316 size_t i2=(size_t)(ny-y)*subnx+(size_t)((nz-z)%nz)*subnx*subny+subnx-2; 00317 float ar=(rdata[i]+rdata[i2])/2.0f; 00318 float ai=(rdata[i+1]-rdata[i2+1])/2.0f; 00319 rdata[i]=ar; 00320 rdata[i2]=ar; 00321 rdata[i+1]=ai; 00322 rdata[i2+1]=-ai; 00323 } 00324 } 00325 } 00326 }
|
|
Disallow assignment.
|
|
Sends the pixels in tmp_data and image to zero Convenience only.
Definition at line 263 of file reconstructor.h. References EMAN::EMData::to_zero(). 00264 { 00265 if (tmp_data != 0 ) tmp_data->to_zero(); 00266 if (image != 0 ) image->to_zero(); 00267 }
|
|
Inheriting class allocates this, probably in setup().
Definition at line 224 of file reconstructor.h. Referenced by normalize_threed(). |
|
Definition at line 229 of file reconstructor.h. Referenced by normalize_threed(). |
|
Definition at line 229 of file reconstructor.h. |
|
Definition at line 230 of file reconstructor.h. Referenced by normalize_threed(). |
|
Definition at line 230 of file reconstructor.h. |
|
Definition at line 231 of file reconstructor.h. Referenced by normalize_threed(). |
|
Definition at line 231 of file reconstructor.h. |
|
Definition at line 233 of file reconstructor.h. Referenced by normalize_threed(). |
|
Definition at line 234 of file reconstructor.h. Referenced by normalize_threed(). |
|
Definition at line 235 of file reconstructor.h. |
|
Definition at line 237 of file reconstructor.h. Referenced by normalize_threed(). |
|
Definition at line 238 of file reconstructor.h. |
|
Definition at line 239 of file reconstructor.h. |
|
Inheriting class may allocate this, probably in setup().
Definition at line 226 of file reconstructor.h. Referenced by normalize_threed(). |