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


Public Member Functions | |
| void | process_inplace (EMData *image) |
| To process an image in-place. | |
| string | get_name () const |
| Get the processor's name. | |
| string | get_desc () const |
| Get the descrition of this specific processor. | |
Static Public Member Functions | |
| Processor * | NEW () |
Static Public Attributes | |
| const string | NAME = "mask.dampedzeroedgefill" |
Definition at line 3828 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 3843 of file processor.h. 03844 {
03845 return "Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2.";
03846 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 3833 of file processor.h. 03834 {
03835 return NAME;
03836 }
|
|
|
Definition at line 3838 of file processor.h. 03839 {
03840 return new MeanZeroEdgeProcessor();
03841 }
|
|
|
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 3211 of file processor.cpp. References EMAN::Dict::get(), EMAN::EMData::get_attr_dict(), EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, LOGERR, LOGWARN, nx, ny, EMAN::EMData::update(), and v. 03212 {
03213 if (!image) {
03214 LOGWARN("NULL Image");
03215 return;
03216 }
03217 if (image->get_zsize() > 1) {
03218 LOGERR("MeanZeroEdgeProcessor doesn't support 3D model");
03219 throw ImageDimensionException("3D model not supported");
03220 }
03221
03222 int nx = image->get_xsize();
03223 int ny = image->get_ysize();
03224 Dict dict = image->get_attr_dict();
03225 float mean_nonzero = dict.get("mean_nonzero");
03226
03227 float *d = image->get_data();
03228 int i = 0;
03229 int j = 0;
03230
03231 for (j = 0; j < ny; j++) {
03232 for (i = 0; i < nx - 1; i++) {
03233 if (d[i + j * nx] != 0) {
03234 break;
03235 }
03236 }
03237
03238 if (i == nx - 1) {
03239 i = -1;
03240 }
03241
03242 float v = d[i + j * nx] - mean_nonzero;
03243
03244 while (i >= 0) {
03245 v *= 0.9f;
03246 d[i + j * nx] = v + mean_nonzero;
03247 i--;
03248 }
03249
03250
03251 for (i = nx - 1; i > 0; i--) {
03252 if (d[i + j * nx] != 0) {
03253 break;
03254 }
03255 }
03256
03257 if (i == 0) {
03258 i = nx;
03259 }
03260
03261 v = d[i + j * nx] - mean_nonzero;
03262
03263 while (i < nx) {
03264 v *= .9f;
03265 d[i + j * nx] = v + mean_nonzero;
03266 i++;
03267 }
03268 }
03269
03270
03271 for (i = 0; i < nx; i++) {
03272 for (j = 0; j < ny; j++) {
03273 if (d[i + j * nx] != 0)
03274 break;
03275 }
03276
03277 float v = d[i + j * nx] - mean_nonzero;
03278
03279 while (j >= 0) {
03280 v *= .9f;
03281 d[i + j * nx] = v + mean_nonzero;
03282 j--;
03283 }
03284
03285 for (j = ny - 1; j > 0; j--) {
03286 if (d[i + j * nx] != 0)
03287 break;
03288 }
03289
03290 v = d[i + j * nx] - mean_nonzero;
03291
03292 while (j < ny) {
03293 v *= .9f;
03294 d[i + j * nx] = v + mean_nonzero;
03295 j++;
03296 }
03297 }
03298
03299 image->update();
03300 }
|
|
|
Definition at line 142 of file processor.cpp. |
1.3.9.1