#include <reconstructor.h>
Inheritance diagram for EMAN::BackProjectionReconstructor:
Public Member Functions | |
BackProjectionReconstructor () | |
virtual | ~BackProjectionReconstructor () |
virtual void | setup () |
Initialize the reconstructor. | |
virtual int | insert_slice (const EMData *const slice, const Transform &euler, const float weight=1.0) |
Insert an image slice to the reconstructor. | |
virtual EMData * | finish (bool doift=true) |
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 | |
Reconstructor * | NEW () |
Static Public Attributes | |
const string | NAME = "back_projection" |
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) |
While you can just insert unprocessed slices, if you call preprocess_slice yourself, and insert the returned slice instead, repeatedly, it can save a fair bit of computation. |
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 649 of file reconstructor.h.
|
Definition at line 652 of file reconstructor.h. 00652 { load_default_settings(); }
|
|
Definition at line 654 of file reconstructor.h. 00654 {}
|
|
|
|
Finish reconstruction and return the complete model.
Reimplemented from EMAN::Reconstructor. Definition at line 1814 of file reconstructor.cpp. References EMAN::EMData::add(), EMAN::Factory< T >::get(), EMAN::Symmetry3D::get_nsym(), EMAN::Symmetry3D::get_syms(), EMAN::EMData::mult(), and EMAN::EMData::transform(). 01815 { 01816 01817 Symmetry3D* sym = Factory<Symmetry3D>::get((string)params["sym"]); 01818 vector<Transform> syms = sym->get_syms(); 01819 01820 for ( vector<Transform>::const_iterator it = syms.begin(); it != syms.end(); ++it ) { 01821 01822 EMData tmpcopy(*image); 01823 tmpcopy.transform(*it); 01824 image->add(tmpcopy); 01825 } 01826 01827 image->mult(1.0f/(float)sym->get_nsym()); 01828 delete sym; 01829 return image; 01830 }
|
|
Get a clear, concise description of this class.
Implements EMAN::FactoryBase. Definition at line 675 of file reconstructor.h. 00676 { 00677 return "Simple (unfiltered) back-projection reconstruction. Weighting by contributing particles in the class average is optional and default behaviour"; 00678 }
|
|
Get the unique name of this class (especially for factory based instantiation access).
Implements EMAN::FactoryBase. Definition at line 670 of file reconstructor.h. 00671 {
00672 return NAME;
00673 }
|
|
Implements EMAN::FactoryBase. Definition at line 685 of file reconstructor.h. References EMAN::TypeDict::put(). 00686 { 00687 TypeDict d; 00688 d.put("size", EMObject::INT, "Necessary. The x and y dimensions of the input images."); 00689 d.put("weight", EMObject::FLOAT, "Optional. A temporary value set prior to slice insertion, indicative of the inserted slice's weight. Default sis 1."); 00690 d.put("sym", EMObject::STRING, "Optional. The symmetry to impose on the final reconstruction. Default is c1"); 00691 d.put("zsample", EMObject::INT, "Optional. The z dimensions of the reconstructed volume."); 00692 return d; 00693 }
|
|
Insert an image slice to the reconstructor. To insert multiple image slices, call this function multiple times.
Reimplemented from EMAN::Reconstructor. Definition at line 1764 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::Transform::invert(), LOGERR, EMAN::EMData::mult(), preprocess_slice(), EMAN::Transform::set_mirror(), EMAN::Transform::set_scale(), EMAN::EMData::set_size(), EMAN::Transform::set_trans(), t, EMAN::EMData::transform(), and weight. 01765 { 01766 if (!input) { 01767 LOGERR("try to insert NULL slice"); 01768 return 1; 01769 } 01770 01771 if (input->get_xsize() != input->get_ysize() || input->get_xsize() != nx) { 01772 LOGERR("tried to insert image that was not correction dimensions"); 01773 return 1; 01774 } 01775 01776 Transform * transform; 01777 if ( input->has_attr("xform.projection") ) { 01778 transform = (Transform*) (input->get_attr("xform.projection")); // assignment operator 01779 } else { 01780 transform = new Transform(t); // assignment operator 01781 } 01782 EMData* slice = preprocess_slice(input, t); 01783 01784 float weight = params["weight"]; 01785 slice->mult(weight); 01786 01787 EMData *tmp = new EMData(); 01788 tmp->set_size(nx, ny, nz); 01789 01790 float *slice_data = slice->get_data(); 01791 float *tmp_data = tmp->get_data(); 01792 01793 size_t nxy = nx * ny; 01794 size_t nxy_size = nxy * sizeof(float);; 01795 for (int i = 0; i < nz; ++i) { 01796 memcpy(&tmp_data[nxy * i], slice_data, nxy_size); 01797 } 01798 01799 transform->set_scale(1.0); 01800 transform->set_mirror(false); 01801 transform->set_trans(0,0,0); 01802 transform->invert(); 01803 01804 tmp->transform(*transform); 01805 image->add(*tmp); 01806 01807 if(transform) {delete transform; transform=0;} 01808 delete tmp; 01809 delete slice; 01810 01811 return 0; 01812 }
|
|
Definition at line 703 of file reconstructor.h. 00704 { 00705 params["weight"] = 1.0; 00706 params["use_weights"] = true; 00707 params["size"] = 0; 00708 params["sym"] = "c1"; 00709 params["zsample"] = 0; 00710 }
|
|
Definition at line 680 of file reconstructor.h. 00681 { 00682 return new BackProjectionReconstructor(); 00683 }
|
|
|
|
While you can just insert unprocessed slices, if you call preprocess_slice yourself, and insert the returned slice instead, repeatedly, it can save a fair bit of computation. The default operation just returns a copy of the image, as the preprocessing is reconstructor-specific.
Reimplemented from EMAN::Reconstructor. Definition at line 1744 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(), t, EMAN::EMData::transform(), and EMAN::Vec2f. Referenced by insert_slice(). 01745 { 01746 01747 EMData* return_slice = slice->process("normalize.edgemean"); 01748 return_slice->process_inplace("filter.linearfourier"); 01749 01750 Transform tmp(t); 01751 tmp.set_rotation(Dict("type","eman")); // resets the rotation to 0 implicitly 01752 Vec2f trans = tmp.get_trans_2d(); 01753 float scale = tmp.get_scale(); 01754 bool mirror = tmp.get_mirror(); 01755 if (trans[0] != 0 || trans[1] != 0 || scale != 1.0 ) { 01756 return_slice->transform(tmp); 01757 } else if ( mirror == true ) { 01758 return_slice = slice->process("xform.flip",Dict("axis","x")); 01759 } 01760 01761 return return_slice; 01762 }
|
|
Initialize the reconstructor.
Implements EMAN::Reconstructor. Definition at line 1733 of file reconstructor.cpp. References EMAN::EMData::set_size(). 01734 { 01735 int size = params["size"]; 01736 image = new EMData(); 01737 nx = size; 01738 ny = size; 01739 if ( (int) params["zsample"] != 0 ) nz = params["zsample"]; 01740 else nz = size; 01741 image->set_size(nx, ny, nz); 01742 }
|
|
Definition at line 76 of file reconstructor.cpp. |