#include <averager.h>
Inheritance diagram for EMAN::MinMaxAverager:


Public Member Functions | |
| MinMaxAverager () | |
| void | add_image (EMData *image) |
| To add an image to the Averager. | |
| EMData * | finish () |
| Finish up the averaging and return the result. | |
| string | get_name () const |
| Get the Averager's name. | |
| string | get_desc () const |
| TypeDict | get_param_types () const |
| Get Averager parameter information in a dictionary. | |
| virtual void | mult (const float &) |
| Multiply the result image by some floating point constant This is useful when weighting the input images prior to calling add_image - a situation where it is likely you want to divide by the sum of the weights. | |
Static Public Member Functions | |
| static Averager * | NEW () |
Static Public Attributes | |
| static const string | NAME = "minmax" |
Private Attributes | |
| int | max |
| int | nimg |
It optionally makes a sigma image.
| max | If set, will find the max value, otherwise finds min |
Definition at line 216 of file averager.h.
| MinMaxAverager::MinMaxAverager | ( | ) |
| void MinMaxAverager::add_image | ( | EMData * | image | ) | [virtual] |
To add an image to the Averager.
This image will be averaged in this function.
| image | The image to be averaged. |
Implements EMAN::Averager.
Definition at line 315 of file averager.cpp.
References EMAN::EMData::copy(), get_name(), EMAN::EMData::get_value_at(), EMAN::EMUtil::is_same_size(), LOGERR, max, nimg, EMAN::Averager::params, EMAN::Averager::result, EMAN::EMData::set_value_at(), x, and y.
00316 { 00317 if (!image) { 00318 return; 00319 } 00320 00321 if (nimg >= 1 && !EMUtil::is_same_size(image, result)) { 00322 LOGERR("%sAverager can only process same-size Image", 00323 get_name().c_str()); 00324 return; 00325 } 00326 00327 nimg++; 00328 00329 int nx = image->get_xsize(); 00330 int ny = image->get_ysize(); 00331 int nz = image->get_zsize(); 00332 00333 if (nimg == 1) { 00334 result = image->copy(); 00335 max = params["max"]; 00336 return; 00337 } 00338 00339 for (int z=0; z<nz; z++) { 00340 for (int y=0; y<ny; y++) { 00341 for (int x=0; x<nx; x++) { 00342 if (result->get_value_at(x,y,z)>image->get_value_at(x,y,z)) 00343 { if (!max) result->set_value_at(x,y,z,image->get_value_at(x,y,z)); } 00344 else { if (max) result->set_value_at(x,y,z,image->get_value_at(x,y,z)); } 00345 } 00346 } 00347 } 00348 00349 }
| EMData * MinMaxAverager::finish | ( | ) | [virtual] |
Finish up the averaging and return the result.
Implements EMAN::Averager.
Definition at line 351 of file averager.cpp.
References nimg, EMAN::Averager::result, and EMAN::EMData::update().
00352 { 00353 result->update(); 00354 if (result && nimg > 1) return result; 00355 00356 return NULL; 00357 }
| string EMAN::MinMaxAverager::get_desc | ( | ) | const [inline, virtual] |
| string EMAN::MinMaxAverager::get_name | ( | ) | const [inline, virtual] |
Get the Averager's name.
Each Averager is identified by a unique name.
Implements EMAN::Averager.
Definition at line 224 of file averager.h.
References NAME.
Referenced by add_image().
00225 { 00226 return NAME; 00227 }
| TypeDict EMAN::MinMaxAverager::get_param_types | ( | ) | const [inline, virtual] |
Get Averager parameter information in a dictionary.
Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Averager.
Definition at line 239 of file averager.h.
References EMAN::EMObject::INT, and EMAN::TypeDict::put().
00240 { 00241 TypeDict d; 00242 d.put("max", EMObject::INT, "If set, will find the max value, otherwise finds min"); 00243 return d; 00244 }
| virtual void EMAN::MinMaxAverager::mult | ( | const float & | ) | [inline, virtual] |
Multiply the result image by some floating point constant This is useful when weighting the input images prior to calling add_image - a situation where it is likely you want to divide by the sum of the weights.
Hence call mult after all of the weighted images have been added.
| s | the scaling factor. |
| NullPointerException | if the EMData pointer (result) is NULL |
Reimplemented from EMAN::Averager.
Definition at line 246 of file averager.h.
| static Averager* EMAN::MinMaxAverager::NEW | ( | ) | [inline, static] |
Definition at line 234 of file averager.h.
References MinMaxAverager().
00235 { 00236 return new MinMaxAverager(); 00237 }
int EMAN::MinMaxAverager::max [private] |
const string MinMaxAverager::NAME = "minmax" [static] |
int EMAN::MinMaxAverager::nimg [private] |
1.4.7