EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
EMAN::ApplySymProcessor Class Reference

Applies a symmetry to a 3D model. More...

#include <processor.h>

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

List of all members.

Public Member Functions

virtual string get_name () const
 Get the processor's name.
virtual void process_inplace (EMData *image)
 To process an image in-place.
virtual EMDataprocess (const EMData *const image)
 To proccess an image out-of-place.
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary.
virtual string get_desc () const
 Get the descrition of this specific processor.

Static Public Member Functions

static ProcessorNEW ()

Static Public Attributes

static const string NAME = "xform.applysym"

Detailed Description

Applies a symmetry to a 3D model.

The model must be on aligned to its symmetry axis(via align3d or other mechanism)

Author:
Steve Ludtke and John Flanagan
Date:
June 2011
Parameters:
symA string specifying the symmetry under which to do the alignment

Definition at line 1756 of file processor.h.


Member Function Documentation

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

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

Returns:
The description of this processor.

Implements EMAN::Processor.

Definition at line 1780 of file processor.h.

                        {
                                return "Symmetry is imposed on a 2-D image (Cn only) or 3-D volume";
                        }
virtual string EMAN::ApplySymProcessor::get_name ( ) const [inline, virtual]

Get the processor's name.

Each processor is identified by a unique name.

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 1759 of file processor.h.

References NAME.

                        {
                                return NAME;
                        }
virtual TypeDict EMAN::ApplySymProcessor::get_param_types ( ) const [inline, virtual]

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::Processor.

Definition at line 1773 of file processor.h.

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

                        {
                                TypeDict d;
                                d.put("sym", EMObject::STRING, "The symmetry under which to do the alignment, Default=c1" );
                                return d;
                        }
static Processor* EMAN::ApplySymProcessor::NEW ( ) [inline, static]

Definition at line 1764 of file processor.h.

                        {
                                return new ApplySymProcessor();
                        }
EMData * ApplySymProcessor::process ( const EMData *const  image) [virtual]

To proccess an image out-of-place.

For those processors which can only be processed out-of-place, override this function to give the right behavior.

Parameters:
imageThe image will be copied, actual process happen on copy of image.
Returns:
the image processing result, may or may not be the same size of the input image

Reimplemented from EMAN::Processor.

Definition at line 966 of file processor.cpp.

References EMAN::Averager::add_image(), EMAN::Averager::finish(), EMAN::Symmetry3D::get_syms(), EMAN::EMData::get_zsize(), ImageDimensionException, InvalidValueException, EMAN::Processor::params, EMAN::EMData::process(), EMAN::Dict::set_default(), and t.

Referenced by process_inplace().

{
        Averager* imgavg = Factory<Averager>::get((string)params.set_default("avger","mean"));

        if (image->get_zsize()==1) {
                string s=(string)params["sym"];
                if (s[0]!='c' && s[0]!='C') throw ImageDimensionException("xform.applysym: Cn symmetry required for 2-D symmetrization");
                int n=atoi(s.c_str()+1);
                if (n<=0) throw InvalidValueException(n,"xform.applysym: Cn symmetry, n>0");

                for (int i=0; i<n; i++) {
                        Transform t(Dict("type","2d","alpha",(float)(i*360.0f/n)));
                        EMData* transformed = image->process("xform",Dict("transform",&t));
                        imgavg->add_image(transformed);
                        delete transformed;
                }
                EMData *ret=imgavg->finish();
                delete imgavg;
                return ret;
        }

        Symmetry3D* sym = Factory<Symmetry3D>::get((string)params.set_default("sym","c1"));
        vector<Transform> transforms = sym->get_syms();

        for(vector<Transform>::const_iterator trans_it = transforms.begin(); trans_it != transforms.end(); trans_it++) {
                Transform t = *trans_it;
                EMData* transformed = image->process("xform",Dict("transform",&t));
                imgavg->add_image(transformed);
                delete transformed;
        }
        EMData *ret=imgavg->finish();
        delete imgavg;
        return ret;
}
void ApplySymProcessor::process_inplace ( EMData image) [virtual]

To process an image in-place.

For those processors which can only be processed out-of-place, override this function to just print out some error message to remind user call the out-of-place version.

Parameters:
imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 1001 of file processor.cpp.

References EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), process(), and EMAN::EMData::update().

{
        EMData *tmp=process(image);
        memcpy(image->get_data(),tmp->get_data(),(size_t)image->get_xsize()*image->get_ysize()*image->get_zsize()*sizeof(float));
        delete tmp;
        image->update();
        return;
}

Member Data Documentation

const string ApplySymProcessor::NAME = "xform.applysym" [static]

Definition at line 1785 of file processor.h.

Referenced by get_name().


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