EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions
EMAN::NormalizeCircleMeanProcessor Class Reference

normalizes an image, mean value equals to mean of 2 pixel circular border. More...

#include <processor.h>

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

List of all members.

Public Member Functions

string get_name () const
 Get the processor's name.
string get_desc () const
 Get the descrition of this specific processor.
TypeDict get_param_types () const
 Get processor parameter information in a dictionary.

Static Public Member Functions

static ProcessorNEW ()

Static Public Attributes

static const string NAME = "normalize.circlemean"

Protected Member Functions

float calc_mean (EMData *image) const

Detailed Description

normalizes an image, mean value equals to mean of 2 pixel circular border.

Definition at line 4537 of file processor.h.


Member Function Documentation

float NormalizeCircleMeanProcessor::calc_mean ( EMData image) const [protected, virtual]

Implements EMAN::NormalizeProcessor.

Definition at line 3839 of file processor.cpp.

References EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::EMUtil::is_same_size(), LOGWARN, EMAN::Processor::params, EMAN::EMData::process_inplace(), EMAN::Dict::set_default(), EMAN::EMData::set_size(), and EMAN::EMData::to_one().

{
        if (!image) {
                LOGWARN("NULL Image");
                return 0;
        }
//      return image->get_circle_mean();
        int nx=image->get_xsize();
        int ny=image->get_ysize();
        int nz=image->get_zsize();

        float radius = params.set_default("radius",((float)ny/2-2));

//      static bool busy = false;
        static EMData *mask = 0;

        if (!mask || !EMUtil::is_same_size(image, mask)) {
                if (!mask) {
                        mask = new EMData();
                }
                mask->set_size(nx, ny, nz);
                mask->to_one();

                mask->process_inplace("mask.sharp", Dict("inner_radius", radius - 1,
                                                         "outer_radius", radius + 1));

        }
        double n = 0,s=0;
        float *d = mask->get_data();
        float * data = image->get_data();
        size_t size = (size_t)nx*ny*nz;
        for (size_t i = 0; i < size; ++i) {
                if (d[i]) { n+=1.0; s+=data[i]; }
        }


        float result = (float)(s/n);

        return result;


}
string EMAN::NormalizeCircleMeanProcessor::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 4550 of file processor.h.

                {
                        return "normalizes an image, mean value equals to mean of 2 pixel circular radius or of the circular border if no radius is set.";
                }
string EMAN::NormalizeCircleMeanProcessor::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 4540 of file processor.h.

References NAME.

                {
                        return NAME;
                }
TypeDict EMAN::NormalizeCircleMeanProcessor::get_param_types ( ) const [inline, virtual]

Get processor 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 from EMAN::Processor.

Definition at line 4555 of file processor.h.

References EMAN::EMObject::FLOAT, and EMAN::TypeDict::put().

                {
                        TypeDict d;
                        d.put("radius", EMObject::FLOAT,"Radius of 2 pixel circular border");
                        return d;
                }
static Processor* EMAN::NormalizeCircleMeanProcessor::NEW ( ) [inline, static]

Definition at line 4545 of file processor.h.

                {
                        return new NormalizeCircleMeanProcessor();
                }

Member Data Documentation

const string NormalizeCircleMeanProcessor::NAME = "normalize.circlemean" [static]

Definition at line 4562 of file processor.h.

Referenced by get_name().


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