Public Member Functions | Static Public Member Functions | Protected Member Functions
EMAN::FourierProcessor Class Reference

base class for Fourier filters More...

#include <processor.h>

Inheritance diagram for EMAN::FourierProcessor:
Inheritance graph
Collaboration diagram for EMAN::FourierProcessor:
Collaboration graph

List of all members.

Public Member Functions

void process_inplace (EMData *image)
 To process an image in-place.
TypeDict get_param_types () const
 Get processor parameter information in a dictionary.

Static Public Member Functions

static string get_group_desc ()
 Get the description of this group of processors.

Protected Member Functions

virtual void preprocess (EMData *image)
virtual void create_radial_func (vector< float > &radial_mask) const =0

Detailed Description

base class for Fourier filters

cutoff_absProcessor radius in terms of Nyquist (0-.5).
cutoff_pixelsWidth in Fourier pixels (0 - size()/2).
cutoff_freqResolution in 1/A (0 - 1 / size*apix).
apixOverride A/pix in the image header (changes x,y and z).

Definition at line 336 of file processor.h.

Member Function Documentation

virtual void EMAN::FourierProcessor::create_radial_func ( vector< float > &  radial_mask) const [protected, pure virtual]
static string EMAN::FourierProcessor::get_group_desc ( ) [inline, static]

Get the description of this group of processors.

This function is defined in a parent class. It gives a introduction to a group of processors.

The description of this group of processors.

Reimplemented from EMAN::Processor.

Definition at line 341 of file processor.h.

                        return "Fourier Filter processors are a group of processor in the frequency domain. Before using such processors on an image, the image must be transformed from real space to the fourier space. FourierProcessor class is the base class of fourier space processors. Each specific processor is either a lowpass filter processor, or a highpass filter processor, or neighter. The unit of lowpass and highpass parameters are in terms of Nyquist, valid range is [0,0.5]. ";
TypeDict EMAN::FourierProcessor::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.

A dictionary containing the parameter info.

Reimplemented from EMAN::Processor.

Reimplemented in EMAN::LinearRampProcessor, EMAN::LoGFourierProcessor, and EMAN::DoGFourierProcessor.

Definition at line 346 of file processor.h.

References EMAN::EMObject::BOOL, EMAN::EMObject::FLOAT, and EMAN::TypeDict::put().

                        TypeDict d;
                        d.put("cutoff_abs", EMObject::FLOAT, "Processor radius in terms of Nyquist (0-.5)");
                        d.put("cutoff_pixels", EMObject::FLOAT, " Width in Fourier pixels (0 - size()/2)");
                        d.put("cutoff_freq", EMObject::FLOAT, "1/Resolution in 1/A (0 - 1 / 2*apix). eg - a 20 A filter is cutoff_freq=0.05");
                        d.put("apix", EMObject::FLOAT, " Override A/pix in the image header (changes x,y and z)");
                        d.put("return_radial", EMObject::BOOL, "Return the radial filter function as an attribute (filter_curve)");
                        return d;
virtual void EMAN::FourierProcessor::preprocess ( EMData image) [inline, protected, virtual]

Definition at line 358 of file processor.h.

References EMAN::EMData::get_attr_dict(), EMAN::Dict::has_key(), EMAN::Processor::params, and EMAN::EMData::set_attr().

Referenced by EMAN::LowpassRandomPhaseProcessor::process_inplace(), and process_inplace().

                        if(params.has_key("apix")) {
                                image->set_attr("apix_x", (float)params["apix"]);
                                image->set_attr("apix_y", (float)params["apix"]);
                                image->set_attr("apix_z", (float)params["apix"]);

                        const Dict dict = image->get_attr_dict();
                        if( params.has_key("sigma")) {
                                params["cutoff_abs"] = (float)params["sigma"];
                        else if( params.has_key("cutoff_abs") ) {
                                params["sigma"] = (float)params["cutoff_abs"];
                        else if( params.has_key("cutoff_freq") ) {
                                float val =  (float)params["cutoff_freq"] * (float)dict["apix_x"];
                                params["cutoff_abs"] = val;
                                params["sigma"] = val;
                        else if( params.has_key("cutoff_pixels") ) {
                                float val = (0.5f*(float)params["cutoff_pixels"] / (float)dict["nx"]);
                                params["cutoff_abs"] = val;
                                params["sigma"] = val;

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

imageThe image to be processed.

Implements EMAN::Processor.

Reimplemented in EMAN::LowpassRandomPhaseProcessor.

Definition at line 570 of file processor.cpp.

References EMAN::EMData::apply_radial_func(), create_radial_func(), EMAN::EMData::do_fft(), EMAN::EMData::do_ift(), FFTRADIALOVERSAMPLE, EMAN::EMData::get_data(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), EMAN::EMData::is_complex(), LOGWARN, EMAN::Processor::params, preprocess(), EMAN::EMData::set_attr(), EMAN::Dict::set_default(), and EMAN::EMData::update().

        if (!image) {
                LOGWARN("NULL Image");


        int array_size = FFTRADIALOVERSAMPLE * image->get_ysize();
        float step=0.5f/array_size;

        bool return_radial=(bool)params.set_default("return_radial",0);
        vector < float >yarray(array_size);


        if (image->is_complex()) {
                image->apply_radial_func(0, step, yarray);
        else {
                EMData *fft = image->do_fft();
                fft->apply_radial_func(0, step, yarray);
                EMData *ift = fft->do_ift();


                //ift->update(); Unecessary

                if( fft )
                        delete fft;
                        fft = 0;

                if( ift )
                        delete ift;
                        ift = 0;
        if (return_radial) image->set_attr("filter_curve",yarray);


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