EMAN::NormalizeProcessor Class Reference

Base class for normalization processors. More...

#include <processor.h>

Inheritance diagram for EMAN::NormalizeProcessor:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

void process_inplace (EMData *image)
 To process an image in-place.

Static Public Member Functions

static string get_group_desc ()
 Get the description of this group of processors.

Protected Member Functions

virtual float calc_sigma (EMData *image) const
virtual float calc_mean (EMData *image) const =0

Detailed Description

Base class for normalization processors.

Each specific normalization processor needs to define how to calculate mean and how to calculate sigma.

Definition at line 4067 of file processor.h.


Member Function Documentation

virtual float EMAN::NormalizeProcessor::calc_mean ( EMData image  )  const [protected, pure virtual]

Implemented in EMAN::NormalizeUnitProcessor, EMAN::NormalizeUnitSumProcessor, EMAN::NormalizeStdProcessor, EMAN::NormalizeMaskProcessor, EMAN::NormalizeEdgeMeanProcessor, EMAN::NormalizeCircleMeanProcessor, EMAN::NormalizeLREdgeMeanProcessor, and EMAN::NormalizeMaxMinProcessor.

Referenced by process_inplace().

float NormalizeProcessor::calc_sigma ( EMData image  )  const [protected, virtual]

Reimplemented in EMAN::NormalizeUnitProcessor, EMAN::NormalizeUnitSumProcessor, EMAN::NormalizeMaskProcessor, and EMAN::NormalizeMaxMinProcessor.

Definition at line 3487 of file processor.cpp.

References EMAN::EMData::get_attr().

Referenced by process_inplace().

03488 {
03489         return image->get_attr("sigma");
03490 }

static string EMAN::NormalizeProcessor::get_group_desc (  )  [inline, static]

Get the description of this group of processors.

This function is defined in a parent class. It gives a introduction to a group of processors.

Returns:
The description of this group of processors.

Reimplemented from EMAN::Processor.

Definition at line 4072 of file processor.h.

04073                 {
04074                         return "Base class for normalization processors. Each specific normalization processor needs to define how to calculate mean and how to calculate sigma.";
04075                 }

void NormalizeProcessor::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 3492 of file processor.cpp.

References calc_mean(), calc_sigma(), EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::Util::goodf(), EMAN::EMData::is_complex(), LOGWARN, and EMAN::EMData::update().

03493 {
03494         if (!image) {
03495                 LOGWARN("cannot do normalization on NULL image");
03496                 return;
03497         }
03498 
03499         if (image->is_complex()) {
03500                 LOGWARN("cannot do normalization on complex image");
03501                 return;
03502         }
03503 
03504         float sigma = calc_sigma(image);
03505         if (sigma == 0 || !Util::goodf(&sigma)) {
03506                 LOGWARN("cannot do normalization on image with sigma = 0");
03507                 return;
03508         }
03509 
03510         float mean = calc_mean(image);
03511 
03512         size_t size = (size_t)image->get_xsize() * (size_t)image->get_ysize() *
03513                           (size_t)image->get_zsize();
03514         float *data = image->get_data();
03515 
03516         for (size_t i = 0; i < size; i++) {
03517                 data[i] = (data[i] - mean) / sigma;
03518         }
03519 
03520         image->update();
03521 }


The documentation for this class was generated from the following files:
Generated on Mon Jul 19 12:43:39 2010 for EMAN2 by  doxygen 1.4.7