Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
EMAN::ApplySymProcessor Class Reference

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

#include <processor.h>

Inheritance diagram for EMAN::ApplySymProcessor:
Inheritance graph
Collaboration diagram for EMAN::ApplySymProcessor:
Collaboration graph

Public Member Functions

virtual string get_name () const
 Get the processor's name. More...
virtual void process_inplace (EMData *image)
 To process an image in-place. More...
virtual EMDataprocess (const EMData *const image)
 To proccess an image out-of-place. More...
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
virtual string get_desc () const
 Get the descrition of this specific processor. More...
- Public Member Functions inherited from EMAN::Processor
virtual ~Processor ()
virtual void process_list_inplace (vector< EMData * > &images)
 To process multiple images using the same algorithm. More...
virtual Dict get_params () const
 Get the processor parameters in a key/value dictionary. More...
virtual void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary. More...

Static Public Member Functions

static ProcessorNEW ()
- Static Public Member Functions inherited from EMAN::Processor
static string get_group_desc ()
 Get the description of this group of processors. More...
static void EMFourierFilterInPlace (EMData *fimage, Dict params)
 Compute a Fourier-filter processed image in place. More...
static EMDataEMFourierFilter (EMData *fimage, Dict params)
 Compute a Fourier-processor processed image without altering the original image. More...

Static Public Attributes

static const string NAME = "xform.applysym"

Additional Inherited Members

- Public Types inherited from EMAN::Processor
enum  fourier_filter_types {
 Fourier filter Processor type enum. More...
- Protected Attributes inherited from EMAN::Processor
Dict params

Detailed Description

Applies a symmetry to a 3D model.

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

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

Definition at line 2945 of file processor.h.

Member Function Documentation

◆ get_desc()

virtual string EMAN::ApplySymProcessor::get_desc ( ) const

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

The description of this processor.

Implements EMAN::Processor.

Definition at line 2970 of file processor.h.

2971 {
2972 return "Symmetry is imposed on a 2-D image (Cn only) or 3-D volume";
2973 }

◆ get_name()

virtual string EMAN::ApplySymProcessor::get_name ( ) const

Get the processor's name.

Each processor is identified by a unique name.

The processor's name.

Implements EMAN::Processor.

Definition at line 2948 of file processor.h.

2949 {
2950 return NAME;
2951 }
static const string NAME
Definition: processor.h:2975

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::ApplySymProcessor::get_param_types ( ) const

Get processor parameter information in a dictionary.

Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.

A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 2962 of file processor.h.

2963 {
2964 TypeDict d;
2965 d.put("sym", EMObject::STRING, "The symmetry under which to do the alignment, Default=c1" );
2966 d.put("averager", EMObject::STRING, "Name of an Averager to use. default=mean" );
2967 return d;
2968 }
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair.
Definition: emobject.h:305
void put(const string &key, EMObject::ObjectType o, const string &desc="")
Definition: emobject.h:330

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

◆ NEW()

static Processor * EMAN::ApplySymProcessor::NEW ( )

Definition at line 2953 of file processor.h.

2954 {
2955 return new ApplySymProcessor();
2956 }
Applies a symmetry to a 3D model.
Definition: processor.h:2946

◆ process()

EMData * ApplySymProcessor::process ( const EMData *const  image)

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.

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

Reimplemented from EMAN::Processor.

Definition at line 1692 of file processor.cpp.

1694 string s=(string)params.set_default("sym","c1");
1695 if (s.length()<2) return image->copy();
1696 int n=atoi(s.c_str()+1);
1697 if ((s[0]=='c' || s[0]=='C') && n==1) return image->copy();
1699 Averager* imgavg = Factory<Averager>::get((string)params.set_default("averager","mean"));
1701 if (image->get_zsize()==1) {
1702 if (s[0]!='c' && s[0]!='C') throw ImageDimensionException("xform.applysym: Cn symmetry required for 2-D symmetrization");
1703 if (n<=0) throw InvalidValueException(n,"xform.applysym: Cn symmetry, n>0");
1705 for (int i=0; i<n; i++) {
1706 Transform t(Dict("type","2d","alpha",(float)(i*360.0f/n)));
1707 EMData* transformed = image->process("xform",Dict("transform",&t));
1708 imgavg->add_image(transformed);
1709 delete transformed;
1710 }
1711 EMData *ret=imgavg->finish();
1712 delete imgavg;
1713 return ret;
1714 }
1716 Symmetry3D* sym = Factory<Symmetry3D>::get((string)params.set_default("sym","c1"));
1717 vector<Transform> transforms = sym->get_syms();
1719 for(vector<Transform>::const_iterator trans_it = transforms.begin(); trans_it != transforms.end(); trans_it++) {
1720 Transform t = *trans_it;
1721 EMData* transformed = image->process("xform",Dict("transform",&t));
1722 imgavg->add_image(transformed);
1723 delete transformed;
1724 }
1725 EMData *ret=imgavg->finish();
1726 delete imgavg;
1727 return ret;
Averager class defines a way to do averaging on a set of images.
Definition: averager.h:93
virtual EMData * finish()=0
Finish up the averaging and return the result.
virtual void add_image(EMData *image)
To add an image to the Averager.
Definition: averager.cpp:81
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
Definition: emobject.h:569
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
static T * get(const string &instance_name)
Definition: emobject.h:781
Symmetry3D - A base class for 3D Symmetry objects.
Definition: symmetry.h:57
virtual vector< Transform > get_syms() const
Definition: symmetry.cpp:1224
A Transform object is a somewhat specialized object designed specifically for EMAN2/Sparx storage of ...
Definition: transform.h:75
#define InvalidValueException(val, desc)
Definition: exception.h:285
#define ImageDimensionException(desc)
Definition: exception.h:166

References EMAN::Averager::add_image(), EMAN::Averager::finish(), EMAN::Factory< T >::get(), EMAN::Symmetry3D::get_syms(), ImageDimensionException, InvalidValueException, EMAN::Processor::params, and EMAN::Dict::set_default().

Referenced by process_inplace().

◆ process_inplace()

void ApplySymProcessor::process_inplace ( EMData image)

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.

imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 1730 of file processor.cpp.

1732 EMData *tmp=process(image);
1733 memcpy(image->get_data(),tmp->get_data(),(size_t)image->get_xsize()*image->get_ysize()*image->get_zsize()*sizeof(float));
1734 delete tmp;
1735 image->update();
1736 return;
virtual EMData * process(const EMData *const image)
To proccess an image out-of-place.
Definition: processor.cpp:1692

References process().

Member Data Documentation


const string ApplySymProcessor::NAME = "xform.applysym"

Definition at line 2975 of file processor.h.

Referenced by get_name().

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