#include <processor.h>


Public Member Functions | |
| virtual void | process_inplace (EMData *image) |
| To process an image in-place. | |
| 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. | |
Static Public Member Functions | |
| static Processor * | NEW () |
The images can be different size.
| filename | mask image file name |
Definition at line 5003 of file processor.h.
| void CoordinateMaskFileProcessor::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.
| image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 5583 of file processor.cpp.
References EMAN::EMData::get_attr(), EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), LOGWARN, EMAN::Processor::params, EMAN::EMData::read_image(), and EMAN::EMData::update().
05584 { 05585 if (!image) { 05586 LOGWARN("NULL Image"); 05587 return; 05588 } 05589 05590 const char *filename = params["filename"]; 05591 EMData *msk = new EMData(); 05592 msk->read_image(filename); 05593 05594 int nx = image->get_xsize(); 05595 int ny = image->get_ysize(); 05596 int nz = image->get_zsize(); 05597 05598 int xm = msk->get_xsize(); 05599 int ym = msk->get_ysize(); 05600 int zm = msk->get_zsize(); 05601 05602 float apix = image->get_attr("apix_x"); 05603 float apixm = msk->get_attr("apix_x"); 05604 05605 float xo = image->get_attr("origin_x"); 05606 float yo = image->get_attr("origin_y"); 05607 float zo = image->get_attr("origin_z"); 05608 05609 float xom = msk->get_attr("origin_x"); 05610 float yom = msk->get_attr("origin_y"); 05611 float zom = msk->get_attr("origin_z"); 05612 05613 float *dp = image->get_data(); 05614 float *dpm = msk->get_data(); 05615 int nxy = nx * ny; 05616 05617 for (int k = 0; k < nz; k++) { 05618 float zc = zo + k * apix; 05619 if (zc <= zom || zc >= zom + zm * apixm) { 05620 memset(&(dp[k * nxy]), 0, sizeof(float) * nxy); 05621 } 05622 else { 05623 int km = (int) ((zc - zom) / apixm); 05624 05625 for (int j = 0; j < ny; j++) { 05626 float yc = yo + j * apix; 05627 if (yc <= yom || yc >= yom + ym * apixm) { 05628 memset(&(dp[k * nxy + j * nx]), 0, sizeof(float) * nx); 05629 } 05630 else { 05631 int jm = (int) ((yc - yom) / apixm); 05632 size_t idx = 0; 05633 float xc; 05634 int im; 05635 for (int i = 0; i < nx; i++) { 05636 xc = xo + i * apix; 05637 idx = k * nxy + j * nx + i; 05638 if (xc <= xom || xc >= xom + xm * apixm) { 05639 dp[idx] = 0; 05640 } 05641 else { 05642 im = (int) ((xc - xom) / apixm); 05643 if (dpm[km * xm * ym + jm * xm + im] <= 0) { 05644 dp[idx] = 0; 05645 } 05646 } 05647 } 05648 } 05649 } 05650 } 05651 } 05652 05653 image->update(); 05654 msk->update(); 05655 if( msk ) 05656 { 05657 delete msk; 05658 msk = 0; 05659 } 05660 }
| virtual string EMAN::CoordinateMaskFileProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 5008 of file processor.h.
| static Processor* EMAN::CoordinateMaskFileProcessor::NEW | ( | ) | [inline, static] |
Definition at line 5013 of file processor.h.
05014 { 05015 return new CoordinateMaskFileProcessor(); 05016 }
| virtual string EMAN::CoordinateMaskFileProcessor::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 5018 of file processor.h.
05019 { 05020 return "Multiplies the image by the specified file using pixel coordinates instead of pixel indices. The images can be different size."; 05021 }
| virtual TypeDict EMAN::CoordinateMaskFileProcessor::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 5023 of file processor.h.
References EMAN::TypeDict::put(), and EMAN::EMObject::STRING.
05024 { 05025 TypeDict d; 05026 d.put("filename", EMObject::STRING, "mask image file name"); 05027 return d; 05028 }
1.5.6