EMAN2
Public Member Functions | Protected Attributes | List of all members
EMAN::Averager Class Referenceabstract

Averager class defines a way to do averaging on a set of images. More...

#include <averager.h>

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

Public Member Functions

 Averager ()
 
virtual ~Averager ()
 
virtual void add_image (EMData *image)
 To add an image to the Averager. More...
 
virtual void add_image_list (const vector< EMData * > &images)
 To add multiple images to the Averager. More...
 
virtual EMDatafinish ()=0
 Finish up the averaging and return the result. More...
 
virtual string get_name () const =0
 Get the Averager's name. More...
 
virtual string get_desc () const =0
 
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...
 
virtual TypeDict get_param_types () const
 Get Averager parameter information in a dictionary. More...
 

Protected Attributes

Dict params
 
EMDataresult
 

Detailed Description

Averager class defines a way to do averaging on a set of images.

A user may add one or more images to the Averager at one time. The images are averaged at the time of adding to the Averager. After all images are added, Average will return the averaged result.

Averager class is the base class for all averager classes. Each specific averager has a unique ID name. This name is used to call a averager.

All Averager classes in EMAN are managed by a Factory
pattern. So each Averager class must define:
  - a unique name to idenfity itself in the factory.
  - a static method to register itself in the factory.

Typical usages of Averager:

Definition at line 92 of file averager.h.

Constructor & Destructor Documentation

◆ Averager()

EMAN::Averager::Averager ( )
inline

Definition at line 95 of file averager.h.

95: result(0) {}

◆ ~Averager()

virtual EMAN::Averager::~Averager ( )
inlinevirtual

Definition at line 97 of file averager.h.

98 {
99 }

Member Function Documentation

◆ add_image()

void Averager::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 in EMAN::ImageAverager, EMAN::LocalWeightAverager, EMAN::IterAverager, EMAN::FourierWeightAverager, EMAN::TomoAverager, EMAN::MinMaxAverager, EMAN::MedianAverager, EMAN::CtfWtAverager, EMAN::CtfWtFiltAverager, EMAN::CtfCAutoAverager, EMAN::CtfCWautoAverager, EMAN::SigmaAverager, and EMAN::XYZAverager.

Definition at line 81 of file averager.cpp.

82{
83return;
84}

Referenced by add_image_list(), and EMAN::ApplySymProcessor::process().

◆ add_image_list()

void Averager::add_image_list ( const vector< EMData * > &  images)
virtual

To add multiple images to the Averager.

All the newly-added images are averaged in this function.

Parameters
imagesThe images to be averaged.

Definition at line 86 of file averager.cpp.

87{
88 for (size_t i = 0; i < image_list.size(); i++) {
89 add_image(image_list[i]);
90 }
91}

References add_image().

◆ finish()

virtual EMData * EMAN::Averager::finish ( )
pure virtual

◆ get_desc()

virtual string EMAN::Averager::get_desc ( ) const
pure virtual

◆ get_name()

virtual string EMAN::Averager::get_name ( ) const
pure virtual

◆ get_param_types()

virtual TypeDict EMAN::Averager::get_param_types ( ) const
inlinevirtual

Get Averager 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 in EMAN::ImageAverager, EMAN::LocalWeightAverager, EMAN::IterAverager, EMAN::FourierWeightAverager, EMAN::TomoAverager, EMAN::MinMaxAverager, EMAN::MedianAverager, EMAN::SigmaAverager, and EMAN::XYZAverager.

Definition at line 150 of file averager.h.

151 {
152 TypeDict d;
153 return d;
154 }

◆ mult()

void Averager::mult ( const float &  s)
virtual

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.

Hence call mult after all of the weighted images have been added.

Parameters
sthe scaling factor.
Exceptions
NullPointerExceptionif the EMData pointer (result) is NULL

Reimplemented in EMAN::ImageAverager, EMAN::TomoAverager, EMAN::MinMaxAverager, and EMAN::SigmaAverager.

Definition at line 71 of file averager.cpp.

72{
73 if ( result != 0 )
74 {
75 result->mult(s);
76 }
77 else throw NullPointerException("Error, attempted to multiply the result image, which is NULL");
78}
#define NullPointerException(desc)
Definition: exception.h:241

References NullPointerException, and result.

◆ set_params()

virtual void EMAN::Averager::set_params ( const Dict new_params)
inlinevirtual

Set the Averager parameters using a key/value dictionary.

Parameters
new_paramsA dictionary containing the new parameters.

Reimplemented in EMAN::CtfWtAverager, EMAN::CtfWtFiltAverager, EMAN::CtfCAutoAverager, and EMAN::CtfCWautoAverager.

Definition at line 129 of file averager.h.

130 {
131 params = new_params;
132 }

References params.

Member Data Documentation

◆ params

Dict EMAN::Averager::params
mutableprotected

◆ result

EMData* EMAN::Averager::result
protected

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