#include <reconstructor.h>


Public Member Functions | |
| BackProjectionReconstructor () | |
| virtual | ~BackProjectionReconstructor () |
| virtual void | setup () |
| Initialize the reconstructor. | |
| virtual int | insert_slice (const EMData *const slice, const Transform3D &euler) |
| Insert an image slice to the reconstructor. | |
| virtual int | insert_slice (const EMData *const slice, const Transform &euler) |
| virtual EMData * | finish () |
| Finish reconstruction and return the complete model. | |
| virtual string | get_name () const |
| Get the unique name of this class (especially for factory based instantiation access). | |
| virtual string | get_desc () const |
| Get a clear, concise description of this class. | |
| virtual TypeDict | get_param_types () const |
Static Public Member Functions | |
| static Reconstructor * | NEW () |
Private Member Functions | |
| BackProjectionReconstructor (const BackProjectionReconstructor &that) | |
| BackProjectionReconstructor & | operator= (const BackProjectionReconstructor &) |
| void | load_default_settings () |
| EMData * | preprocess_slice (const EMData *const slice, const Transform &t) |
Back-projection is a method of 3D reconstruction from 2D projections. It is based on superposing 3D functions ("back-projection bodies") obtained by translating the 2D projections along the directions of projection.
Definition at line 731 of file reconstructor.h.
| EMAN::BackProjectionReconstructor::BackProjectionReconstructor | ( | ) | [inline] |
Definition at line 734 of file reconstructor.h.
References load_default_settings().
Referenced by NEW().
00734 { load_default_settings(); }
| virtual EMAN::BackProjectionReconstructor::~BackProjectionReconstructor | ( | ) | [inline, virtual] |
| EMAN::BackProjectionReconstructor::BackProjectionReconstructor | ( | const BackProjectionReconstructor & | that | ) | [private] |
| void BackProjectionReconstructor::setup | ( | ) | [virtual] |
Initialize the reconstructor.
Implements EMAN::Reconstructor.
Definition at line 1923 of file reconstructor.cpp.
References EMAN::ReconstructorVolumeData::image, EMAN::ReconstructorVolumeData::nx, EMAN::ReconstructorVolumeData::ny, EMAN::ReconstructorVolumeData::nz, EMAN::FactoryBase::params, and EMAN::EMData::set_size().
01924 { 01925 int size = params["size"]; 01926 image = new EMData(); 01927 nx = size; 01928 ny = size; 01929 if ( (int) params["zsample"] != 0 ) nz = params["zsample"]; 01930 else nz = size; 01931 image->set_size(nx, ny, nz); 01932 }
| virtual int EMAN::BackProjectionReconstructor::insert_slice | ( | const EMData *const | slice, | |
| const Transform3D & | euler | |||
| ) | [inline, virtual] |
Insert an image slice to the reconstructor.
To insert multiple image slices, call this function multiple times.
| slice | Image slice. | |
| euler | Euler angle of this image slice. |
Reimplemented from EMAN::Reconstructor.
Definition at line 740 of file reconstructor.h.
References UnexpectedBehaviorException.
00740 { 00741 throw UnexpectedBehaviorException("Use of Tranform3D with BackProjection is deprecated"); }
| int BackProjectionReconstructor::insert_slice | ( | const EMData *const | slice, | |
| const Transform & | euler | |||
| ) | [virtual] |
Reimplemented from EMAN::Reconstructor.
Definition at line 1954 of file reconstructor.cpp.
References EMAN::EMData::add(), EMAN::EMData::get_attr(), EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::has_attr(), EMAN::ReconstructorVolumeData::image, EMAN::Transform::invert(), LOGERR, EMAN::EMData::mult(), EMAN::ReconstructorVolumeData::nx, EMAN::ReconstructorVolumeData::ny, EMAN::ReconstructorVolumeData::nz, EMAN::FactoryBase::params, preprocess_slice(), EMAN::Transform::set_mirror(), EMAN::Transform::set_scale(), EMAN::EMData::set_size(), EMAN::Transform::set_trans(), EMAN::ReconstructorVolumeData::tmp_data, EMAN::EMData::transform(), and weight.
01955 { 01956 if (!input) { 01957 LOGERR("try to insert NULL slice"); 01958 return 1; 01959 } 01960 01961 if (input->get_xsize() != input->get_ysize() || input->get_xsize() != nx) { 01962 LOGERR("tried to insert image that was not correction dimensions"); 01963 return 1; 01964 } 01965 01966 Transform * transform; 01967 if ( input->has_attr("xform.projection") ) { 01968 transform = (Transform*) (input->get_attr("xform.projection")); // assignment operator 01969 } else { 01970 transform = new Transform(t); // assignment operator 01971 } 01972 EMData* slice = preprocess_slice(input, t); 01973 01974 float weight = params["weight"]; 01975 slice->mult(weight); 01976 01977 EMData *tmp = new EMData(); 01978 tmp->set_size(nx, ny, nz); 01979 01980 float *slice_data = slice->get_data(); 01981 float *tmp_data = tmp->get_data(); 01982 01983 size_t nxy = nx * ny; 01984 size_t nxy_size = nxy * sizeof(float);; 01985 for (int i = 0; i < nz; ++i) { 01986 memcpy(&tmp_data[nxy * i], slice_data, nxy_size); 01987 } 01988 01989 transform->set_scale(1.0); 01990 transform->set_mirror(false); 01991 transform->set_trans(0,0,0); 01992 transform->invert(); 01993 01994 tmp->transform(*transform); 01995 image->add(*tmp); 01996 01997 if(transform) {delete transform; transform=0;} 01998 delete tmp; 01999 delete slice; 02000 02001 return 0; 02002 }
| EMData * BackProjectionReconstructor::finish | ( | ) | [virtual] |
Finish reconstruction and return the complete model.
Implements EMAN::Reconstructor.
Definition at line 2004 of file reconstructor.cpp.
References EMAN::EMData::add(), EMAN::Symmetry3D::get_nsym(), EMAN::Symmetry3D::get_syms(), EMAN::ReconstructorVolumeData::image, EMAN::EMData::mult(), EMAN::FactoryBase::params, and EMAN::EMData::transform().
02005 { 02006 02007 Symmetry3D* sym = Factory<Symmetry3D>::get((string)params["sym"]); 02008 vector<Transform> syms = sym->get_syms(); 02009 02010 for ( vector<Transform>::const_iterator it = syms.begin(); it != syms.end(); ++it ) { 02011 02012 EMData tmpcopy(*image); 02013 tmpcopy.transform(*it); 02014 image->add(tmpcopy); 02015 } 02016 02017 image->mult(1.0f/(float)sym->get_nsym()); 02018 delete sym; 02019 return image; 02020 }
| virtual string EMAN::BackProjectionReconstructor::get_name | ( | ) | const [inline, virtual] |
Get the unique name of this class (especially for factory based instantiation access).
Implements EMAN::FactoryBase.
Definition at line 747 of file reconstructor.h.
| virtual string EMAN::BackProjectionReconstructor::get_desc | ( | ) | const [inline, virtual] |
Get a clear, concise description of this class.
Implements EMAN::FactoryBase.
Definition at line 752 of file reconstructor.h.
00753 { 00754 return "Simple (unfiltered) back-projection reconstruction. Weighting by contributing particles in the class average is optional and default behaviour"; 00755 }
| static Reconstructor* EMAN::BackProjectionReconstructor::NEW | ( | ) | [inline, static] |
Definition at line 757 of file reconstructor.h.
References BackProjectionReconstructor().
00758 { 00759 return new BackProjectionReconstructor(); 00760 }
| virtual TypeDict EMAN::BackProjectionReconstructor::get_param_types | ( | ) | const [inline, virtual] |
Implements EMAN::FactoryBase.
Definition at line 762 of file reconstructor.h.
References EMAN::EMObject::FLOAT, EMAN::EMObject::INT, EMAN::TypeDict::put(), and EMAN::EMObject::STRING.
00763 { 00764 TypeDict d; 00765 d.put("size", EMObject::INT, "Necessary. The x and y dimensions of the input images."); 00766 d.put("weight", EMObject::FLOAT, "Optional. A temporary value set prior to slice insertion, indicative of the inserted slice's weight. Default sis 1."); 00767 d.put("sym", EMObject::STRING, "Optional. The symmetry to impose on the final reconstruction. Default is c1"); 00768 d.put("zsample", EMObject::INT, "Optional. The z dimensions of the reconstructed volume."); 00769 return d; 00770 }
| BackProjectionReconstructor& EMAN::BackProjectionReconstructor::operator= | ( | const BackProjectionReconstructor & | ) | [private] |
| void EMAN::BackProjectionReconstructor::load_default_settings | ( | ) | [inline, private] |
Definition at line 777 of file reconstructor.h.
References EMAN::FactoryBase::params.
Referenced by BackProjectionReconstructor().
00778 { 00779 params["weight"] = 1.0; 00780 params["use_weights"] = true; 00781 params["size"] = 0; 00782 params["sym"] = "c1"; 00783 params["zsample"] = 0; 00784 }
| EMData * BackProjectionReconstructor::preprocess_slice | ( | const EMData *const | slice, | |
| const Transform & | t | |||
| ) | [private] |
Definition at line 1934 of file reconstructor.cpp.
References EMAN::Transform::get_mirror(), EMAN::Transform::get_scale(), EMAN::Transform::get_trans_2d(), EMAN::EMData::process(), EMAN::EMData::process_inplace(), EMAN::Transform::set_rotation(), and EMAN::EMData::transform().
Referenced by insert_slice().
01935 { 01936 01937 EMData* return_slice = slice->process("normalize.edgemean"); 01938 return_slice->process_inplace("filter.linearfourier"); 01939 01940 Transform tmp(t); 01941 tmp.set_rotation(Dict("type","eman")); // resets the rotation to 0 implicitly 01942 Vec2f trans = tmp.get_trans_2d(); 01943 float scale = tmp.get_scale(); 01944 bool mirror = tmp.get_mirror(); 01945 if (trans[0] != 0 || trans[1] != 0 || scale != 1.0 ) { 01946 return_slice->transform(tmp); 01947 } else if ( mirror == true ) { 01948 return_slice = slice->process("xform.flip",Dict("axis","x")); 01949 } 01950 01951 return return_slice; 01952 }
1.5.6