EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
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]

Public Member Functions

EMDataproject3d (EMData *image) const
 Project an 3D image into a 2D image. More...
 
EMDatabackproject3d (EMData *image) const
 Back-project a 2D image into a 3D image. More...
 
string get_name () const
 Get the projector's name. More...
 
string get_desc () const
 
TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 
- Public Member Functions inherited from EMAN::Projector
virtual ~Projector ()
 
virtual Dict get_params () const
 Get the projector parameters in a key/value dictionary. More...
 
void set_params (const Dict &new_params)
 Set the projector parameters using a key/value dictionary. More...
 

Static Public Member Functions

static ProjectorNEW ()
 

Static Public Attributes

static const string NAME = "fourier_gridding"
 

Additional Inherited Members

- Protected Attributes inherited from EMAN::Projector
Dict params
 

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 203 of file projector.h.

Member Function Documentation

◆ backproject3d()

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 2144 of file projector.cpp.

2145{
2146 // no implementation yet
2147 EMData *ret = new EMData();
2148 return ret;
2149}
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82

◆ get_desc()

string EMAN::FourierGriddingProjector::get_desc ( ) const
inlinevirtual

Implements EMAN::Projector.

Definition at line 216 of file projector.h.

217 {
218 return "Fourier-space projection using gridding.";
219 }

◆ get_name()

string EMAN::FourierGriddingProjector::get_name ( ) const
inlinevirtual

Get the projector's name.

Each projector is indentified by unique name.

Returns
The projector's name.

Implements EMAN::Projector.

Definition at line 211 of file projector.h.

212 {
213 return NAME;
214 }
static const string NAME
Definition: projector.h:239

References NAME.

◆ get_param_types()

TypeDict EMAN::FourierGriddingProjector::get_param_types ( ) const
inlinevirtual

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 225 of file projector.h.

226 {
227 TypeDict d;
228 d.put("transform", EMObject::TRANSFORM);
229 d.put("kb_alpha", EMObject::FLOAT);
230 d.put("kb_K", EMObject::FLOAT);
231 d.put("angletype", EMObject::STRING);
232 d.put("anglelist", EMObject::FLOATARRAY);
233 d.put("theta", EMObject::FLOAT);
234 d.put("psi", EMObject::FLOAT);
235 d.put("npad", EMObject::INT);
236 return d;
237 }

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

◆ NEW()

static Projector * EMAN::FourierGriddingProjector::NEW ( )
inlinestatic

Definition at line 221 of file projector.h.

222 {
223 return new FourierGriddingProjector();
224 }

◆ project3d()

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 1190 of file projector.cpp.

1191{
1192 if (!image) {
1193 return 0;
1194 }
1195 if (3 != image->get_ndim())
1197 "FourierGriddingProjector needs a 3-D volume");
1198 if (image->is_complex())
1200 "FourierGriddingProjector requires a real volume");
1201 const int npad = params.has_key("npad") ? int(params["npad"]) : 2;
1202 const int nx = image->get_xsize();
1203 const int ny = image->get_ysize();
1204 const int nz = image->get_zsize();
1205 if (nx != ny || nx != nz)
1207 "FourierGriddingProjector requires nx==ny==nz");
1208 const int m = Util::get_min(nx,ny,nz);
1209 const int n = m*npad;
1210
1211 int K = params["kb_K"];
1212 if ( K == 0 ) K = 6;
1213 float alpha = params["kb_alpha"];
1214 if ( alpha == 0 ) alpha = 1.25;
1215 Util::KaiserBessel kb(alpha, K, (float)(m/2), K/(2.0f*n), n);
1216
1217 // divide out gridding weights
1218 EMData* tmpImage = image->copy();
1219 tmpImage->divkbsinh(kb);
1220 // pad and center volume, then FFT and multiply by (-1)**(i+j+k)
1221 //EMData* imgft = tmpImage->pad_fft(npad);
1222 //imgft->center_padded();
1223 EMData* imgft = tmpImage->norm_pad(false, npad);
1224 imgft->do_fft_inplace();
1225 imgft->center_origin_fft();
1226 imgft->fft_shuffle();
1227 delete tmpImage;
1228
1229 // Do we have a list of angles?
1230 int nangles = 0;
1231 vector<float> anglelist;
1232 // Do we have a list of angles?
1233 if (params.has_key("anglelist")) {
1234 anglelist = params["anglelist"];
1235 nangles = anglelist.size() / 3;
1236 } else {
1237 // This part was modified by David Woolford -
1238 // Before this the code worked only for SPIDER and EMAN angles,
1239 // but the framework of the Transform3D allows for a generic implementation
1240 // as specified here.
1241 Transform* t3d = params["transform"];
1242 if ( t3d == NULL ) throw NullPointerException("The transform object (required for projection), was not specified");
1243 Dict p = t3d->get_rotation("spider");
1244
1245 string angletype = "SPIDER";
1246 float phi = p["phi"];
1247 float theta = p["theta"];
1248 float psi = p["psi"];
1249 anglelist.push_back(phi);
1250 anglelist.push_back(theta);
1251 anglelist.push_back(psi);
1252 nangles = 1;
1253 if(t3d) {delete t3d; t3d=0;}
1254 }
1255
1256 // End David Woolford modifications
1257
1258 // initialize return object
1259 EMData* ret = new EMData();
1260 ret->set_size(nx, ny, nangles);
1261 ret->to_zero();
1262 // loop over sets of angles
1263 for (int ia = 0; ia < nangles; ia++) {
1264 int indx = 3*ia;
1265 Dict d("type","spider","phi",anglelist[indx],"theta",anglelist[indx+1],"psi",anglelist[indx+2]);
1266 Transform tf(d);
1267 EMData* proj = imgft->extract_plane(tf, kb);
1268 if (proj->is_shuffled()) proj->fft_shuffle();
1269 proj->center_origin_fft();
1270 proj->do_ift_inplace();
1271 EMData* winproj = proj->window_center(m);
1272 delete proj;
1273 for (int iy=0; iy < ny; iy++)
1274 for (int ix=0; ix < nx; ix++)
1275 (*ret)(ix,iy,ia) = (*winproj)(ix,iy);
1276 delete winproj;
1277 }
1278 delete imgft;
1279
1280 if (!params.has_key("anglelist")) {
1281 Transform* t3d = params["transform"];
1282 ret->set_attr("xform.projection",t3d);
1283 if(t3d) {delete t3d; t3d=0;}
1284 }
1285 ret->update();
1286 return ret;
1287}
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
bool has_key(const string &key) const
Ask the Dictionary if it as a particular key.
Definition: emobject.h:511
EMData * window_center(int l)
Window the center of an image.
Definition: emdata.cpp:776
A Transform object is a somewhat specialized object designed specifically for EMAN2/Sparx storage of ...
Definition: transform.h:75
Dict get_rotation(const string &euler_type="eman") const
Get a rotation in any Euler format.
Definition: transform.cpp:829
static int get_min(int f1, int f2)
Get the minimum of 2 numbers.
Definition: util.h:922
#define ImageFormatException(desc)
Definition: exception.h:147
#define ImageDimensionException(desc)
Definition: exception.h:166
#define NullPointerException(desc)
Definition: exception.h:241
#define anglelist(i, j)
Definition: projector.cpp:1607

References anglelist, EMAN::Util::get_min(), EMAN::Transform::get_rotation(), EMAN::Dict::has_key(), ImageDimensionException, ImageFormatException, NullPointerException, EMAN::Projector::params, and EMAN::EMData::window_center().

Member Data Documentation

◆ NAME

const string FourierGriddingProjector::NAME = "fourier_gridding"
static

Definition at line 239 of file projector.h.

Referenced by get_name().


The documentation for this class was generated from the following files: