EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
EMAN::SNRProcessor Class Reference

Processor the images by the estimated SNR in each image.if parameter 'wiener' is 1, then wiener processor the images using the estimated SNR with CTF amplitude correction. More...

#include <processor.h>

Inheritance diagram for EMAN::SNRProcessor:
Inheritance graph
[legend]
Collaboration diagram for EMAN::SNRProcessor:
Collaboration graph
[legend]

Public Member Functions

virtual void process_inplace (EMData *image)
 To process an image in-place. More...
 
virtual string get_name () const
 Get the processor's name. More...
 
virtual string get_desc () const
 Get the descrition of this specific processor. More...
 
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 
- Public Member Functions inherited from EMAN::Processor
virtual ~Processor ()
 
virtual EMDataprocess (const EMData *const image)
 To proccess an image out-of-place. More...
 
virtual void process_list_inplace (vector< EMData * > &images)
 To process multiple images using the same algorithm. More...
 
virtual Dict get_params () const
 Get the processor parameters in a key/value dictionary. More...
 
virtual void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary. More...
 

Static Public Member Functions

static ProcessorNEW ()
 
- Static Public Member Functions inherited from EMAN::Processor
static string get_group_desc ()
 Get the description of this group of processors. More...
 
static void EMFourierFilterInPlace (EMData *fimage, Dict params)
 Compute a Fourier-filter processed image in place. More...
 
static EMDataEMFourierFilter (EMData *fimage, Dict params)
 Compute a Fourier-processor processed image without altering the original image. More...
 

Static Public Attributes

static const string NAME = "eman1.filter.snr"
 

Additional Inherited Members

- Public Types inherited from EMAN::Processor
enum  fourier_filter_types {
  TOP_HAT_LOW_PASS , TOP_HAT_HIGH_PASS , TOP_HAT_BAND_PASS , TOP_HOMOMORPHIC ,
  GAUSS_LOW_PASS , GAUSS_HIGH_PASS , GAUSS_BAND_PASS , GAUSS_INVERSE ,
  GAUSS_HOMOMORPHIC , BUTTERWORTH_LOW_PASS , BUTTERWORTH_HIGH_PASS , BUTTERWORTH_HOMOMORPHIC ,
  KAISER_I0 , KAISER_SINH , KAISER_I0_INVERSE , KAISER_SINH_INVERSE ,
  SHIFT , TANH_LOW_PASS , TANH_HIGH_PASS , TANH_HOMOMORPHIC ,
  TANH_BAND_PASS , RADIAL_TABLE , CTF_
}
 Fourier filter Processor type enum. More...
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

Detailed Description

Processor the images by the estimated SNR in each image.if parameter 'wiener' is 1, then wiener processor the images using the estimated SNR with CTF amplitude correction.

Parameters
wienerif set to 1, then use wiener processor to process the images using the estimated SNR with CTF amplitude correction
snrfilestructure factor file name

Definition at line 7285 of file processor.h.

Member Function Documentation

◆ get_desc()

virtual string EMAN::SNRProcessor::get_desc ( ) const
inlinevirtual

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

Returns
The description of this processor.

Implements EMAN::Processor.

Definition at line 7300 of file processor.h.

7301 {
7302 return "Process the images by the estimated SNR in each image.if parameter 'wiener' is 1, then wiener processor the images using the estimated SNR with CTF amplitude correction.";
7303 }

◆ get_name()

virtual string EMAN::SNRProcessor::get_name ( ) const
inlinevirtual

Get the processor's name.

Each processor is identified by a unique name.

Returns
The processor's name.

Implements EMAN::Processor.

Definition at line 7290 of file processor.h.

7291 {
7292 return NAME;
7293 }
static const string NAME
Definition: processor.h:7313

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::SNRProcessor::get_param_types ( ) const
inlinevirtual

Get processor parameter information in a dictionary.

Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.

Returns
A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Definition at line 7305 of file processor.h.

7306 {
7307 TypeDict d;
7308 d.put("wiener", EMObject::INT, "if set to 1, then use wiener processor to process the images using the estimated SNR with CTF amplitude correction");
7309 d.put("snrfile", EMObject::STRING, "structure factor file name");
7310 return d;
7311 }
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair.
Definition: emobject.h:305
void put(const string &key, EMObject::ObjectType o, const string &desc="")
Definition: emobject.h:330

References EMAN::EMObject::INT, EMAN::TypeDict::put(), and EMAN::EMObject::STRING.

◆ NEW()

static Processor * EMAN::SNRProcessor::NEW ( )
inlinestatic

Definition at line 7295 of file processor.h.

7296 {
7297 return new SNRProcessor();
7298 }
Processor the images by the estimated SNR in each image.if parameter 'wiener' is 1,...
Definition: processor.h:7286

◆ process_inplace()

void SNRProcessor::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.

Parameters
imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 7627 of file processor.cpp.

7628{
7629 if (!image) {
7630 return;
7631 }
7632
7633 int wiener = params["wiener"];
7634 const char *snrfile = params["snrfile"];
7635
7636 XYData sf;
7637 int err = sf.read_file(snrfile);
7638 if (err) {
7639 LOGERR("couldn't read structure factor file!");
7640 return;
7641 }
7642
7643
7644 for (size_t i = 0; i < sf.get_size(); i++) {
7645 if (sf.get_y(i) <= 0) {
7646 sf.set_y(i, -4.0f);
7647 }
7648 else {
7649 sf.set_y(i, log10(sf.get_y(i)));
7650 }
7651 }
7652 sf.update();
7653
7654 Ctf *image_ctf = image->get_ctf();
7655
7656 vector < float >ctf;
7657 if (wiener) {
7658 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_WIENER_FILTER, &sf);
7659 }
7660 else {
7661 ctf = image_ctf->compute_1d(image->get_ysize(),1.0f/(image_ctf->apix*image->get_ysize()), Ctf::CTF_SNR, &sf);
7662 }
7663
7664 if(image_ctf) {delete image_ctf; image_ctf=0;}
7665
7666 image->process_inplace("normalize.circlemean");
7667
7668 int nx = image->get_xsize();
7669 int ny = image->get_ysize();
7670
7671 Region clip_r(-nx / 2, -ny / 2, nx * 2, ny * 2);
7672 EMData *d3 = image->get_clip(clip_r);
7673 EMData *d2 = d3->do_fft();
7674
7675// d2->apply_radial_func(0, 2.0f / Ctf::CTFOS, ctf, 0); // this is troubling! only EMAN1 CTF used CTFOS, and then, not correctly...
7676 d2->apply_radial_func(0, 2.0f, ctf, 0);
7677
7678 if( d3 )
7679 {
7680 delete d3;
7681 d3 = 0;
7682 }
7683
7684 if( image )
7685 {
7686 delete image;
7687 image = 0;
7688 }
7689
7690 EMData *d1 = d2->do_ift();
7691 int d1_nx = d1->get_xsize();
7692 int d1_ny = d1->get_ysize();
7693 Region d1_r(d1_nx / 4, d1_ny / 4, d1_nx / 2, d1_ny / 2);
7694
7695 image = d1->get_clip(d1_r);
7696
7697 if( d1 )
7698 {
7699 delete d1;
7700 d1 = 0;
7701 }
7702
7703 if( d2 )
7704 {
7705 delete d2;
7706 d2 = 0;
7707 }
7708}
Ctf is the base class for all CTF model.
Definition: ctf.h:60
float apix
Definition: ctf.h:88
virtual vector< float > compute_1d(int size, float ds, CtfType t, XYData *struct_factor=0)=0
@ CTF_WIENER_FILTER
Definition: ctf.h:70
@ CTF_SNR
Definition: ctf.h:68
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
EMData * get_clip(const Region &area, const float fill=0) const
Get an inclusive clip.
Definition: emdata.cpp:592
void apply_radial_func(float x0, float dx, vector< float >array, bool interp=true)
multiplies by a radial function in fourier space.
Definition: emdata.cpp:2677
Region defines a 2D or 3D rectangular region specified by its origin coordinates and all edges' sizes...
Definition: geometry.h:497
XYData defines a 1D (x,y) data set.
Definition: xydata.h:47
void update()
Definition: xydata.cpp:53
size_t get_size() const
Definition: xydata.h:127
float get_y(size_t i) const
Definition: xydata.h:95
void set_y(size_t i, float y)
Definition: xydata.h:101
int read_file(const string &filename)
Definition: xydata.cpp:77
EMData * log10() const
return base 10 logarithm image for a image
#define LOGERR
Definition: log.h:51

References EMAN::Ctf::apix, EMAN::EMData::apply_radial_func(), EMAN::Ctf::compute_1d(), EMAN::Ctf::CTF_SNR, EMAN::Ctf::CTF_WIENER_FILTER, EMAN::EMData::get_clip(), EMAN::XYData::get_size(), EMAN::XYData::get_y(), log10(), LOGERR, EMAN::Processor::params, EMAN::XYData::read_file(), EMAN::XYData::set_y(), and EMAN::XYData::update().

Member Data Documentation

◆ NAME

const string SNRProcessor::NAME = "eman1.filter.snr"
static

Definition at line 7313 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files: