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

Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2. More...

#include <processor.h>

Inheritance diagram for EMAN::MeanZeroEdgeProcessor:
Inheritance graph
[legend]
Collaboration diagram for EMAN::MeanZeroEdgeProcessor:
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...
 
- 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...
 
virtual TypeDict get_param_types () const
 Get processor parameter information in a 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 = "mask.dampedzeroedgefill"
 

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

Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2.

Definition at line 5623 of file processor.h.

Member Function Documentation

◆ get_desc()

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

5639 {
5640 return "Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2.";
5641 }

◆ get_name()

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

5629 {
5630 return NAME;
5631 }
static const string NAME
Definition: processor.h:5643

References NAME.

◆ NEW()

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

Definition at line 5633 of file processor.h.

5634 {
5635 return new MeanZeroEdgeProcessor();
5636 }
Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2.
Definition: processor.h:5624

◆ process_inplace()

void MeanZeroEdgeProcessor::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 4359 of file processor.cpp.

4360{
4361 if (!image) {
4362 LOGWARN("NULL Image");
4363 return;
4364 }
4365 if (image->get_zsize() > 1) {
4366 LOGERR("MeanZeroEdgeProcessor doesn't support 3D model");
4367 throw ImageDimensionException("3D model not supported");
4368 }
4369
4370 int nx = image->get_xsize();
4371 int ny = image->get_ysize();
4372 Dict dict = image->get_attr_dict();
4373 float mean_nonzero = dict.get("mean_nonzero");
4374
4375 float *d = image->get_data();
4376 int i = 0;
4377 int j = 0;
4378
4379 for (j = 0; j < ny; j++) {
4380 for (i = 0; i < nx - 1; i++) {
4381 if (d[i + j * nx] != 0) {
4382 break;
4383 }
4384 }
4385
4386 if (i == nx - 1) {
4387 i = -1;
4388 }
4389
4390 float v = d[i + j * nx] - mean_nonzero;
4391
4392 while (i >= 0) {
4393 v *= 0.9f;
4394 d[i + j * nx] = v + mean_nonzero;
4395 i--;
4396 }
4397
4398
4399 for (i = nx - 1; i > 0; i--) {
4400 if (d[i + j * nx] != 0) {
4401 break;
4402 }
4403 }
4404
4405 if (i == 0) {
4406 i = nx;
4407 }
4408
4409 v = d[i + j * nx] - mean_nonzero;
4410
4411 while (i < nx) {
4412 v *= .9f;
4413 d[i + j * nx] = v + mean_nonzero;
4414 i++;
4415 }
4416 }
4417
4418
4419 for (i = 0; i < nx; i++) {
4420 for (j = 0; j < ny; j++) {
4421 if (d[i + j * nx] != 0)
4422 break;
4423 }
4424
4425 float v = d[i + j * nx] - mean_nonzero;
4426
4427 while (j >= 0) {
4428 v *= .9f;
4429 d[i + j * nx] = v + mean_nonzero;
4430 j--;
4431 }
4432
4433 for (j = ny - 1; j > 0; j--) {
4434 if (d[i + j * nx] != 0)
4435 break;
4436 }
4437
4438 v = d[i + j * nx] - mean_nonzero;
4439
4440 while (j < ny) {
4441 v *= .9f;
4442 d[i + j * nx] = v + mean_nonzero;
4443 j++;
4444 }
4445 }
4446
4447 image->update();
4448}
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
EMObject get(const string &key) const
Get the EMObject corresponding to the particular key Probably better to just use operator[].
Definition: emobject.h:527
#define ImageDimensionException(desc)
Definition: exception.h:166
#define LOGWARN
Definition: log.h:53
#define LOGERR
Definition: log.h:51

References EMAN::Dict::get(), ImageDimensionException, LOGERR, and LOGWARN.

Member Data Documentation

◆ NAME

const string MeanZeroEdgeProcessor::NAME = "mask.dampedzeroedgefill"
static

Definition at line 5643 of file processor.h.

Referenced by get_name().


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