EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
EMAN::CTFCorrProcessor 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::CTFCorrProcessor:
Inheritance graph
[legend]
Collaboration diagram for EMAN::CTFCorrProcessor:
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 = "filter.ctfcorr.simple"
 

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
defocusmean defocus in microns
voltagemicroscope voltage in Kv
acamplitude contrast in %

Definition at line 7239 of file processor.h.

Member Function Documentation

◆ get_desc()

virtual string EMAN::CTFCorrProcessor::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 7254 of file processor.h.

7255 {
7256 return "One of the strongest visual impacts of CTF on a structure is the low resolution high-pass filter effect caused by \
7257phase contrast. This Processor performs a simple linear filter to roughly correct for this. This is not a substitution or replacement \
7258for the full CTF correction routine available for single particle work in EMAN, but if you are in a situation where accurate CTF \
7259correction is not possible, this will allow you to approximate the correction to relieve some of the visual artifacts. Circularly \
7260symmetric phase flipping can optionally be performed.";
7261 }

◆ get_name()

virtual string EMAN::CTFCorrProcessor::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 7244 of file processor.h.

7245 {
7246 return NAME;
7247 }
static const string NAME
Definition: processor.h:7277

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::CTFCorrProcessor::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 7263 of file processor.h.

7264 {
7265 TypeDict d;
7266 d.put("defocus", EMObject::FLOAT, "Mean defocus to correct for in microns");
7267 d.put("ac", EMObject::FLOAT, "Amplitude contrast in % (default 10%)");
7268 d.put("cs", EMObject::FLOAT, "Microscope Cs, default 2.7 mm");
7269 d.put("voltage", EMObject::FLOAT, "Microscope Voltage in Kv (default 300)");
7270 d.put("apix", EMObject::FLOAT, "A/pix (default value from image header)");
7271 d.put("hppix", EMObject::FLOAT, "Optional high pass filter radius in pixels to prevent gradient amplification, default disabled");
7272 d.put("phaseflip", EMObject::INT, "Also flip phases if set, default false");
7273 d.put("useheader", EMObject::INT,"Use CTF header values if present, instead of individual values, default false");
7274 return d;
7275 }
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::FLOAT, EMAN::EMObject::INT, and EMAN::TypeDict::put().

◆ NEW()

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

Definition at line 7249 of file processor.h.

7250 {
7251 return new CTFCorrProcessor();
7252 }
Processor the images by the estimated SNR in each image.if parameter 'wiener' is 1,...
Definition: processor.h:7240

◆ process_inplace()

void CTFCorrProcessor::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 7710 of file processor.cpp.

7711{
7712 if (!image) {
7713 return;
7714 }
7715
7716 float defocus = params.set_default("defocus",3.0);
7717 float ac = params.set_default("ac",10.0);
7718 float cs = params.set_default("cs",2.7);
7719 float voltage = params.set_default("voltage",300.0);
7720 float apix = params.set_default("apix",image->get_attr("apix_x"));
7721 float hppix = params.set_default("hppix",-1.0f);
7722 int useheader = params.set_default("useheader",0);
7723 int phaseflip = params.set_default("phaseflip",0);
7724
7725 int ny = image->get_ysize();
7726 EMAN2Ctf ctf;
7727 if (image->has_attr("ctf") && useheader){
7728
7729 ctf.copy_from((Ctf *)(image->get_attr("ctf")));
7730// printf("CTF %f\t%f\t%f\t%f\n",ctf.defocus,ctf.ampcont,ctf.voltage,ctf.apix);
7731 }
7732 else {
7733 ctf.defocus=defocus;
7734 ctf.voltage=voltage;
7735 ctf.cs=cs;
7736
7737 ctf.ampcont=ac;
7738 ctf.dfdiff=0;
7739 ctf.bfactor=200.0;
7740 }
7741 ctf.apix=apix;
7742 ctf.dsbg=1.0/(ctf.apix*ny);
7743
7744 int np=(int)ceil(ny*1.73)+1;
7745 vector <float> filter = ctf.compute_1d(np,ctf.dsbg,Ctf::CTF_AMP);
7746
7747 // reciprocal until the first CTF maximum, then no filter after that
7748 int i;
7749 filter[0]=1.0;
7750 for (i=1; i<np/2-1; i++) {
7751 if (filter[i+1]<filter[i]) {
7752 filter[i]=1.0/filter[i];
7753 break;
7754 }
7755 filter[i]=1.0/filter[i];
7756 }
7757 int gi=i;
7758 while (i<np/2) {
7759 if (phaseflip) filter[i]=filter[gi]*(filter[i]<0?-1.0f:1.0f);
7760 else filter[i]=filter[gi];
7761 i++;
7762 }
7763
7764 if (hppix>0) {
7765 for (int i=0; i<(int)hppix*3.0; i++) filter[i]*=tanh((float)i/hppix);
7766 }
7767
7768// for (i=0; i<np/2; i++) printf("%d\t%1.3g\n",i,filter[i]);
7769 image->process_inplace("filter.radialtable",Dict("table",filter));
7770
7771}
Ctf is the base class for all CTF model.
Definition: ctf.h:60
float cs
Definition: ctf.h:87
float bfactor
Definition: ctf.h:85
float voltage
Definition: ctf.h:86
float apix
Definition: ctf.h:88
float defocus
Definition: ctf.h:84
@ CTF_AMP
Definition: ctf.h:65
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
Definition: emobject.h:569
EMAN2Ctf is the default CTF model used in EMAN2.
Definition: ctf.h:237
float dfdiff
Definition: ctf.h:240
vector< float > compute_1d(int size, float ds, CtfType type, XYData *struct_factor=0)
Definition: ctf.cpp:731
void copy_from(const Ctf *new_ctf)
Definition: ctf.cpp:653
float ampcont
Definition: ctf.h:243
float dsbg
Definition: ctf.h:247

References EMAN::EMAN2Ctf::ampcont, EMAN::Ctf::apix, EMAN::Ctf::bfactor, EMAN::EMAN2Ctf::compute_1d(), EMAN::EMAN2Ctf::copy_from(), EMAN::Ctf::cs, EMAN::Ctf::CTF_AMP, EMAN::Ctf::defocus, EMAN::EMAN2Ctf::dfdiff, EMAN::EMAN2Ctf::dsbg, EMAN::Processor::params, EMAN::Dict::set_default(), and EMAN::Ctf::voltage.

Member Data Documentation

◆ NAME

const string CTFCorrProcessor::NAME = "filter.ctfcorr.simple"
static

Definition at line 7277 of file processor.h.

Referenced by get_name().


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