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

Multiplies the image by the specified file using pixel coordinates instead of pixel indices. More...

#include <processor.h>

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

Public Member Functions

 PaintProcessor ()
 
virtual string get_name () const
 Get the processor's name. More...
 
virtual 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...
 
virtual void set_params (const Dict &new_params)
 Set the processor parameters using a key/value 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...
 

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.paint"
 

Protected Member Functions

virtual void process_inplace (EMData *image)
 To process an image in-place. More...
 

Protected Attributes

int x
 
int y
 
int z
 
int r1
 
float v1
 
int r2
 
float v2
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

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...
 

Detailed Description

Multiplies the image by the specified file using pixel coordinates instead of pixel indices.

The images can be different size.

Parameters
filenamemask image file name 'paints' a circle into the image at x,y,z with values inside r1 set to v1, values between r1 and r2 will be set to a value between v1 and v2, and values outside r2 will be unchanged
xx coordinate for Center of circle
yy coordinate for Center of circle
zz coordinate for Center of circle
r1Inner radius
v1Inner value
r2Outter radius
v2Outer Value

Definition at line 7581 of file processor.h.

Constructor & Destructor Documentation

◆ PaintProcessor()

EMAN::PaintProcessor::PaintProcessor ( )
inline

Definition at line 7584 of file processor.h.

7584 :x(0), y(0), z(0),r1(0), v1(0.0), r2(0), v2(0.0)
7585 {
7586 }

Referenced by NEW().

Member Function Documentation

◆ get_desc()

virtual string EMAN::PaintProcessor::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 7598 of file processor.h.

7599 {
7600 return "Paints a circle with a decaying edge into the image. r<r1 -> v1, r1<r<r2 -> (v1,v2), r>r2 unchanged";
7601 }

◆ get_name()

virtual string EMAN::PaintProcessor::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 7588 of file processor.h.

7589 {
7590 return NAME;
7591 }
static const string NAME
Definition: processor.h:7629

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::PaintProcessor::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 7603 of file processor.h.

7604 {
7605 TypeDict d;
7606 d.put("x", EMObject::INT, "x coordinate for Center of circle");
7607 d.put("y", EMObject::INT, "y coordinate for Center of circle");
7608 d.put("z", EMObject::INT, "z coordinate for Center of circle");
7609 d.put("r1", EMObject::INT, "Inner radius");
7610 d.put("v1", EMObject::FLOAT, "Inner value");
7611 d.put("r2", EMObject::INT, "Outter radius");
7612 d.put("v2", EMObject::FLOAT, "Outer Value");
7613 return d;
7614 }
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, EMAN::EMObject::INT, and EMAN::TypeDict::put().

◆ NEW()

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

Definition at line 7593 of file processor.h.

7594 {
7595 return new PaintProcessor();
7596 }

References PaintProcessor().

◆ process_inplace()

void PaintProcessor::process_inplace ( EMData image)
protectedvirtual

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 2304 of file processor.cpp.

2304 {
2305 int nx=image->get_xsize();
2306 int ny=image->get_ysize();
2307 int nz=image->get_zsize();
2308
2309 if (nz==1) {
2310 float r;
2311 for (int j=(y<r2?0:y-r2); j<(y+r2>ny?ny:y+r2); j++) {
2312 for (int i=(x<r2?0:x-r2); i<(x+r2>nx?nx:x+r2); i++) {
2313 r=sqrt(float(Util::square(i-x)+Util::square(j-y)));
2314 if (r>r2 && r>r1) continue;
2315 if (r>r1) image->set_value_at(i,j,0,v2*(r-r1)/(r2-r1)+v1*(r2-r)/(r2-r1));
2316 else image->set_value_at(i,j,0,v1);
2317 }
2318 }
2319 }
2320 else {
2321 float r;
2322 for (int k=(z<r2?0:z-r2); k<(z+r2>nz?nz:z+r2); k++) {
2323 for (int j=(y<r2?0:y-r2); j<(y+r2>ny?ny:y+r2); j++) {
2324 for (int i=(x<r2?0:x-r2); i<(x+r2>nx?nx:x+r2); i++) {
2325 r=sqrt(float(Util::square(i-x)+Util::square(j-y)+Util::square(k-z)));
2326 if (r>r2 && r>r1) continue;
2327 if (r>r1) image->set_value_at(i,j,k,v2*(r-r1)/(r2-r1)+v1*(r2-r)/(r2-r1));
2328 else image->set_value_at(i,j,k,v1);
2329 }
2330 }
2331 }
2332 }
2333 image->update();
2334}
static int square(int n)
Calculate a number's square.
Definition: util.h:736
EMData * sqrt() const
return square root of current image

References r1, r2, sqrt(), EMAN::Util::square(), v1, v2, x, y, and z.

◆ set_params()

virtual void EMAN::PaintProcessor::set_params ( const Dict new_params)
inlinevirtual

Set the processor parameters using a key/value dictionary.

Parameters
new_paramsA dictionary containing the new parameters.

Reimplemented from EMAN::Processor.

Definition at line 7616 of file processor.h.

7617 {
7618 params = new_params;
7619
7620 if (params.has_key("x")) x = params["x"];
7621 if (params.has_key("y")) y = params["y"];
7622 if (params.has_key("z")) z = params["z"];
7623 if (params.has_key("r1")) r1 = params["r1"];
7624 if (params.has_key("r2")) r2 = params["r2"];
7625 if (params.has_key("v1")) v1 = params["v1"];
7626 if (params.has_key("v2")) v2 = params["v2"];
7627 }
bool has_key(const string &key) const
Ask the Dictionary if it as a particular key.
Definition: emobject.h:511

References EMAN::Dict::has_key(), EMAN::Processor::params, r1, r2, v1, v2, x, y, and z.

Member Data Documentation

◆ NAME

const string PaintProcessor::NAME = "mask.paint"
static

Definition at line 7629 of file processor.h.

Referenced by get_name().

◆ r1

int EMAN::PaintProcessor::r1
protected

Definition at line 7634 of file processor.h.

Referenced by process_inplace(), and set_params().

◆ r2

int EMAN::PaintProcessor::r2
protected

Definition at line 7636 of file processor.h.

Referenced by process_inplace(), and set_params().

◆ v1

float EMAN::PaintProcessor::v1
protected

Definition at line 7635 of file processor.h.

Referenced by process_inplace(), and set_params().

◆ v2

float EMAN::PaintProcessor::v2
protected

Definition at line 7637 of file processor.h.

Referenced by process_inplace(), and set_params().

◆ x

int EMAN::PaintProcessor::x
protected

Definition at line 7634 of file processor.h.

Referenced by process_inplace(), and set_params().

◆ y

int EMAN::PaintProcessor::y
protected

Definition at line 7634 of file processor.h.

Referenced by process_inplace(), and set_params().

◆ z

int EMAN::PaintProcessor::z
protected

Definition at line 7634 of file processor.h.

Referenced by process_inplace(), and set_params().


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