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

Wiener filter based on a Ctf object either in the image header. More...

#include <processor.h>

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

Public Member Functions

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

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.wiener2d"
 

Protected Attributes

Ctfctf
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

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...
 

Detailed Description

Wiener filter based on a Ctf object either in the image header.

Parameters
ctf[in]A Ctf object to use
Author
Steve Ludtke
Date
2008/11/03

Definition at line 1855 of file processor.h.

Member Function Documentation

◆ get_desc()

string EMAN::Wiener2DFourierProcessor::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 1886 of file processor.h.

1887 {
1888 return "Applies a 2-D Wiener filter to an image based on its Ctf parameters";
1889 }

◆ get_name()

string EMAN::Wiener2DFourierProcessor::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 1858 of file processor.h.

1859 {
1860 return NAME;
1861 }
static const string NAME
Definition: processor.h:1891

References NAME.

◆ get_param_types()

TypeDict EMAN::Wiener2DFourierProcessor::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 1874 of file processor.h.

1875 {
1876 TypeDict d;
1877 d.put("ctf", EMObject::EMDATA, "Ctf object to use for Wiener filter parameters");
1878 return d;
1879 }
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::EMDATA, and EMAN::TypeDict::put().

◆ NEW()

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

Definition at line 1881 of file processor.h.

1882 {
1883 return new Wiener2DFourierProcessor();
1884 }
Wiener filter based on a Ctf object either in the image header.
Definition: processor.h:1856

◆ process()

EMData * Wiener2DFourierProcessor::process ( const EMData *const  image)
virtual

To proccess an image out-of-place.

For those processors which can only be processed out-of-place, override this function to give the right behavior.

Parameters
imageThe image will be copied, actual process happen on copy of image.
Returns
the image processing result, may or may not be the same size of the input image

Reimplemented from EMAN::Processor.

Definition at line 1991 of file processor.cpp.

1992{
1993 const EMData *in2 = 0;
1994 if (in->is_complex()) in2=in;
1995 else in=in->do_fft();
1996
1997 EMData *filt = in->copy_head();
1998 Ctf *ictf = ctf;
1999
2000 if (!ictf) ctf=(Ctf *)in->get_attr("ctf");
2001
2003 filt->mult(*in2);
2004 EMData *ret=filt->do_ift();
2005
2006 delete filt;
2007 if (!in->is_complex()) delete in2;
2008
2009 if(!ictf && ctf) {delete ctf; ctf=0;}
2010 return(ret);
2011/* const EMData *fft;
2012 float *fftd;
2013 int f=0;
2014
2015 if (!image) {
2016 LOGWARN("NULL Image");
2017 return ret;
2018 }
2019
2020 if (!image->is_complex()) {
2021 fft = image->do_fft();
2022 fftd = fft->get_data();
2023 f=1;
2024 }
2025 else {
2026 fft=image;
2027 fftd=image->get_data();
2028 }
2029 powd=image->get_data();
2030
2031 int bad=0;
2032 for (int i=0; i<image->get_xsize()*image->get_ysize(); i+=2) {
2033 snr=(fftd[i]*fftd[i]+fftd[i+1]*fftd[i+1]-powd[i])/powd[i];
2034 if (snr<0) { bad++; snr=0; }
2035
2036 }
2037
2038 print("%d bad pixels\n",snr);
2039*/ return ret;
2040
2041}
Ctf is the base class for all CTF model.
Definition: ctf.h:60
virtual void compute_2d_complex(EMData *img, CtfType t, XYData *struct_factor=0)=0
@ CTF_WIENER_FILTER
Definition: ctf.h:70
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82

References EMAN::Ctf::compute_2d_complex(), ctf, and EMAN::Ctf::CTF_WIENER_FILTER.

Referenced by process_inplace().

◆ process_inplace()

void Wiener2DFourierProcessor::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 2043 of file processor.cpp.

2043 {
2044 EMData *tmp=process(image);
2045 memcpy(image->get_data(),tmp->get_data(),image->get_xsize()*image->get_ysize()*image->get_zsize()*sizeof(float));
2046 delete tmp;
2047 image->update();
2048 return;
2049}
virtual EMData * process(const EMData *const image)
To proccess an image out-of-place.
Definition: processor.cpp:1991

References process().

◆ set_params()

void EMAN::Wiener2DFourierProcessor::set_params ( const Dict new_params)
inlinevirtual

Set the processor parameters using a key/value dictionary.

Parameters
new_paramsA dictionary containing the new parameters.

Reimplemented from EMAN::Processor.

Definition at line 1867 of file processor.h.

1868 {
1869 params = new_params;
1870 ctf = params["ctf"];
1871// printf("%s %f\n",params.keys()[0].c_str(),lowpass);
1872 }

References ctf, and EMAN::Processor::params.

Member Data Documentation

◆ ctf

Ctf* EMAN::Wiener2DFourierProcessor::ctf
protected

Definition at line 1894 of file processor.h.

Referenced by process(), and set_params().

◆ NAME

const string Wiener2DFourierProcessor::NAME = "filter.wiener2d"
static

Definition at line 1891 of file processor.h.

Referenced by get_name().


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