#include <processor.h>
Inheritance diagram for EMAN::CoordinateMaskFileProcessor:


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 | |
| Processor * | NEW () |
Static Public Attributes | |
| const string | NAME = "mask.fromfile.sizediff" |
The images can be different size.
| filename | mask image file name |
Definition at line 5300 of file processor.h.
|
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 5315 of file processor.h. 05316 {
05317 return "Multiplies the image by the specified file using pixel coordinates instead of pixel indices. The images can be different size.";
05318 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5305 of file processor.h. 05306 {
05307 return NAME;
05308 }
|
|
|
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 5320 of file processor.h. References EMAN::TypeDict::put(). 05321 {
05322 TypeDict d;
05323 d.put("filename", EMObject::STRING, "mask image file name");
05324 return d;
05325 }
|
|
|
Definition at line 5310 of file processor.h. 05311 {
05312 return new CoordinateMaskFileProcessor();
05313 }
|
|
|
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 5994 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, nx, ny, EMAN::EMData::read_image(), and EMAN::EMData::update(). 05995 {
05996 if (!image) {
05997 LOGWARN("NULL Image");
05998 return;
05999 }
06000
06001 const char *filename = params["filename"];
06002 EMData *msk = new EMData();
06003 msk->read_image(filename);
06004
06005 int nx = image->get_xsize();
06006 int ny = image->get_ysize();
06007 int nz = image->get_zsize();
06008
06009 int xm = msk->get_xsize();
06010 int ym = msk->get_ysize();
06011 int zm = msk->get_zsize();
06012
06013 float apix = image->get_attr("apix_x");
06014 float apixm = msk->get_attr("apix_x");
06015
06016 float xo = image->get_attr("origin_x");
06017 float yo = image->get_attr("origin_y");
06018 float zo = image->get_attr("origin_z");
06019
06020 float xom = msk->get_attr("origin_x");
06021 float yom = msk->get_attr("origin_y");
06022 float zom = msk->get_attr("origin_z");
06023
06024 float *dp = image->get_data();
06025 float *dpm = msk->get_data();
06026 int nxy = nx * ny;
06027
06028 for (int k = 0; k < nz; k++) {
06029 float zc = zo + k * apix;
06030 if (zc <= zom || zc >= zom + zm * apixm) {
06031 memset(&(dp[k * nxy]), 0, sizeof(float) * nxy);
06032 }
06033 else {
06034 int km = (int) ((zc - zom) / apixm);
06035
06036 for (int j = 0; j < ny; j++) {
06037 float yc = yo + j * apix;
06038 if (yc <= yom || yc >= yom + ym * apixm) {
06039 memset(&(dp[k * nxy + j * nx]), 0, sizeof(float) * nx);
06040 }
06041 else {
06042 int jm = (int) ((yc - yom) / apixm);
06043 size_t idx = 0;
06044 float xc;
06045 int im;
06046 for (int i = 0; i < nx; i++) {
06047 xc = xo + i * apix;
06048 idx = (size_t)k * nxy + j * nx + i;
06049 if (xc <= xom || xc >= xom + xm * apixm) {
06050 dp[idx] = 0;
06051 }
06052 else {
06053 im = (int) ((xc - xom) / apixm);
06054 if (dpm[km * xm * ym + jm * xm + im] <= 0) {
06055 dp[idx] = 0;
06056 }
06057 }
06058 }
06059 }
06060 }
06061 }
06062 }
06063
06064 image->update();
06065 msk->update();
06066 if( msk )
06067 {
06068 delete msk;
06069 msk = 0;
06070 }
06071 }
|
|
|
Definition at line 178 of file processor.cpp. |
1.3.9.1