#include <processor.h>
Inheritance diagram for EMAN::NormalizeProcessor:
Public Member Functions | |
void | process_inplace (EMData *image) |
To process an image in-place. | |
Static Public Member Functions | |
string | get_group_desc () |
Get the description of this group of processors. | |
Protected Member Functions | |
virtual float | calc_sigma (EMData *image) const |
virtual float | calc_mean (EMData *image) const =0 |
Each specific normalization processor needs to define how to calculate mean and how to calculate sigma.
Definition at line 3851 of file processor.h.
|
|
Reimplemented in EMAN::NormalizeUnitProcessor, EMAN::NormalizeUnitSumProcessor, EMAN::NormalizeMaskProcessor, and EMAN::NormalizeMaxMinProcessor. Definition at line 3335 of file processor.cpp. References EMAN::EMData::get_attr(). Referenced by process_inplace(). 03336 { 03337 return image->get_attr("sigma"); 03338 }
|
|
Get the description of this group of processors. This function is defined in a parent class. It gives a introduction to a group of processors.
Reimplemented from EMAN::Processor. Definition at line 3856 of file processor.h. 03857 { 03858 return "Base class for normalization processors. Each specific normalization processor needs to define how to calculate mean and how to calculate sigma."; 03859 }
|
|
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 3340 of file processor.cpp. References calc_mean(), calc_sigma(), data, EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::Util::goodf(), EMAN::EMData::is_complex(), LOGWARN, and EMAN::EMData::update(). 03341 { 03342 if (!image) { 03343 LOGWARN("cannot do normalization on NULL image"); 03344 return; 03345 } 03346 03347 if (image->is_complex()) { 03348 LOGWARN("cannot do normalization on complex image"); 03349 return; 03350 } 03351 03352 float sigma = calc_sigma(image); 03353 if (sigma == 0 || !Util::goodf(&sigma)) { 03354 LOGWARN("cannot do normalization on image with sigma = 0"); 03355 return; 03356 } 03357 03358 float mean = calc_mean(image); 03359 03360 size_t size = (size_t)image->get_xsize() * (size_t)image->get_ysize() * 03361 (size_t)image->get_zsize(); 03362 float *data = image->get_data(); 03363 03364 for (size_t i = 0; i < size; i++) { 03365 data[i] = (data[i] - mean) / sigma; 03366 } 03367 03368 image->update(); 03369 }
|