#include <processor.h>
Inheritance diagram for EMAN::PaintProcessor:
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 | |
Processor * | NEW () |
Static Public Attributes | |
const string | NAME = "mask.paint" |
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 5199 of file processor.h.
|
Definition at line 5202 of file processor.h. References r1, r2, v1, v2, x, y, and z. Referenced by NEW().
|
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 5216 of file processor.h. 05217 { 05218 return "Paints a circle with a decaying edge into the image. r<r1 -> v1, r1<r<r2 -> (v1,v2), r>r2 unchanged"; 05219 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5206 of file processor.h. 05207 {
05208 return NAME;
05209 }
|
|
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 5221 of file processor.h. References EMAN::TypeDict::put(). 05222 { 05223 TypeDict d; 05224 d.put("x", EMObject::INT, "x coordinate for Center of circle"); 05225 d.put("y", EMObject::INT, "y coordinate for Center of circle"); 05226 d.put("z", EMObject::INT, "z coordinate for Center of circle"); 05227 d.put("r1", EMObject::INT, "Inner radius"); 05228 d.put("v1", EMObject::FLOAT, "Inner value"); 05229 d.put("r2", EMObject::INT, "Outter radius"); 05230 d.put("v2", EMObject::FLOAT, "Outer Value"); 05231 return d; 05232 }
|
|
Definition at line 5211 of file processor.h. References PaintProcessor(). 05212 { 05213 return new PaintProcessor(); 05214 }
|
|
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.
Implements EMAN::Processor. Definition at line 1225 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::EMData::update(), v1, v2, x, y, and z. 01225 { 01226 int nx=image->get_xsize(); 01227 int ny=image->get_ysize(); 01228 int nz=image->get_zsize(); 01229 01230 if (nz==1) { 01231 float r; 01232 for (int j=(y<r2?0:y-r2); j<(y+r2>ny?ny:y+r2); j++) { 01233 for (int i=(x<r2?0:x-r2); i<(x+r2>nx?nx:x+r2); i++) { 01234 r=sqrt(float(Util::square(i-x)+Util::square(j-y))); 01235 if (r>r2 && r>r1) continue; 01236 if (r>r1) image->set_value_at(i,j,0,v2*(r-r1)/(r2-r1)+v1*(r2-r)/(r2-r1)); 01237 else image->set_value_at(i,j,0,v1); 01238 } 01239 } 01240 } 01241 else { 01242 float r; 01243 for (int k=(z<r2?0:z-r2); k<(z+r2>nz?nz:z+r2); k++) { 01244 for (int j=(y<r2?0:y-r2); j<(y+r2>ny?ny:y+r2); j++) { 01245 for (int i=(x<r2?0:x-r2); i<(x+r2>nx?nx:x+r2); i++) { 01246 r=sqrt(float(Util::square(i-x)+Util::square(j-y)+Util::square(k-z))); 01247 if (r>r2 && r>r1) continue; 01248 if (r>r1) image->set_value_at(i,j,k,v2*(r-r1)/(r2-r1)+v1*(r2-r)/(r2-r1)); 01249 else image->set_value_at(i,j,k,v1); 01250 } 01251 } 01252 } 01253 } 01254 image->update(); 01255 }
|
|
Set the processor parameters using a key/value dictionary.
Reimplemented from EMAN::Processor. Definition at line 5234 of file processor.h. References EMAN::Dict::has_key(), r1, r2, v1, v2, x, y, and z. 05235 { 05236 params = new_params; 05237 05238 if (params.has_key("x")) x = params["x"]; 05239 if (params.has_key("y")) y = params["y"]; 05240 if (params.has_key("z")) z = params["z"]; 05241 if (params.has_key("r1")) r1 = params["r1"]; 05242 if (params.has_key("r2")) r2 = params["r2"]; 05243 if (params.has_key("v1")) v1 = params["v1"]; 05244 if (params.has_key("v2")) v2 = params["v2"]; 05245 }
|
|
Definition at line 174 of file processor.cpp. |
|
Definition at line 5252 of file processor.h. Referenced by PaintProcessor(), process_inplace(), and set_params(). |
|
Definition at line 5254 of file processor.h. Referenced by PaintProcessor(), process_inplace(), and set_params(). |
|
Definition at line 5253 of file processor.h. Referenced by PaintProcessor(), process_inplace(), and set_params(). |
|
Definition at line 5255 of file processor.h. Referenced by PaintProcessor(), process_inplace(), and set_params(). |
|
Definition at line 5252 of file processor.h. Referenced by PaintProcessor(), process_inplace(), and set_params(). |
|
Definition at line 5252 of file processor.h. Referenced by PaintProcessor(), process_inplace(), and set_params(). |
|
Definition at line 5252 of file processor.h. Referenced by PaintProcessor(), process_inplace(), and set_params(). |