EMAN::AverageXProcessor Class Reference

Average along Y and replace with average. More...

#include <processor.h>

Inheritance diagram for EMAN::AverageXProcessor:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

void process_inplace (EMData *image)
 To process an image in-place.
string get_name () const
 Get the processor's name.
string get_desc () const
 Get the descrition of this specific processor.

Static Public Member Functions

static ProcessorNEW ()


Detailed Description

Average along Y and replace with average.

Definition at line 3599 of file processor.h.


Member Function Documentation

void AverageXProcessor::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:
image The image to be processed.

Implements EMAN::Processor.

Definition at line 2819 of file processor.cpp.

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

02820 {
02821         if (!image) {
02822                 LOGWARN("NULL Image");
02823                 return;
02824         }
02825 
02826         float *data = image->get_data();
02827         int nx = image->get_xsize();
02828         int ny = image->get_ysize();
02829         int nz = image->get_zsize();
02830         size_t nxy = (size_t)nx * ny;
02831 
02832         size_t idx;
02833         for (int z = 0; z < nz; z++) {
02834                 for (int x = 0; x < nx; x++) {
02835                         double sum = 0;
02836                         for (int y = 0; y < ny; y++) {
02837                                 idx = x + y * nx + z * nxy;
02838                                 sum += data[idx];
02839                         }
02840                         float mean = (float) sum / ny;
02841 
02842                         for (int y = 0; y < ny; y++) {
02843                                 idx = x + y * nx + z * nxy;
02844                                 data[idx] = mean;
02845                         }
02846                 }
02847         }
02848 
02849         image->update();
02850 }

string EMAN::AverageXProcessor::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 3604 of file processor.h.

03605                 {
03606                         return "math.averageovery";
03607                 }

static Processor* EMAN::AverageXProcessor::NEW (  )  [inline, static]

Definition at line 3609 of file processor.h.

03610                 {
03611                         return new AverageXProcessor();
03612                 }

string EMAN::AverageXProcessor::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 3614 of file processor.h.

03615                 {
03616                         return "Average along Y and replace with average";
03617                 }


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

Generated on Sat Nov 21 02:20:31 2009 for EMAN2 by  doxygen 1.5.6