EMAN::BackProjectionReconstructor Class Reference

Real space 3D reconstruction using back projection. More...

#include <reconstructor.h>

Inheritance diagram for EMAN::BackProjectionReconstructor:

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

Collaboration graph
[legend]
List of all members.

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 EMDatafinish (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

static ReconstructorNEW ()

Static Public Attributes

static const string NAME = "back_projection"

Private Member Functions

 BackProjectionReconstructor (const BackProjectionReconstructor &that)
BackProjectionReconstructoroperator= (const BackProjectionReconstructor &)
void load_default_settings ()
EMDatapreprocess_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.

Detailed Description

Real space 3D reconstruction using back projection.

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.


Constructor & Destructor Documentation

EMAN::BackProjectionReconstructor::BackProjectionReconstructor (  )  [inline]

Definition at line 652 of file reconstructor.h.

References load_default_settings().

Referenced by NEW().

00652 { load_default_settings();  }

virtual EMAN::BackProjectionReconstructor::~BackProjectionReconstructor (  )  [inline, virtual]

Definition at line 654 of file reconstructor.h.

00654 {}

EMAN::BackProjectionReconstructor::BackProjectionReconstructor ( const BackProjectionReconstructor that  )  [private]


Member Function Documentation

EMData * BackProjectionReconstructor::finish ( bool  doift = true  )  [virtual]

Finish reconstruction and return the complete model.

Parameters:
doift A flag indicating whether the returned object should be guaranteed to be in real-space (true) or should be left in whatever space the reconstructor generated
Returns:
The result 3D model.

Reimplemented from EMAN::Reconstructor.

Definition at line 1810 of file reconstructor.cpp.

References EMAN::EMData::add(), EMAN::Symmetry3D::get_nsym(), EMAN::Symmetry3D::get_syms(), EMAN::ReconstructorVolumeData::image, EMAN::EMData::mult(), and EMAN::FactoryBase::params.

01811 {
01812 
01813         Symmetry3D* sym = Factory<Symmetry3D>::get((string)params["sym"]);
01814         vector<Transform> syms = sym->get_syms();
01815 
01816         for ( vector<Transform>::const_iterator it = syms.begin(); it != syms.end(); ++it ) {
01817 
01818                 EMData tmpcopy(*image);
01819                 tmpcopy.transform(*it);
01820                 image->add(tmpcopy);
01821         }
01822 
01823         image->mult(1.0f/(float)sym->get_nsym());
01824         delete sym;
01825         return image;
01826 }

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

Get a clear, concise description of this class.

Returns:
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                 }

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

Get the unique name of this class (especially for factory based instantiation access).

Returns:
the unique name of this class

Implements EMAN::FactoryBase.

Definition at line 670 of file reconstructor.h.

References NAME.

00671                 {
00672                         return NAME;
00673                 }

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

Returns:
a TypeDict defining and describing the feasible parameters of this class

Implements EMAN::FactoryBase.

Definition at line 685 of file reconstructor.h.

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

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                 }

int BackProjectionReconstructor::insert_slice ( const EMData *const   slice,
const Transform euler,
const float  weight = 1.0 
) [virtual]

Insert an image slice to the reconstructor.

To insert multiple image slices, call this function multiple times.

Parameters:
slice Image slice.
euler Euler angle of this image slice.
weight A weighting factor for this slice, generally the number of particles in a class-average. May be ignored by some reconstructors
Returns:
0 if OK. 1 if error.

Reimplemented from EMAN::Reconstructor.

Definition at line 1760 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(), t, EMAN::ReconstructorVolumeData::tmp_data, EMAN::EMData::transform(), and weight.

01761 {
01762         if (!input) {
01763                 LOGERR("try to insert NULL slice");
01764                 return 1;
01765         }
01766 
01767         if (input->get_xsize() != input->get_ysize() || input->get_xsize() != nx) {
01768                 LOGERR("tried to insert image that was not correction dimensions");
01769                 return 1;
01770         }
01771 
01772         Transform * transform;
01773         if ( input->has_attr("xform.projection") ) {
01774                 transform = (Transform*) (input->get_attr("xform.projection")); // assignment operator
01775         } else {
01776                 transform = new Transform(t); // assignment operator
01777         }
01778         EMData* slice = preprocess_slice(input, t);
01779 
01780         float weight = params["weight"];
01781         slice->mult(weight);
01782 
01783         EMData *tmp = new EMData();
01784         tmp->set_size(nx, ny, nz);
01785 
01786         float *slice_data = slice->get_data();
01787         float *tmp_data = tmp->get_data();
01788 
01789         size_t nxy = nx * ny;
01790         size_t nxy_size = nxy * sizeof(float);;
01791         for (int i = 0; i < nz; ++i) {
01792                 memcpy(&tmp_data[nxy * i], slice_data, nxy_size);
01793         }
01794 
01795         transform->set_scale(1.0);
01796         transform->set_mirror(false);
01797         transform->set_trans(0,0,0);
01798         transform->invert();
01799 
01800         tmp->transform(*transform);
01801         image->add(*tmp);
01802 
01803         if(transform) {delete transform; transform=0;}
01804         delete tmp;
01805         delete slice;
01806 
01807         return 0;
01808 }

void EMAN::BackProjectionReconstructor::load_default_settings (  )  [inline, private]

Definition at line 703 of file reconstructor.h.

References EMAN::FactoryBase::params.

Referenced by BackProjectionReconstructor().

00704                 {
00705                         params["weight"] = 1.0;
00706                         params["use_weights"] = true;
00707                         params["size"] = 0;
00708                         params["sym"] = "c1";
00709                         params["zsample"] = 0;
00710                 }

static Reconstructor* EMAN::BackProjectionReconstructor::NEW (  )  [inline, static]

Definition at line 680 of file reconstructor.h.

References BackProjectionReconstructor().

00681                 {
00682                         return new BackProjectionReconstructor();
00683                 }

BackProjectionReconstructor& EMAN::BackProjectionReconstructor::operator= ( const BackProjectionReconstructor  )  [private]

EMData * BackProjectionReconstructor::preprocess_slice ( const EMData *const   slice,
const Transform t 
) [private, virtual]

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.

Returns:
the processed slice
Parameters:
slice the slice to be prepocessed
t transform
Exceptions:
InvalidValueException when the specified padding value is less than the size of the images

Reimplemented from EMAN::Reconstructor.

Definition at line 1740 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, and EMAN::EMData::transform().

Referenced by insert_slice().

01741 {
01742 
01743         EMData* return_slice = slice->process("normalize.edgemean");
01744         return_slice->process_inplace("filter.linearfourier");
01745 
01746         Transform tmp(t);
01747         tmp.set_rotation(Dict("type","eman")); // resets the rotation to 0 implicitly
01748         Vec2f trans = tmp.get_trans_2d();
01749         float scale = tmp.get_scale();
01750         bool mirror = tmp.get_mirror();
01751         if (trans[0] != 0 || trans[1] != 0 || scale != 1.0 ) {
01752                 return_slice->transform(tmp);
01753         } else if ( mirror == true ) {
01754                 return_slice = slice->process("xform.flip",Dict("axis","x"));
01755         }
01756 
01757         return return_slice;
01758 }

void BackProjectionReconstructor::setup (  )  [virtual]

Initialize the reconstructor.

Implements EMAN::Reconstructor.

Definition at line 1729 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().

01730 {
01731         int size = params["size"];
01732         image = new EMData();
01733         nx = size;
01734         ny = size;
01735         if ( (int) params["zsample"] != 0 ) nz = params["zsample"];
01736         else nz = size;
01737         image->set_size(nx, ny, nz);
01738 }


Member Data Documentation

const string BackProjectionReconstructor::NAME = "back_projection" [static]

Definition at line 695 of file reconstructor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Mon Jul 19 12:44:25 2010 for EMAN2 by  doxygen 1.4.7