#include <processor.h>


Public Member Functions | |
| PaintProcessor () | |
| virtual string | get_name () const |
| Get the processor's name. | |
| virtual string | get_desc () const |
| Get the descrition of this specific processor. | |
| virtual TypeDict | get_param_types () const |
| Get processor parameter information in a dictionary. | |
| virtual void | set_params (const Dict &new_params) |
| Set the processor parameters using a key/value dictionary. | |
Static Public Member Functions | |
| static Processor * | NEW () |
Protected Member Functions | |
| virtual void | process_inplace (EMData *image) |
| To process an image in-place. | |
Protected Attributes | |
| int | x |
| int | y |
| int | z |
| int | r1 |
| float | v1 |
| int | r2 |
| float | v2 |
| x | x coordinate for Center of circle | |
| y | y coordinate for Center of circle | |
| z | z coordinate for Center of circle | |
| r1 | Inner radius | |
| v1 | Inner value | |
| r2 | Outter radius | |
| v2 | Outer Value |
Definition at line 5041 of file processor.h.
| EMAN::PaintProcessor::PaintProcessor | ( | ) | [inline] |
| virtual string EMAN::PaintProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 5048 of file processor.h.
| static Processor* EMAN::PaintProcessor::NEW | ( | ) | [inline, static] |
| virtual string EMAN::PaintProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 5058 of file processor.h.
05059 { 05060 return "Paints a circle with a decaying edge into the image. r<r1 -> v1, r1<r<r2 -> (v1,v2), r>r2 unchanged"; 05061 }
| virtual TypeDict EMAN::PaintProcessor::get_param_types | ( | ) | const [inline, virtual] |
Get processor parameter information in a dictionary.
Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Processor.
Definition at line 5063 of file processor.h.
References EMAN::EMObject::FLOAT, EMAN::EMObject::INT, and EMAN::TypeDict::put().
05064 { 05065 TypeDict d; 05066 d.put("x", EMObject::INT, "x coordinate for Center of circle"); 05067 d.put("y", EMObject::INT, "y coordinate for Center of circle"); 05068 d.put("z", EMObject::INT, "z coordinate for Center of circle"); 05069 d.put("r1", EMObject::INT, "Inner radius"); 05070 d.put("v1", EMObject::FLOAT, "Inner value"); 05071 d.put("r2", EMObject::INT, "Outter radius"); 05072 d.put("v2", EMObject::FLOAT, "Outer Value"); 05073 return d; 05074 }
| virtual void EMAN::PaintProcessor::set_params | ( | const Dict & | new_params | ) | [inline, virtual] |
Set the processor parameters using a key/value dictionary.
| new_params | A dictionary containing the new parameters. |
Reimplemented from EMAN::Processor.
Definition at line 5076 of file processor.h.
References EMAN::Dict::has_key(), EMAN::Processor::params, x, and y.
05077 { 05078 params = new_params; 05079 05080 if (params.has_key("x")) x = params["x"]; 05081 if (params.has_key("y")) y = params["y"]; 05082 if (params.has_key("z")) z = params["z"]; 05083 if (params.has_key("r1")) r1 = params["r1"]; 05084 if (params.has_key("r2")) r2 = params["r2"]; 05085 if (params.has_key("v1")) v1 = params["v1"]; 05086 if (params.has_key("v2")) v2 = params["v2"]; 05087 }
| void PaintProcessor::process_inplace | ( | EMData * | image | ) | [protected, 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.
| image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 886 of file processor.cpp.
References EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), nx, ny, r1, r2, EMAN::EMData::set_value_at(), sqrt(), EMAN::Util::square(), EMAN::EMData::update(), v1, v2, x, y, and z.
00886 { 00887 int nx=image->get_xsize(); 00888 int ny=image->get_ysize(); 00889 int nz=image->get_zsize(); 00890 00891 if (nz==1) { 00892 float r; 00893 for (int j=(y<r2?0:y-r2); j<(y+r2>ny?ny:y+r2); j++) { 00894 for (int i=(x<r2?0:x-r2); i<(x+r2>nx?nx:x+r2); i++) { 00895 r=sqrt(float(Util::square(i-x)+Util::square(j-y))); 00896 if (r>r2 && r>r1) continue; 00897 if (r>r1) image->set_value_at(i,j,0,v2*(r-r1)/(r2-r1)+v1*(r2-r)/(r2-r1)); 00898 else image->set_value_at(i,j,0,v1); 00899 } 00900 } 00901 } 00902 else { 00903 float r; 00904 for (int k=(z<r2?0:z-r2); k<(z+r2>nz?nz:z+r2); k++) { 00905 for (int j=(y<r2?0:y-r2); j<(y+r2>ny?ny:y+r2); j++) { 00906 for (int i=(x<r2?0:x-r2); i<(x+r2>nx?nx:x+r2); i++) { 00907 r=sqrt(float(Util::square(i-x)+Util::square(j-y)+Util::square(k-z))); 00908 if (r>r2 && r>r1) continue; 00909 if (r>r1) image->set_value_at(i,j,k,v2*(r-r1)/(r2-r1)+v1*(r2-r)/(r2-r1)); 00910 else image->set_value_at(i,j,k,v1); 00911 } 00912 } 00913 } 00914 } 00915 image->update(); 00916 }
int EMAN::PaintProcessor::x [protected] |
int EMAN::PaintProcessor::y [protected] |
int EMAN::PaintProcessor::z [protected] |
int EMAN::PaintProcessor::r1 [protected] |
float EMAN::PaintProcessor::v1 [protected] |
int EMAN::PaintProcessor::r2 [protected] |
float EMAN::PaintProcessor::v2 [protected] |
1.5.6