Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
EMAN::BwMajorityProcessor Class Reference

Set a pixel to white when >= N neighbors are white. More...

#include <processor.h>

Inheritance diagram for EMAN::BwMajorityProcessor:
Inheritance graph
Collaboration diagram for EMAN::BwMajorityProcessor:
Collaboration graph

Public Member Functions

virtual string get_name () const
 Get the processor's name. More...
string get_desc () const
 Get the descrition of this specific processor. More...
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
- Public Member Functions inherited from EMAN::BoxStatProcessor
virtual void process_inplace (EMData *image)
 To process an image in-place. More...
virtual EMDataprocess (EMData *image)
- 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::BoxStatProcessor
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 = "morph.majority"

Protected Member Functions

void process_pixel (float *pixel, const float *array, int n) const

Additional Inherited Members

- Public Types inherited from EMAN::Processor
enum  fourier_filter_types {
 Fourier filter Processor type enum. More...
- Protected Attributes inherited from EMAN::Processor
Dict params

Detailed Description

Set a pixel to white when >= N neighbors are white.

: Muyuan Chen
: 04/2015

Definition at line 9573 of file processor.h.

Member Function Documentation

◆ get_desc()

string EMAN::BwMajorityProcessor::get_desc ( ) const

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

The description of this processor.

Implements EMAN::Processor.

Definition at line 9584 of file processor.h.

9585 {
9586 return "Set a pixel to white when >= N neighbors are white.";
9587 }

◆ get_name()

virtual string EMAN::BwMajorityProcessor::get_name ( ) const

Get the processor's name.

Each processor is identified by a unique name.

The processor's name.

Implements EMAN::Processor.

Definition at line 9576 of file processor.h.

9577 {
9578 return NAME;
9579 }
static const string NAME
Definition: processor.h:9596

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::BwMajorityProcessor::get_param_types ( ) const

Get processor parameter information in a dictionary.

Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.

A dictionary containing the parameter info.

Reimplemented from EMAN::BoxStatProcessor.

Definition at line 9588 of file processor.h.

9589 {
9590 TypeDict d;
9591 d.put("thresh", EMObject::FLOAT, "The threshold to binarize the map.");
9592 d.put("nmaj", EMObject::INT, "Number of neighbors needed to set to white.");
9593 d.put("return_neighbor", EMObject::BOOL, "Return number of neighbor for each pixel.");
9594 return d;
9595 }
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::BOOL, EMAN::EMObject::FLOAT, EMAN::EMObject::INT, and EMAN::TypeDict::put().

◆ NEW()

static Processor * EMAN::BwMajorityProcessor::NEW ( )

Definition at line 9580 of file processor.h.

9581 {
9582 return new BwMajorityProcessor();
9583 }
Set a pixel to white when >= N neighbors are white.
Definition: processor.h:9574

◆ process_pixel()

void EMAN::BwMajorityProcessor::process_pixel ( float *  pixel,
const float *  array,
int  n 
) const

Implements EMAN::BoxStatProcessor.

Definition at line 9599 of file processor.h.

9600 {
9601 float thresh=params.set_default("thresh",0);
9602 bool retnb=params.set_default("return_neighbor",false);
9603 int nmaj=params.set_default("nmaj",n/2+1);
9604 int nb=0;
9605 for (int i=0; i<n; i++){
9606 if (array[i]>thresh)
9607 nb++;
9608// nmaj--;
9609 }
9610 if (retnb)
9611 *pixel=nb;
9612 else
9613 *pixel=nb>=nmaj?1:0;
9614 }
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

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

Member Data Documentation


const string BwMajorityProcessor::NAME = "morph.majority"

Definition at line 9596 of file processor.h.

Referenced by get_name().

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