#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 | |
| Averager * | NEW () |
Static Public Attributes | |
| 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 261 of file averager.h.
|
|
Definition at line 412 of file averager.cpp. References max. 00413 : nimg(0) 00414 { 00415 /*move max out of initializer list, since this max(0) is considered as a macro 00416 * in Visual Studio, which we defined somewhere else*/ 00417 max = 0; 00418 }
|
|
|
To add an image to the Averager. This image will be averaged in this function.
Implements EMAN::Averager. Definition at line 420 of file averager.cpp. References EMAN::EMData::copy(), get_name(), EMAN::EMData::get_value_at(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::EMUtil::is_same_size(), LOGERR, max, nimg, nx, ny, EMAN::EMData::set_value_at(), x, and y. 00421 {
00422 if (!image) {
00423 return;
00424 }
00425
00426 if (nimg >= 1 && !EMUtil::is_same_size(image, result)) {
00427 LOGERR("%sAverager can only process same-size Image",
00428 get_name().c_str());
00429 return;
00430 }
00431
00432 nimg++;
00433
00434 int nx = image->get_xsize();
00435 int ny = image->get_ysize();
00436 int nz = image->get_zsize();
00437
00438 if (nimg == 1) {
00439 result = image->copy();
00440 max = params["max"];
00441 return;
00442 }
00443
00444 for (int z=0; z<nz; z++) {
00445 for (int y=0; y<ny; y++) {
00446 for (int x=0; x<nx; x++) {
00447 if (result->get_value_at(x,y,z)>image->get_value_at(x,y,z))
00448 { if (!max) result->set_value_at(x,y,z,image->get_value_at(x,y,z)); }
00449 else { if (max) result->set_value_at(x,y,z,image->get_value_at(x,y,z)); }
00450 }
00451 }
00452 }
00453
00454 }
|
|
|
Finish up the averaging and return the result.
Implements EMAN::Averager. Definition at line 456 of file averager.cpp. References nimg, EMAN::EMData::set_attr(), and EMAN::EMData::update(). 00457 {
00458 result->update();
00459 result->set_attr("ptcl_repr",nimg);
00460
00461 if (result && nimg > 1) return result;
00462
00463 return NULL;
00464 }
|
|
|
Implements EMAN::Averager. Definition at line 274 of file averager.h. 00275 {
00276 return "Finds the minimum or maximum value in each pixel";
00277 }
|
|
|
Get the Averager's name. Each Averager is identified by a unique name.
Implements EMAN::Averager. Definition at line 269 of file averager.h. Referenced by add_image(). 00270 {
00271 return NAME;
00272 }
|
|
|
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 284 of file averager.h. References EMAN::TypeDict::put(). 00285 {
00286 TypeDict d;
00287 d.put("max", EMObject::INT, "If set, will find the max value, otherwise finds min");
00288 return d;
00289 }
|
|
|
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.
Reimplemented from EMAN::Averager. Definition at line 291 of file averager.h. 00291 { }
|
|
|
Definition at line 279 of file averager.h. 00280 {
00281 return new MinMaxAverager();
00282 }
|
|
|
Definition at line 296 of file averager.h. Referenced by add_image(), and MinMaxAverager(). |
|
|
Definition at line 47 of file averager.cpp. |
|
|
Definition at line 297 of file averager.h. Referenced by add_image(), and finish(). |
1.3.9.1