EMAN2
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
EMAN::NormalizeProcessor Class Referenceabstract

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]

Public Member Functions

void process_inplace (EMData *image)
 To process an image in-place. More...
 
- Public Member Functions inherited from EMAN::Processor
virtual ~Processor ()
 
virtual EMDataprocess (const EMData *const image)
 To proccess an image out-of-place. More...
 
virtual void process_list_inplace (vector< EMData * > &images)
 To process multiple images using the same algorithm. More...
 
virtual string get_name () const =0
 Get the processor's name. More...
 
virtual Dict get_params () const
 Get the processor parameters in a key/value dictionary. More...
 
virtual void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary. More...
 
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 
virtual string get_desc () const =0
 Get the descrition of this specific processor. More...
 

Static Public Member Functions

static string get_group_desc ()
 
- Static Public Member Functions inherited from EMAN::Processor
static string get_group_desc ()
 Get the description of this group of processors. More...
 
static void EMFourierFilterInPlace (EMData *fimage, Dict params)
 Compute a Fourier-filter processed image in place. More...
 
static EMDataEMFourierFilter (EMData *fimage, Dict params)
 Compute a Fourier-processor processed image without altering the original image. More...
 

Protected Member Functions

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

Additional Inherited Members

- Public Types inherited from EMAN::Processor
enum  fourier_filter_types {
  TOP_HAT_LOW_PASS , TOP_HAT_HIGH_PASS , TOP_HAT_BAND_PASS , TOP_HOMOMORPHIC ,
  GAUSS_LOW_PASS , GAUSS_HIGH_PASS , GAUSS_BAND_PASS , GAUSS_INVERSE ,
  GAUSS_HOMOMORPHIC , BUTTERWORTH_LOW_PASS , BUTTERWORTH_HIGH_PASS , BUTTERWORTH_HOMOMORPHIC ,
  KAISER_I0 , KAISER_SINH , KAISER_I0_INVERSE , KAISER_SINH_INVERSE ,
  SHIFT , TANH_LOW_PASS , TANH_HIGH_PASS , TANH_HOMOMORPHIC ,
  TANH_BAND_PASS , RADIAL_TABLE , CTF_
}
 Fourier filter Processor type enum. More...
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

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 5826 of file processor.h.

Member Function Documentation

◆ calc_mean()

virtual float EMAN::NormalizeProcessor::calc_mean ( EMData image) const
protectedpure virtual

◆ calc_sigma()

float NormalizeProcessor::calc_sigma ( EMData image) const
protectedvirtual

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

Definition at line 4630 of file processor.cpp.

4631{
4632 return image->get_attr("sigma");
4633}

Referenced by process_inplace().

◆ get_group_desc()

static string EMAN::NormalizeProcessor::get_group_desc ( )
inlinestatic

Definition at line 5831 of file processor.h.

5832 {
5833 return "Base class for normalization processors. Each specific normalization processor needs to define how to calculate mean and how to calculate sigma.";
5834 }

◆ process_inplace()

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
imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 4635 of file processor.cpp.

4636{
4637 if (!image) {
4638 LOGWARN("cannot do normalization on NULL image");
4639 return;
4640 }
4641
4642 if (image->is_complex()) {
4643 LOGWARN("cannot do normalization on complex image");
4644 return;
4645 }
4646
4647 float sigma = calc_sigma(image);
4648 if (sigma == 0 || !Util::goodf(&sigma)) {
4649 LOGWARN("cannot do normalization on image with sigma = 0");
4650 return;
4651 }
4652
4653 float mean = calc_mean(image);
4654
4655 size_t size = (size_t)image->get_xsize() * image->get_ysize() * image->get_zsize();
4656 float *data = image->get_data();
4657
4658 for (size_t i = 0; i < size; ++i) {
4659 data[i] = (data[i] - mean) / sigma;
4660 }
4661
4662 image->update();
4663}
virtual float calc_sigma(EMData *image) const
Definition: processor.cpp:4630
virtual float calc_mean(EMData *image) const =0
static int goodf(const float *p_f)
Check whether a number is a good float.
Definition: util.h:1112
#define LOGWARN
Definition: log.h:53

References calc_mean(), calc_sigma(), EMAN::Util::goodf(), and LOGWARN.


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