#include <projector.h>
Inheritance diagram for EMAN::FourierGriddingProjector:
Public Member Functions | |
EMData * | project3d (EMData *image) const |
Project an 3D image into a 2D image. | |
EMData * | backproject3d (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 | |
Projector * | NEW () |
Static Public Attributes | |
const string | NAME = "fourier_gridding" |
Definition at line 206 of file projector.h.
|
Back-project a 2D image into a 3D image.
Implements EMAN::Projector. Definition at line 2258 of file projector.cpp.
|
|
Implements EMAN::Projector. Definition at line 219 of file projector.h. 00220 { 00221 return "Fourier-space projection using gridding."; 00222 }
|
|
Get the projector's name. Each projector is indentified by unique name.
Implements EMAN::Projector. Definition at line 214 of file projector.h. 00215 {
00216 return NAME;
00217 }
|
|
Get processor parameter information in a dictionary. Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Projector. Definition at line 228 of file projector.h. References EMAN::TypeDict::put(). 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 }
|
|
Definition at line 224 of file projector.h. 00225 { 00226 return new FourierGriddingProjector(); 00227 }
|
|
Project an 3D image into a 2D image.
Implements EMAN::Projector. Definition at line 1304 of file projector.cpp. References anglelist, EMAN::EMData::center_origin_fft(), EMAN::EMData::copy(), EMAN::EMData::divkbsinh(), EMAN::EMData::do_fft_inplace(), EMAN::EMData::do_ift_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::is_shuffled(), EMAN::EMData::norm_pad(), NullPointerException, nx, ny, phi, proj, EMAN::EMData::set_attr(), EMAN::EMData::set_size(), EMAN::Dict::size(), tf(), theta, EMAN::EMData::to_zero(), EMAN::EMData::update(), and EMAN::EMData::window_center(). 01305 { 01306 if (!image) { 01307 return 0; 01308 } 01309 if (3 != image->get_ndim()) 01310 throw ImageDimensionException( 01311 "FourierGriddingProjector needs a 3-D volume"); 01312 if (image->is_complex()) 01313 throw ImageFormatException( 01314 "FourierGriddingProjector requires a real volume"); 01315 const int npad = params.has_key("npad") ? int(params["npad"]) : 2; 01316 const int nx = image->get_xsize(); 01317 const int ny = image->get_ysize(); 01318 const int nz = image->get_zsize(); 01319 if (nx != ny || nx != nz) 01320 throw ImageDimensionException( 01321 "FourierGriddingProjector requires nx==ny==nz"); 01322 const int m = Util::get_min(nx,ny,nz); 01323 const int n = m*npad; 01324 01325 int K = params["kb_K"]; 01326 if ( K == 0 ) K = 6; 01327 float alpha = params["kb_alpha"]; 01328 if ( alpha == 0 ) alpha = 1.25; 01329 Util::KaiserBessel kb(alpha, K, (float)(m/2), K/(2.0f*n), n); 01330 01331 // divide out gridding weights 01332 EMData* tmpImage = image->copy(); 01333 tmpImage->divkbsinh(kb); 01334 // pad and center volume, then FFT and multiply by (-1)**(i+j+k) 01335 //EMData* imgft = tmpImage->pad_fft(npad); 01336 //imgft->center_padded(); 01337 EMData* imgft = tmpImage->norm_pad(false, npad); 01338 imgft->do_fft_inplace(); 01339 imgft->center_origin_fft(); 01340 imgft->fft_shuffle(); 01341 delete tmpImage; 01342 01343 // Do we have a list of angles? 01344 int nangles = 0; 01345 vector<float> anglelist; 01346 // Do we have a list of angles? 01347 if (params.has_key("anglelist")) { 01348 anglelist = params["anglelist"]; 01349 nangles = anglelist.size() / 3; 01350 } else { 01351 // This part was modified by David Woolford - 01352 // Before this the code worked only for SPIDER and EMAN angles, 01353 // but the framework of the Transform3D allows for a generic implementation 01354 // as specified here. 01355 Transform* t3d = params["transform"]; 01356 if ( t3d == NULL ) throw NullPointerException("The transform object (required for projection), was not specified"); 01357 Dict p = t3d->get_rotation("spider"); 01358 01359 string angletype = "SPIDER"; 01360 float phi = p["phi"]; 01361 float theta = p["theta"]; 01362 float psi = p["psi"]; 01363 anglelist.push_back(phi); 01364 anglelist.push_back(theta); 01365 anglelist.push_back(psi); 01366 nangles = 1; 01367 if(t3d) {delete t3d; t3d=0;} 01368 } 01369 01370 // End David Woolford modifications 01371 01372 // initialize return object 01373 EMData* ret = new EMData(); 01374 ret->set_size(nx, ny, nangles); 01375 ret->to_zero(); 01376 // loop over sets of angles 01377 for (int ia = 0; ia < nangles; ia++) { 01378 int indx = 3*ia; 01379 Dict d("type","spider","phi",anglelist[indx],"theta",anglelist[indx+1],"psi",anglelist[indx+2]); 01380 Transform tf(d); 01381 EMData* proj = imgft->extract_plane(tf, kb); 01382 if (proj->is_shuffled()) proj->fft_shuffle(); 01383 proj->center_origin_fft(); 01384 proj->do_ift_inplace(); 01385 EMData* winproj = proj->window_center(m); 01386 delete proj; 01387 for (int iy=0; iy < ny; iy++) 01388 for (int ix=0; ix < nx; ix++) 01389 (*ret)(ix,iy,ia) = (*winproj)(ix,iy); 01390 delete winproj; 01391 } 01392 delete imgft; 01393 01394 if (!params.has_key("anglelist")) { 01395 Transform* t3d = params["transform"]; 01396 ret->set_attr("xform.projection",t3d); 01397 if(t3d) {delete t3d; t3d=0;} 01398 } 01399 ret->update(); 01400 return ret; 01401 }
|
|
Definition at line 55 of file projector.cpp. |