EMAN2
Public Member Functions | Protected Attributes
EMAN::Averager Class Reference

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]

List of all members.

Public Member Functions

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

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:

Typical usages of Averager:

Definition at line 96 of file averager.h.


Constructor & Destructor Documentation

EMAN::Averager::Averager ( ) [inline]

Definition at line 99 of file averager.h.

: result(0) {}
virtual EMAN::Averager::~Averager ( ) [inline, virtual]

Definition at line 101 of file averager.h.

                {
                }

Member Function Documentation

virtual void EMAN::Averager::add_image ( EMData image) [pure virtual]
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 77 of file averager.cpp.

References add_image().

{
        for (size_t i = 0; i < image_list.size(); i++) {
                add_image(image_list[i]);
        }
}
virtual EMData* EMAN::Averager::finish ( ) [pure virtual]
virtual string EMAN::Averager::get_desc ( ) const [pure virtual]
virtual string EMAN::Averager::get_name ( ) const [pure virtual]
virtual TypeDict EMAN::Averager::get_param_types ( ) const [inline, virtual]

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::FourierWeightAverager, EMAN::TomoAverager, EMAN::MinMaxAverager, EMAN::AbsMaxMinAverager, and EMAN::XYZAverager.

Definition at line 154 of file averager.h.

                {
                        TypeDict d;
                        return d;
                }
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, and EMAN::MinMaxAverager.

Definition at line 67 of file averager.cpp.

References EMAN::EMData::mult(), NullPointerException, and result.

{
        if ( result != 0 )
        {
                result->mult(s);
        }
        else throw NullPointerException("Error, attempted to multiply the result image, which is NULL");
}
virtual void EMAN::Averager::set_params ( const Dict new_params) [inline, virtual]

Set the Averager parameters using a key/value dictionary.

Parameters:
new_paramsA dictionary containing the new parameters.

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

Definition at line 133 of file averager.h.

References params.

                {
                        params = new_params;
                }

Member Data Documentation

Dict EMAN::Averager::params [mutable, protected]

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