EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes
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]

List of all members.

Public Member Functions

string get_name () const
 Get the processor's name.
virtual EMDataprocess (const EMData *const image)
 To proccess an image out-of-place.
void process_inplace (EMData *image)
 To process an image in-place.
void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary.
TypeDict get_param_types () const
 Get processor parameter information in a dictionary.
string get_desc () const
 Get the descrition of this specific processor.

Static Public Member Functions

static ProcessorNEW ()

Static Public Attributes

static const string NAME = "filter.wiener2d"

Protected Attributes

Ctfctf

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 896 of file processor.h.


Member Function Documentation

string EMAN::Wiener2DFourierProcessor::get_desc ( ) const [inline, virtual]

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 927 of file processor.h.

                {
                        return "Applies a 2-D Wiener filter to an image based on its Ctf parameters";
                }
string EMAN::Wiener2DFourierProcessor::get_name ( ) const [inline, virtual]

Get the processor's name.

Each processor is identified by a unique name.

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 899 of file processor.h.

References NAME.

                {
                        return NAME;
                }
TypeDict EMAN::Wiener2DFourierProcessor::get_param_types ( ) const [inline, virtual]

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 915 of file processor.h.

References EMAN::EMObject::EMDATA, and EMAN::TypeDict::put().

                {
                        TypeDict d;
                        d.put("ctf", EMObject::EMDATA, "Ctf object to use for Wiener filter parameters");
                        return d;
                }
static Processor* EMAN::Wiener2DFourierProcessor::NEW ( ) [inline, static]

Definition at line 922 of file processor.h.

                {
                        return new Wiener2DFourierProcessor();
                }
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 1245 of file processor.cpp.

References EMAN::Ctf::compute_2d_complex(), EMAN::EMData::copy_head(), ctf, EMAN::Ctf::CTF_WIENER_FILTER, EMAN::EMData::do_fft(), EMAN::EMData::do_ift(), EMAN::EMData::get_attr(), EMAN::EMData::is_complex(), and EMAN::EMData::mult().

Referenced by process_inplace().

{
        const EMData *in2 = 0;
        if (in->is_complex()) in2=in;
        else in=in->do_fft();

        EMData *filt = in->copy_head();
        Ctf *ictf = ctf;

        if (!ictf) ctf=(Ctf *)in->get_attr("ctf");

        ictf->compute_2d_complex(filt,Ctf::CTF_WIENER_FILTER);
        filt->mult(*in2);
        EMData *ret=filt->do_ift();

        delete filt;
        if (!in->is_complex()) delete in2;

        if(!ictf && ctf) {delete ctf; ctf=0;}
        return(ret);
/*      const EMData *fft;
        float *fftd;
        int f=0;

        if (!image) {
                LOGWARN("NULL Image");
                return ret;
        }

        if (!image->is_complex()) {
                fft = image->do_fft();
                fftd = fft->get_data();
                f=1;
        }
        else {
                fft=image;
                fftd=image->get_data();
        }
        powd=image->get_data();

        int bad=0;
        for (int i=0; i<image->get_xsize()*image->get_ysize(); i+=2) {
                snr=(fftd[i]*fftd[i]+fftd[i+1]*fftd[i+1]-powd[i])/powd[i];
                if (snr<0) { bad++; snr=0; }

        }

        print("%d bad pixels\n",snr);
*/      return ret;

}
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 1297 of file processor.cpp.

References EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), process(), and EMAN::EMData::update().

                                                            {
        EMData *tmp=process(image);
        memcpy(image->get_data(),tmp->get_data(),image->get_xsize()*image->get_ysize()*image->get_zsize()*sizeof(float));
        delete tmp;
        image->update();
        return;
}
void EMAN::Wiener2DFourierProcessor::set_params ( const Dict new_params) [inline, virtual]

Set the processor parameters using a key/value dictionary.

Parameters:
new_paramsA dictionary containing the new parameters.

Reimplemented from EMAN::Processor.

Definition at line 908 of file processor.h.

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

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

Member Data Documentation

Definition at line 935 of file processor.h.

Referenced by process(), and set_params().

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

Definition at line 932 of file processor.h.

Referenced by get_name().


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