#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 5416 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 5431 of file processor.h. 05432 { 05433 return "Multiplies the image by the specified file using pixel coordinates instead of pixel indices. The images can be different size."; 05434 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 5421 of file processor.h. 05422 {
05423 return NAME;
05424 }
|
|
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 5436 of file processor.h. References EMAN::TypeDict::put(). 05437 { 05438 TypeDict d; 05439 d.put("filename", EMObject::STRING, "mask image file name"); 05440 return d; 05441 }
|
|
Definition at line 5426 of file processor.h. 05427 { 05428 return new CoordinateMaskFileProcessor(); 05429 }
|
|
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 6184 of file processor.cpp. References EMAN::EMData::get_attr(), EMAN::EMData::get_attr_default(), 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(). 06185 { 06186 if (!image) { 06187 LOGWARN("NULL Image"); 06188 return; 06189 } 06190 06191 const char *filename = params["filename"]; 06192 EMData *msk = new EMData(); 06193 msk->read_image(filename); 06194 06195 int nx = image->get_xsize(); 06196 int ny = image->get_ysize(); 06197 int nz = image->get_zsize(); 06198 06199 int xm = msk->get_xsize(); 06200 int ym = msk->get_ysize(); 06201 int zm = msk->get_zsize(); 06202 06203 float apix = image->get_attr("apix_x"); 06204 float apixm = msk->get_attr("apix_x"); 06205 06206 float xo = image->get_attr_default("origin_x",0.0); 06207 float yo = image->get_attr_default("origin_y",0.0); 06208 float zo = image->get_attr_default("origin_z",0.0); 06209 06210 float xom = msk->get_attr_default("origin_x",0.0); 06211 float yom = msk->get_attr_default("origin_y",0.0); 06212 float zom = msk->get_attr_default("origin_z",0.0); 06213 06214 float *dp = image->get_data(); 06215 float *dpm = msk->get_data(); 06216 int nxy = nx * ny; 06217 06218 for (int k = 0; k < nz; k++) { 06219 float zc = zo + k * apix; 06220 if (zc <= zom || zc >= zom + zm * apixm) { 06221 memset(&(dp[k * nxy]), 0, sizeof(float) * nxy); 06222 } 06223 else { 06224 int km = (int) ((zc - zom) / apixm); 06225 06226 for (int j = 0; j < ny; j++) { 06227 float yc = yo + j * apix; 06228 if (yc <= yom || yc >= yom + ym * apixm) { 06229 memset(&(dp[k * nxy + j * nx]), 0, sizeof(float) * nx); 06230 } 06231 else { 06232 int jm = (int) ((yc - yom) / apixm); 06233 size_t idx = 0; 06234 float xc; 06235 int im; 06236 for (int i = 0; i < nx; i++) { 06237 xc = xo + i * apix; 06238 idx = (size_t)k * nxy + j * nx + i; 06239 if (xc <= xom || xc >= xom + xm * apixm) { 06240 dp[idx] = 0; 06241 } 06242 else { 06243 im = (int) ((xc - xom) / apixm); 06244 if (dpm[km * xm * ym + jm * xm + im] <= 0) { 06245 dp[idx] = 0; 06246 } 06247 } 06248 } 06249 } 06250 } 06251 } 06252 } 06253 06254 image->update(); 06255 msk->update(); 06256 if( msk ) 06257 { 06258 delete msk; 06259 msk = 0; 06260 } 06261 }
|
|
Definition at line 179 of file processor.cpp. |