EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
EMAN::DiffBlockProcessor Class Reference

averages over cal_half_width, then sets the value in a local block More...

#include <processor.h>

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

Public Member Functions

void process_inplace (EMData *image)
 To process an image in-place. More...
 
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::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::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 = "eman1.filter.blockrange"
 

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

averages over cal_half_width, then sets the value in a local block

Parameters
cal_half_widthcal_half_width is dx/dy for calculating an average
fill_half_widthfill_half_width is dx/dy for fill/step

Definition at line 4775 of file processor.h.

Member Function Documentation

◆ get_desc()

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

4790 {
4791 return "averages over cal_half_width, then sets the value in a local block";
4792 }

◆ get_name()

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

4781 {
4782 return NAME;
4783 }
static const string NAME
Definition: processor.h:4802

References NAME.

Referenced by process_inplace().

◆ get_param_types()

TypeDict EMAN::DiffBlockProcessor::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 4794 of file processor.h.

4795 {
4796 TypeDict d;
4797 d.put("cal_half_width", EMObject::FLOAT, "cal_half_width is dx/dy for calculating an average");
4798 d.put("fill_half_width", EMObject::FLOAT, "fill_half_width is dx/dy for fill/step");
4799 return d;
4800 }
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::DiffBlockProcessor::NEW ( )
inlinestatic

Definition at line 4784 of file processor.h.

4785 {
4786 return new DiffBlockProcessor();
4787 }
averages over cal_half_width, then sets the value in a local block
Definition: processor.h:4776

◆ process_inplace()

void DiffBlockProcessor::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 2710 of file processor.cpp.

2711{
2712 if (!image) {
2713 LOGWARN("NULL Image");
2714 return;
2715 }
2716
2717 int nz = image->get_zsize();
2718
2719 if (nz > 1) {
2720 LOGERR("%s Processor doesn't support 3D", get_name().c_str());
2721 throw ImageDimensionException("3D model not supported");
2722 }
2723
2724 int nx = image->get_xsize();
2725 int ny = image->get_ysize();
2726
2727 int v1 = params["cal_half_width"];
2728 int v2 = params["fill_half_width"];
2729
2730 int v0 = v1 > v2 ? v1 : v2;
2731
2732 if (v2 <= 0) {
2733 v2 = v1;
2734 }
2735
2736 float *data = image->get_data();
2737
2738 for (int y = v0; y <= ny - v0 - 1; y += v2) {
2739 for (int x = v0; x <= nx - v0 - 1; x += v2) {
2740
2741 float sum = 0;
2742 for (int y1 = y - v1; y1 <= y + v1; y1++) {
2743 for (int x1 = x - v1; x1 <= x + v1; x1++) {
2744 sum += data[x1 + y1 * nx];
2745 }
2746 }
2747 float mean = sum / ((v1 * 2 + 1) * (v1 * 2 + 1));
2748
2749 for (int j = y - v2; j <= y + v2; j++) {
2750 for (int i = x - v2; i <= x + v2; i++) {
2751 data[i + j * nx] = mean;
2752 }
2753 }
2754 }
2755 }
2756
2757 image->update();
2758}
#define v0(i)
Definition: analyzer.cpp:698
string get_name() const
Get the processor's name.
Definition: processor.h:4780
#define ImageDimensionException(desc)
Definition: exception.h:166
#define LOGWARN
Definition: log.h:53
#define LOGERR
Definition: log.h:51
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517

References get_name(), ImageDimensionException, LOGERR, LOGWARN, EMAN::Processor::params, v0, x, and y.

Member Data Documentation

◆ NAME

const string DiffBlockProcessor::NAME = "eman1.filter.blockrange"
static

Definition at line 4802 of file processor.h.

Referenced by get_name().


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