#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 3649 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 3664 of file processor.h. 03665 { 03666 return "Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2."; 03667 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 3654 of file processor.h. 03655 {
03656 return NAME;
03657 }
|
|
Definition at line 3659 of file processor.h. 03660 { 03661 return new MeanZeroEdgeProcessor(); 03662 }
|
|
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 3091 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. 03092 { 03093 if (!image) { 03094 LOGWARN("NULL Image"); 03095 return; 03096 } 03097 if (image->get_zsize() > 1) { 03098 LOGERR("MeanZeroEdgeProcessor doesn't support 3D model"); 03099 throw ImageDimensionException("3D model not supported"); 03100 } 03101 03102 int nx = image->get_xsize(); 03103 int ny = image->get_ysize(); 03104 Dict dict = image->get_attr_dict(); 03105 float mean_nonzero = dict.get("mean_nonzero"); 03106 03107 float *d = image->get_data(); 03108 int i = 0; 03109 int j = 0; 03110 03111 for (j = 0; j < ny; j++) { 03112 for (i = 0; i < nx - 1; i++) { 03113 if (d[i + j * nx] != 0) { 03114 break; 03115 } 03116 } 03117 03118 if (i == nx - 1) { 03119 i = -1; 03120 } 03121 03122 float v = d[i + j * nx] - mean_nonzero; 03123 03124 while (i >= 0) { 03125 v *= 0.9f; 03126 d[i + j * nx] = v + mean_nonzero; 03127 i--; 03128 } 03129 03130 03131 for (i = nx - 1; i > 0; i--) { 03132 if (d[i + j * nx] != 0) { 03133 break; 03134 } 03135 } 03136 03137 if (i == 0) { 03138 i = nx; 03139 } 03140 03141 v = d[i + j * nx] - mean_nonzero; 03142 03143 while (i < nx) { 03144 v *= .9f; 03145 d[i + j * nx] = v + mean_nonzero; 03146 i++; 03147 } 03148 } 03149 03150 03151 for (i = 0; i < nx; i++) { 03152 for (j = 0; j < ny; j++) { 03153 if (d[i + j * nx] != 0) 03154 break; 03155 } 03156 03157 float v = d[i + j * nx] - mean_nonzero; 03158 03159 while (j >= 0) { 03160 v *= .9f; 03161 d[i + j * nx] = v + mean_nonzero; 03162 j--; 03163 } 03164 03165 for (j = ny - 1; j > 0; j--) { 03166 if (d[i + j * nx] != 0) 03167 break; 03168 } 03169 03170 v = d[i + j * nx] - mean_nonzero; 03171 03172 while (j < ny) { 03173 v *= .9f; 03174 d[i + j * nx] = v + mean_nonzero; 03175 j++; 03176 } 03177 } 03178 03179 image->update(); 03180 }
|
|
Definition at line 131 of file processor.cpp. |