EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
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]

Public Member Functions

string get_name () const
 Get the processor's name. More...
 
string get_desc () const
 Get the descrition of this specific processor. More...
 
TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 
- Public Member Functions inherited from EMAN::NormalizeProcessor
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 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...
 

Static Public Member Functions

static ProcessorNEW ()
 
- Static Public Member Functions inherited from EMAN::NormalizeProcessor
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...
 

Static Public Attributes

static const string NAME = "normalize.circlemean"
 

Protected Member Functions

float calc_mean (EMData *image) const
 
- Protected Member Functions inherited from EMAN::NormalizeProcessor
virtual float calc_sigma (EMData *image) const
 

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

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

Definition at line 6089 of file processor.h.

Member Function Documentation

◆ calc_mean()

float NormalizeCircleMeanProcessor::calc_mean ( EMData image) const
protectedvirtual

Implements EMAN::NormalizeProcessor.

Definition at line 4832 of file processor.cpp.

4833{
4834 if (!image) {
4835 LOGWARN("NULL Image");
4836 return 0;
4837 }
4838// return image->get_circle_mean();
4839 int nx=image->get_xsize();
4840 int ny=image->get_ysize();
4841 int nz=image->get_zsize();
4842
4843 float radius = params.set_default("radius",((float)ny/2-2));
4844 float width = params.set_default("width",2.0f);
4845 if (radius<0) radius=ny/2+radius;
4846
4847 static bool busy = false; // reduce problems with threads and different image sizes
4848 static EMData *mask = 0;
4849 static int oldradius=radius;
4850 static int oldwidth=width;
4851
4852 if (!mask || !EMUtil::is_same_size(image, mask)||radius!=oldradius||width!=oldwidth) {
4853 while (busy) ;
4854 busy=true;
4855 if (!mask) {
4856 mask = new EMData();
4857 }
4858 mask->set_size(nx, ny, nz);
4859 mask->to_one();
4860
4861 mask->process_inplace("mask.sharp", Dict("inner_radius", radius,
4862 "outer_radius", radius + width));
4863
4864 }
4865 busy=true;
4866 double n = 0,s=0;
4867 float *d = mask->get_data();
4868 float * data = image->get_data();
4869 size_t size = (size_t)nx*ny*nz;
4870 for (size_t i = 0; i < size; ++i) {
4871 if (d[i]!=0.0f) { n+=1.0; s+=data[i]; }
4872 }
4873
4874 float result = (float)(s/n);
4875// printf("cmean=%f\n",result);
4876 busy=false;
4877
4878 return result;
4879}
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
Definition: emobject.h:569
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
static bool is_same_size(const EMData *image1, const EMData *image2)
Check whether two EMData images are of the same size.
Definition: emutil.cpp:1224
#define LOGWARN
Definition: log.h:53

References EMAN::EMUtil::is_same_size(), LOGWARN, EMAN::Processor::params, and EMAN::Dict::set_default().

◆ get_desc()

string EMAN::NormalizeCircleMeanProcessor::get_desc ( ) const
inlinevirtual

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

6103 {
6104 return "normalizes an image, mean value equals to mean of 2 pixel circular radius or of the circular border if no radius is set.";
6105 }

◆ get_name()

string EMAN::NormalizeCircleMeanProcessor::get_name ( ) const
inlinevirtual

Get the processor's name.

Each processor is identified by a unique name.

Returns
The processor's name.

Implements EMAN::Processor.

Definition at line 6092 of file processor.h.

6093 {
6094 return NAME;
6095 }

References NAME.

◆ get_param_types()

TypeDict EMAN::NormalizeCircleMeanProcessor::get_param_types ( ) const
inlinevirtual

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

6108 {
6109 TypeDict d;
6110 d.put("radius", EMObject::FLOAT,"Radius (pixels) of inner edge of circular ring");
6111 d.put("width", EMObject::FLOAT,"width (pixels) of ring to average over, default 2");
6112 return d;
6113 }
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair.
Definition: emobject.h:305
void put(const string &key, EMObject::ObjectType o, const string &desc="")
Definition: emobject.h:330

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

◆ NEW()

static Processor * EMAN::NormalizeCircleMeanProcessor::NEW ( )
inlinestatic

Definition at line 6097 of file processor.h.

6098 {
6099 return new NormalizeCircleMeanProcessor();
6100 }
normalizes an image, mean value equals to mean of 2 pixel circular border.
Definition: processor.h:6090

Member Data Documentation

◆ NAME

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

Definition at line 6115 of file processor.h.

Referenced by get_name().


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