EMAN2
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
EMAN::FourierProcessor Class Referenceabstract

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]

Public Member Functions

void process_inplace (EMData *image)
 To process an image in-place. More...
 
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 string get_name () const =0
 Get the processor's name. 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...
 
virtual string get_desc () const =0
 Get the descrition of this specific processor. More...
 

Static Public Member Functions

static string get_group_desc ()
 
- 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...
 

Protected Member Functions

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

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

base class for Fourier filters

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

Member Function Documentation

◆ create_radial_func()

virtual void EMAN::FourierProcessor::create_radial_func ( vector< float > &  radial_mask) const
protectedpure virtual

◆ get_group_desc()

static string EMAN::FourierProcessor::get_group_desc ( )
inlinestatic

Definition at line 337 of file processor.h.

338 {
339 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]. ";
340 }

◆ get_param_types()

TypeDict EMAN::FourierProcessor::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.

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

Definition at line 342 of file processor.h.

343 {
344 TypeDict d;
345 d.put("cutoff_abs", EMObject::FLOAT, "Processor radius in terms of Nyquist (0-.5)");
346 d.put("cutoff_pixels", EMObject::FLOAT, " Width in Fourier pixels (0 - size()/2)");
347 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");
348 d.put("apix", EMObject::FLOAT, " Override A/pix in the image header (changes x,y and z)");
349 d.put("return_radial", EMObject::BOOL, "Return the radial filter function as an attribute (filter_curve)");
350 return d;
351 }
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::BOOL, EMAN::EMObject::FLOAT, and EMAN::TypeDict::put().

◆ preprocess()

virtual void EMAN::FourierProcessor::preprocess ( EMData image)
inlineprotectedvirtual

Definition at line 354 of file processor.h.

354 {
355 if(params.has_key("apix")) {
356 image->set_attr("apix_x", (float)params["apix"]);
357 image->set_attr("apix_y", (float)params["apix"]);
358 image->set_attr("apix_z", (float)params["apix"]);
359 }
360
361 const Dict dict = image->get_attr_dict();
362 if( params.has_key("sigma")) {
363 params["cutoff_abs"] = (float)params["sigma"];
364 }
365 else if( params.has_key("cutoff_abs") ) {
366 params["sigma"] = (float)params["cutoff_abs"];
367 }
368 else if( params.has_key("cutoff_freq") ) {
369 float val = (float)params["cutoff_freq"] * (float)dict["apix_x"];
370 params["cutoff_abs"] = val;
371 params["sigma"] = val;
372 }
373 else if( params.has_key("cutoff_pixels") ) {
374 float val = ((float)params["cutoff_pixels"] / (float)dict["nx"]);
375 params["cutoff_abs"] = val;
376 params["sigma"] = val;
377 }
378
379 }
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
bool has_key(const string &key) const
Ask the Dictionary if it as a particular key.
Definition: emobject.h:511

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

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

◆ process_inplace()

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
imageThe image to be processed.

Implements EMAN::Processor.

Reimplemented in EMAN::LowpassRandomPhaseProcessor.

Definition at line 688 of file processor.cpp.

689{
690 if (!image) {
691 LOGWARN("NULL Image");
692 return;
693 }
694
695 preprocess(image);
696
697 int array_size = FFTRADIALOVERSAMPLE * image->get_ysize();
698 float step=0.5f/array_size;
699
700 bool return_radial=(bool)params.set_default("return_radial",0);
701 vector < float >yarray(array_size);
702
703 create_radial_func(yarray);
704
705 if (image->is_complex()) {
706 image->apply_radial_func(0, step, yarray);
707 }
708 else {
709 EMData *fft = image->do_fft();
710 fft->apply_radial_func(0, step, yarray);
711 EMData *ift = fft->do_ift();
712
713 memcpy(image->get_data(),ift->get_data(),ift->get_xsize()*ift->get_ysize()*ift->get_zsize()*sizeof(float));
714
715 //ift->update(); Unecessary
716
717 if( fft )
718 {
719 delete fft;
720 fft = 0;
721 }
722
723 if( ift )
724 {
725 delete ift;
726 ift = 0;
727 }
728 }
729 if (return_radial) image->set_attr("filter_curve",yarray);
730
731 image->update();
732}
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
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
void apply_radial_func(float x0, float dx, vector< float >array, bool interp=true)
multiplies by a radial function in fourier space.
Definition: emdata.cpp:2677
virtual void preprocess(EMData *image)
Definition: processor.h:354
virtual void create_radial_func(vector< float > &radial_mask) const =0
#define LOGWARN
Definition: log.h:53
#define FFTRADIALOVERSAMPLE
Definition: processor.cpp:687

References EMAN::EMData::apply_radial_func(), create_radial_func(), FFTRADIALOVERSAMPLE, LOGWARN, EMAN::Processor::params, preprocess(), and EMAN::Dict::set_default().


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