EMAN::FourierGriddingProjector Class Reference

Fourier gridding projection routine. More...

#include <projector.h>

Inheritance diagram for EMAN::FourierGriddingProjector:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

EMDataproject3d (EMData *image) const
 Project an 3D image into a 2D image.
EMDatabackproject3d (EMData *image) const
 Back-project a 2D image into a 3D image.
string get_name () const
 Get the projector's name.
string get_desc () const
TypeDict get_param_types () const
 Get processor parameter information in a dictionary.

Static Public Member Functions

static ProjectorNEW ()

Static Public Attributes

static const string NAME = "fourier_gridding"

Detailed Description

Fourier gridding projection routine.

See also:
P. A. Penczek, R. Renka, and H. Schomberg, J. Opt. Soc. Am. A _21_, 499-509 (2004)

Definition at line 206 of file projector.h.


Member Function Documentation

EMData * FourierGriddingProjector::backproject3d ( EMData image  )  const [virtual]

Back-project a 2D image into a 3D image.

Returns:
A 3D image from the backprojection.

Implements EMAN::Projector.

Definition at line 2090 of file projector.cpp.

02091 {
02092    // no implementation yet
02093    EMData *ret = new EMData();
02094    return ret;
02095 }

string EMAN::FourierGriddingProjector::get_desc (  )  const [inline, virtual]

Implements EMAN::Projector.

Definition at line 219 of file projector.h.

00220                 {
00221                         return "Fourier-space projection using gridding.";
00222                 }

string EMAN::FourierGriddingProjector::get_name (  )  const [inline, virtual]

Get the projector's name.

Each projector is indentified by unique name.

Returns:
The projector's name.

Implements EMAN::Projector.

Definition at line 214 of file projector.h.

References NAME.

00215                 {
00216                         return NAME;
00217                 }

TypeDict EMAN::FourierGriddingProjector::get_param_types (  )  const [inline, virtual]

Get processor parameter information in a dictionary.

Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.

Returns:
A dictionary containing the parameter info.

Reimplemented from EMAN::Projector.

Definition at line 228 of file projector.h.

References EMAN::EMObject::FLOAT, EMAN::EMObject::FLOATARRAY, EMAN::EMObject::INT, EMAN::TypeDict::put(), EMAN::EMObject::STRING, and EMAN::EMObject::TRANSFORM.

00229                 {
00230                         TypeDict d;
00231                         d.put("transform", EMObject::TRANSFORM);
00232                         d.put("kb_alpha", EMObject::FLOAT);
00233                         d.put("kb_K", EMObject::FLOAT);
00234                         d.put("angletype", EMObject::STRING);
00235                         d.put("anglelist", EMObject::FLOATARRAY);
00236                         d.put("theta", EMObject::FLOAT);
00237                         d.put("psi", EMObject::FLOAT);
00238                         d.put("npad", EMObject::INT);
00239                         return d;
00240                 }

static Projector* EMAN::FourierGriddingProjector::NEW (  )  [inline, static]

Definition at line 224 of file projector.h.

00225                 {
00226                         return new FourierGriddingProjector();
00227                 }

EMData * FourierGriddingProjector::project3d ( EMData image  )  const [virtual]

Project an 3D image into a 2D image.

Returns:
A 2D image from the projection.

Implements EMAN::Projector.

Definition at line 1144 of file projector.cpp.

References anglelist, EMAN::EMData::center_origin_fft(), EMAN::EMData::copy(), EMAN::EMData::divkbsinh(), EMAN::EMData::do_fft_inplace(), EMAN::EMData::extract_plane(), EMAN::EMData::fft_shuffle(), EMAN::Util::get_min(), EMAN::EMData::get_ndim(), EMAN::Transform::get_rotation(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::Dict::has_key(), ImageDimensionException, ImageFormatException, EMAN::EMData::is_complex(), EMAN::EMData::norm_pad(), NullPointerException, nx, ny, EMAN::Projector::params, phi, proj, EMAN::EMData::set_attr(), EMAN::EMData::set_size(), EMAN::Dict::size(), tf(), theta, EMAN::EMData::to_zero(), and EMAN::EMData::update().

01145 {
01146         if (!image) {
01147                 return 0;
01148         }
01149         if (3 != image->get_ndim())
01150                 throw ImageDimensionException(
01151                                                                           "FourierGriddingProjector needs a 3-D volume");
01152         if (image->is_complex())
01153                 throw ImageFormatException(
01154                                                                    "FourierGriddingProjector requires a real volume");
01155         const int npad = params.has_key("npad") ? int(params["npad"]) : 2;
01156         const int nx = image->get_xsize();
01157         const int ny = image->get_ysize();
01158         const int nz = image->get_zsize();
01159         if (nx != ny || nx != nz)
01160                 throw ImageDimensionException(
01161                                                                           "FourierGriddingProjector requires nx==ny==nz");
01162         const int m = Util::get_min(nx,ny,nz);
01163         const int n = m*npad;
01164 
01165         int K = params["kb_K"];
01166         if ( K == 0 ) K = 6;
01167         float alpha = params["kb_alpha"];
01168         if ( alpha == 0 ) alpha = 1.25;
01169         Util::KaiserBessel kb(alpha, K, (float)(m/2), K/(2.0f*n), n);
01170 
01171         // divide out gridding weights
01172         EMData* tmpImage = image->copy();
01173         tmpImage->divkbsinh(kb);
01174         // pad and center volume, then FFT and multiply by (-1)**(i+j+k)
01175         //EMData* imgft = tmpImage->pad_fft(npad);
01176         //imgft->center_padded();
01177         EMData* imgft = tmpImage->norm_pad(false, npad);
01178         imgft->do_fft_inplace();
01179         imgft->center_origin_fft();
01180         imgft->fft_shuffle();
01181         delete tmpImage;
01182 
01183         // Do we have a list of angles?
01184         int nangles = 0;
01185         vector<float> anglelist;
01186         // Do we have a list of angles?
01187         if (params.has_key("anglelist")) {
01188                 anglelist = params["anglelist"];
01189                 nangles = anglelist.size() / 3;
01190         } else {
01191                 // This part was modified by David Woolford -
01192                 // Before this the code worked only for SPIDER and EMAN angles,
01193                 // but the framework of the Transform3D allows for a generic implementation
01194                 // as specified here.
01195                 Transform* t3d = params["transform"];
01196                 if ( t3d == NULL ) throw NullPointerException("The transform object (required for projection), was not specified");
01197                 Dict p = t3d->get_rotation("spider");
01198 
01199                 string angletype = "SPIDER";
01200                 float phi = p["phi"];
01201                 float theta = p["theta"];
01202                 float psi = p["psi"];
01203                 anglelist.push_back(phi);
01204                 anglelist.push_back(theta);
01205                 anglelist.push_back(psi);
01206                 nangles = 1;
01207                 if(t3d) {delete t3d; t3d=0;}
01208         }
01209 
01210         // End David Woolford modifications
01211 
01212         // initialize return object
01213         EMData* ret = new EMData();
01214         ret->set_size(nx, ny, nangles);
01215         ret->to_zero();
01216         // loop over sets of angles
01217         for (int ia = 0; ia < nangles; ia++) {
01218                 int indx = 3*ia;
01219                 Dict d("type","spider","phi",anglelist[indx],"theta",anglelist[indx+1],"psi",anglelist[indx+2]);
01220                 Transform tf(d);
01221                 EMData* proj = imgft->extract_plane(tf, kb);
01222                 if (proj->is_shuffled()) proj->fft_shuffle();
01223                 proj->center_origin_fft();
01224                 proj->do_ift_inplace();
01225                 EMData* winproj = proj->window_center(m);
01226                 delete proj;
01227                 for (int iy=0; iy < ny; iy++)
01228                         for (int ix=0; ix < nx; ix++)
01229                                 (*ret)(ix,iy,ia) = (*winproj)(ix,iy);
01230                 delete winproj;
01231         }
01232         delete imgft;
01233 
01234         if (!params.has_key("anglelist")) {
01235                 Transform* t3d = params["transform"];
01236                 ret->set_attr("xform.projection",t3d);
01237                 if(t3d) {delete t3d; t3d=0;}
01238         }
01239         ret->update();
01240         return ret;
01241 }


Member Data Documentation

const string FourierGriddingProjector::NAME = "fourier_gridding" [static]

Definition at line 242 of file projector.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Thu Nov 17 12:47:09 2011 for EMAN2 by  doxygen 1.4.7