#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 3843 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 3857 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 3848 of file processor.h.
References NAME.
Referenced by process_inplace().
03849 { 03850 return NAME; 03851 }
static Processor* EMAN::SigmaZeroEdgeProcessor::NEW | ( | ) | [inline, static] |
Definition at line 3852 of file processor.h.
03853 { 03854 return new SigmaZeroEdgeProcessor(); 03855 }
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 3095 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.
03096 { 03097 if (!image) { 03098 LOGWARN("NULL Image"); 03099 return; 03100 } 03101 03102 if (image->get_zsize() > 1) { 03103 LOGERR("%s Processor doesn't support 3D model", get_name().c_str()); 03104 throw ImageDimensionException("3D model not supported"); 03105 } 03106 float *d = image->get_data(); 03107 int i = 0; 03108 int j = 0; 03109 03110 int nx = image->get_xsize(); 03111 int ny = image->get_ysize(); 03112 03113 for (j = 0; j < ny; j++) { 03114 for (i = 0; i < nx - 1; i++) { 03115 if (d[i + j * nx] != 0) { 03116 break; 03117 } 03118 } 03119 03120 float v = d[i + j * nx]; 03121 while (i >= 0) { 03122 d[i + j * nx] = v; 03123 i--; 03124 } 03125 03126 for (i = nx - 1; i > 0; i--) { 03127 if (d[i + j * nx] != 0) 03128 break; 03129 } 03130 v = d[i + j * nx]; 03131 while (i < nx) { 03132 d[i + j * nx] = v; 03133 i++; 03134 } 03135 } 03136 03137 for (i = 0; i < nx; i++) { 03138 for (j = 0; j < ny; j++) { 03139 if (d[i + j * nx] != 0) 03140 break; 03141 } 03142 03143 float v = d[i + j * nx]; 03144 while (j >= 0) { 03145 d[i + j * nx] = v; 03146 j--; 03147 } 03148 03149 for (j = ny - 1; j > 0; j--) { 03150 if (d[i + j * nx] != 0) 03151 break; 03152 } 03153 v = d[i + j * nx]; 03154 while (j < ny) { 03155 d[i + j * nx] = v; 03156 j++; 03157 } 03158 } 03159 03160 03161 image->update(); 03162 }
const string SigmaZeroEdgeProcessor::NAME = "mask.zeroedgefill" [static] |