#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 3790 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 3805 of file processor.h. 03806 { 03807 return "Fill zeroes at edges with nearest horizontal/vertical value damped towards Mean2."; 03808 }
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 3795 of file processor.h. 03796 {
03797 return NAME;
03798 }
|
|
Definition at line 3800 of file processor.h. 03801 { 03802 return new MeanZeroEdgeProcessor(); 03803 }
|
|
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 3183 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. 03184 { 03185 if (!image) { 03186 LOGWARN("NULL Image"); 03187 return; 03188 } 03189 if (image->get_zsize() > 1) { 03190 LOGERR("MeanZeroEdgeProcessor doesn't support 3D model"); 03191 throw ImageDimensionException("3D model not supported"); 03192 } 03193 03194 int nx = image->get_xsize(); 03195 int ny = image->get_ysize(); 03196 Dict dict = image->get_attr_dict(); 03197 float mean_nonzero = dict.get("mean_nonzero"); 03198 03199 float *d = image->get_data(); 03200 int i = 0; 03201 int j = 0; 03202 03203 for (j = 0; j < ny; j++) { 03204 for (i = 0; i < nx - 1; i++) { 03205 if (d[i + j * nx] != 0) { 03206 break; 03207 } 03208 } 03209 03210 if (i == nx - 1) { 03211 i = -1; 03212 } 03213 03214 float v = d[i + j * nx] - mean_nonzero; 03215 03216 while (i >= 0) { 03217 v *= 0.9f; 03218 d[i + j * nx] = v + mean_nonzero; 03219 i--; 03220 } 03221 03222 03223 for (i = nx - 1; i > 0; i--) { 03224 if (d[i + j * nx] != 0) { 03225 break; 03226 } 03227 } 03228 03229 if (i == 0) { 03230 i = nx; 03231 } 03232 03233 v = d[i + j * nx] - mean_nonzero; 03234 03235 while (i < nx) { 03236 v *= .9f; 03237 d[i + j * nx] = v + mean_nonzero; 03238 i++; 03239 } 03240 } 03241 03242 03243 for (i = 0; i < nx; i++) { 03244 for (j = 0; j < ny; j++) { 03245 if (d[i + j * nx] != 0) 03246 break; 03247 } 03248 03249 float v = d[i + j * nx] - mean_nonzero; 03250 03251 while (j >= 0) { 03252 v *= .9f; 03253 d[i + j * nx] = v + mean_nonzero; 03254 j--; 03255 } 03256 03257 for (j = ny - 1; j > 0; j--) { 03258 if (d[i + j * nx] != 0) 03259 break; 03260 } 03261 03262 v = d[i + j * nx] - mean_nonzero; 03263 03264 while (j < ny) { 03265 v *= .9f; 03266 d[i + j * nx] = v + mean_nonzero; 03267 j++; 03268 } 03269 } 03270 03271 image->update(); 03272 }
|
|
Definition at line 136 of file processor.cpp. |