Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::FourierProcessor Class Reference

base class for Fourier filters More...

#include <processor.h>

Inheritance diagram for EMAN::FourierProcessor:

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

Collaboration graph
[legend]
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

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

Parameters:
cutoff_abs Processor radius in terms of Nyquist (0-.5).
cutoff_pixels Width in Fourier pixels (0 - size()/2).
cutoff_freq Resolution in 1/A (0 - 1 / size*apix).
apix Override 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]
 

Implemented in EMAN::LinearRampFourierProcessor, EMAN::LowpassRandomPhaseProcessor, EMAN::LinearRampProcessor, EMAN::LoGFourierProcessor, and EMAN::DoGFourierProcessor.

Referenced by process_inplace().

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.

Returns:
The description of this group of processors.

Reimplemented from EMAN::Processor.

Definition at line 341 of file processor.h.

00342                 {
00343                         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]. ";
00344                 }

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.

Returns:
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::TypeDict::put().

00347                 {
00348                         TypeDict d;
00349                         d.put("cutoff_abs", EMObject::FLOAT, "Processor radius in terms of Nyquist (0-.5)");
00350                         d.put("cutoff_pixels", EMObject::FLOAT, " Width in Fourier pixels (0 - size()/2)");
00351                         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");
00352                         d.put("apix", EMObject::FLOAT, " Override A/pix in the image header (changes x,y and z)");
00353                         return d;
00354                 }

virtual void EMAN::FourierProcessor::preprocess EMData image  )  [inline, protected, virtual]
 

Definition at line 357 of file processor.h.

References EMAN::EMData::get_attr_dict(), and EMAN::EMData::set_attr().

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

00357                                                          {
00358                         if(params.has_key("apix")) {
00359                                 image->set_attr("apix_x", (float)params["apix"]);
00360                                 image->set_attr("apix_y", (float)params["apix"]);
00361                                 image->set_attr("apix_z", (float)params["apix"]);
00362                         }
00363 
00364                         const Dict dict = image->get_attr_dict();
00365                         if( params.has_key("sigma")) {
00366                                 params["cutoff_abs"] = (float)params["sigma"];
00367                         }
00368                         else if( params.has_key("cutoff_abs") ) {
00369                                 params["sigma"] = (float)params["cutoff_abs"];
00370                         }
00371                         else if( params.has_key("cutoff_freq") ) {
00372                                 float val =  (float)params["cutoff_freq"] * (float)dict["apix_x"];
00373                                 params["cutoff_abs"] = val;
00374                                 params["sigma"] = val;
00375                         }
00376                         else if( params.has_key("cutoff_pixels") ) {
00377                                 float val = (0.5f*(float)params["cutoff_pixels"] / (float)dict["nx"]);
00378                                 params["cutoff_abs"] = val;
00379                                 params["sigma"] = val;
00380                         }
00381 
00382                         }

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.

Parameters:
image The image to be processed.

Implements EMAN::Processor.

Reimplemented in EMAN::LowpassRandomPhaseProcessor.

Definition at line 546 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, preprocess(), and EMAN::EMData::update().

00547 {
00548         if (!image) {
00549                 LOGWARN("NULL Image");
00550                 return;
00551         }
00552 
00553         preprocess(image);
00554 
00555         int array_size = FFTRADIALOVERSAMPLE * image->get_ysize();
00556         float step=0.5f/array_size;
00557 
00558         vector < float >yarray(array_size);
00559 
00560         create_radial_func(yarray);
00561 
00562         if (image->is_complex()) {
00563                 image->apply_radial_func(0, step, yarray);
00564         }
00565         else {
00566                 EMData *fft = image->do_fft();
00567                 fft->apply_radial_func(0, step, yarray);
00568                 EMData *ift = fft->do_ift();
00569 
00570                 memcpy(image->get_data(),ift->get_data(),ift->get_xsize()*ift->get_ysize()*ift->get_zsize()*sizeof(float));
00571 
00572                 //ift->update(); Unecessary
00573 
00574                 if( fft )
00575                 {
00576                         delete fft;
00577                         fft = 0;
00578                 }
00579 
00580                 if( ift )
00581                 {
00582                         delete ift;
00583                         ift = 0;
00584                 }
00585         }
00586 
00587         image->update();
00588 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 11 13:42:10 2013 for EMAN2 by  doxygen 1.3.9.1