EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
EMAN::XYZAverager Class Reference

XYZAverager is an averager template for defining new averagers. More...

#include <averager_template.h>

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

Public Member Functions

 XYZAverager ()
 
void add_image (EMData *image)
 To add an image to the Averager. More...
 
EMDatafinish ()
 Finish up the averaging and return the result. More...
 
string get_name () const
 Get the Averager's name. More...
 
string get_desc () const
 
TypeDict get_param_types () const
 Add your averager parameter names and types in get_param_types(). More...
 
- Public Member Functions inherited from EMAN::Averager
 Averager ()
 
virtual ~Averager ()
 
virtual void add_image_list (const vector< EMData * > &images)
 To add multiple images to the Averager. More...
 
virtual void set_params (const Dict &new_params)
 Set the Averager parameters using a key/value dictionary. More...
 
virtual void mult (const float &s)
 Multiply the result image by some floating point constant This is useful when weighting the input images prior to calling add_image - a situation where it is likely you want to divide by the sum of the weights. More...
 

Static Public Member Functions

static AveragerNEW ()
 

Static Public Attributes

static const string NAME = "xyz"
 

Private Attributes

EMDataresult
 

Additional Inherited Members

- Protected Attributes inherited from EMAN::Averager
Dict params
 
EMDataresult
 

Detailed Description

XYZAverager is an averager template for defining new averagers.

Please add your own code at the proper place.

1) Replace all 'XYZ' with your new averager name. 2) Define the averager parameter names and types in get_param_types(). 3) Implement the averager in XYZAverager::align().

Definition at line 47 of file averager_template.h.

Constructor & Destructor Documentation

◆ XYZAverager()

XYZAverager::XYZAverager ( )

Definition at line 39 of file averager_template.cpp.

39 : result(0)
40{
41}

Referenced by NEW().

Member Function Documentation

◆ add_image()

void XYZAverager::add_image ( EMData image)
virtual

To add an image to the Averager.

This image will be averaged in this function.

Parameters
imageThe image to be averaged.

Reimplemented from EMAN::Averager.

Definition at line 43 of file averager_template.cpp.

44{
45 if (!image) {
46 return;
47 }
48 result = new EMData();
49}
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82

References result.

◆ finish()

EMData * XYZAverager::finish ( )
virtual

Finish up the averaging and return the result.

Returns
The averaged image.

Implements EMAN::Averager.

Definition at line 52 of file averager_template.cpp.

53{
54 return result;
55}

References result.

◆ get_desc()

string EMAN::XYZAverager::get_desc ( ) const
inlinevirtual

Implements EMAN::Averager.

Definition at line 59 of file averager_template.h.

60 {
61 return "XYZ description";
62 }

◆ get_name()

string EMAN::XYZAverager::get_name ( ) const
inlinevirtual

Get the Averager's name.

Each Averager is identified by a unique name.

Returns
The Averager's name.

Implements EMAN::Averager.

Definition at line 54 of file averager_template.h.

55 {
56 return NAME;
57 }
static const string NAME

References NAME.

◆ get_param_types()

TypeDict EMAN::XYZAverager::get_param_types ( ) const
inlinevirtual

Add your averager parameter names and types in get_param_types().

For available parameter types, please refer class EMObject.

As an example, XYZAverager has 3 parameters: EMData *param1; int param2; float param3;

Reimplemented from EMAN::Averager.

Definition at line 78 of file averager_template.h.

79 {
80 TypeDict d;
81 d.put("param1", EMObject::EMDATA);
82 d.put("param2", EMObject::INT);
83 d.put("param3", EMObject::FLOAT);
84 return d;
85 }

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

◆ NEW()

static Averager * EMAN::XYZAverager::NEW ( )
inlinestatic

Definition at line 64 of file averager_template.h.

65 {
66 return new XYZAverager();
67 }

References XYZAverager().

Member Data Documentation

◆ NAME

const string XYZAverager::NAME = "xyz"
static

Definition at line 87 of file averager_template.h.

Referenced by get_name().

◆ result

EMData* EMAN::XYZAverager::result
private

Definition at line 89 of file averager_template.h.

Referenced by add_image(), and finish().


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