#include <processor.h>
Inheritance diagram for EMAN::SigmaZeroEdgeProcessor:
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 | |
static Processor * | NEW () |
Static Public Attributes | |
static const string | NAME = "mask.zeroedgefill" |
Definition at line 3798 of file processor.h.
string EMAN::SigmaZeroEdgeProcessor::get_desc | ( | ) | const [inline, virtual] |
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 3812 of file processor.h.
string EMAN::SigmaZeroEdgeProcessor::get_name | ( | ) | const [inline, virtual] |
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 3803 of file processor.h.
References NAME.
Referenced by process_inplace().
03804 { 03805 return NAME; 03806 }
static Processor* EMAN::SigmaZeroEdgeProcessor::NEW | ( | ) | [inline, static] |
Definition at line 3807 of file processor.h.
03808 { 03809 return new SigmaZeroEdgeProcessor(); 03810 }
void SigmaZeroEdgeProcessor::process_inplace | ( | EMData * | image | ) | [virtual] |
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.
image | The image to be processed. |
Implements EMAN::Processor.
Definition at line 3023 of file processor.cpp.
References EMAN::EMData::get_data(), get_name(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), ImageDimensionException, LOGERR, LOGWARN, EMAN::EMData::update(), and v.
03024 { 03025 if (!image) { 03026 LOGWARN("NULL Image"); 03027 return; 03028 } 03029 03030 if (image->get_zsize() > 1) { 03031 LOGERR("%s Processor doesn't support 3D model", get_name().c_str()); 03032 throw ImageDimensionException("3D model not supported"); 03033 } 03034 float *d = image->get_data(); 03035 int i = 0; 03036 int j = 0; 03037 03038 int nx = image->get_xsize(); 03039 int ny = image->get_ysize(); 03040 03041 for (j = 0; j < ny; j++) { 03042 for (i = 0; i < nx - 1; i++) { 03043 if (d[i + j * nx] != 0) { 03044 break; 03045 } 03046 } 03047 03048 float v = d[i + j * nx]; 03049 while (i >= 0) { 03050 d[i + j * nx] = v; 03051 i--; 03052 } 03053 03054 for (i = nx - 1; i > 0; i--) { 03055 if (d[i + j * nx] != 0) 03056 break; 03057 } 03058 v = d[i + j * nx]; 03059 while (i < nx) { 03060 d[i + j * nx] = v; 03061 i++; 03062 } 03063 } 03064 03065 for (i = 0; i < nx; i++) { 03066 for (j = 0; j < ny; j++) { 03067 if (d[i + j * nx] != 0) 03068 break; 03069 } 03070 03071 float v = d[i + j * nx]; 03072 while (j >= 0) { 03073 d[i + j * nx] = v; 03074 j--; 03075 } 03076 03077 for (j = ny - 1; j > 0; j--) { 03078 if (d[i + j * nx] != 0) 03079 break; 03080 } 03081 v = d[i + j * nx]; 03082 while (j < ny) { 03083 d[i + j * nx] = v; 03084 j++; 03085 } 03086 } 03087 03088 03089 image->update(); 03090 }
const string SigmaZeroEdgeProcessor::NAME = "mask.zeroedgefill" [static] |