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

EMAN::BinarizeFourierProcessor Class Reference

A thresholding processor for Fourier images based on the amplitude component. More...

#include <processor.h>

Inheritance diagram for EMAN::BinarizeFourierProcessor:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual string get_name () const
 Get the processor's name.
virtual void process_inplace (EMData *image)
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary.
virtual string get_desc () const
 Get the descrition of this specific processor.

Static Public Member Functions

ProcessorNEW ()

Static Public Attributes

const string NAME = "threshold.binary.fourier"

Detailed Description

A thresholding processor for Fourier images based on the amplitude component.

All maps set below value are set to zero Useful in tomography when you want to toss complex components with low amplitides

Author:
John Flanagan
Date:
Oct 25th 2010
Parameters:
value The Fourier amplitude threshold cutoff

Definition at line 1736 of file processor.h.


Member Function Documentation

virtual string EMAN::BinarizeFourierProcessor::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 1761 of file processor.h.

01762                         {
01763                                 return "f(k) = 0 + 0i if ||f(k)|| < value; f(k) = a + bi if ||f(k)|| >= value.";
01764                         }

virtual string EMAN::BinarizeFourierProcessor::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 1739 of file processor.h.

01740                         {
01741                                 return NAME;
01742                         }

virtual TypeDict EMAN::BinarizeFourierProcessor::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 1754 of file processor.h.

References EMAN::TypeDict::put().

01755                         {
01756                                 TypeDict d;
01757                                 d.put("value", EMObject::FLOAT, "The Fourier amplitude threshold cutoff" );
01758                                 return d;
01759                         }

Processor* EMAN::BinarizeFourierProcessor::NEW  )  [inline, static]
 

Definition at line 1743 of file processor.h.

01744                         {
01745                                 return new BinarizeFourierProcessor();
01746                         }

void BinarizeFourierProcessor::process_inplace EMData image  )  [virtual]
 

Exceptions:
ImageFormatException if the input image is not complex Note result is always in real-imaginary format

Implements EMAN::Processor.

Definition at line 3817 of file processor.cpp.

References EMAN::EMData::ap2ri(), EMAN::EMData::get_data(), EMAN::EMData::get_size(), ImageFormatException, EMAN::EMData::is_complex(), EMAN::EMData::ri2ap(), EMAN::Dict::set_default(), EMAN::EMData::set_ri(), and EMAN::EMData::update().

03817                                                             {
03818         ENTERFUNC;
03819         if (!image->is_complex()) throw ImageFormatException("Fourier binary thresholding processor only works for complex images");
03820 
03821         float threshold = params.set_default("value",0.0f);
03822         image->ri2ap(); //  works for cuda
03823 
03824 // This is rubbish!!! Needs fixing as does not do the same thing as below....
03825 //#ifdef EMAN2_USING_CUDA
03826 //      if (image->gpu_operation_preferred()) {
03827 //              EMDataForCuda tmp = image->get_data_struct_for_cuda();
03828 //              binarize_fourier_amp_processor(&tmp,threshold);
03829 //              image->set_ri(true); // So it can be used for fourier multiplaction, for example
03830 //              image->gpu_update();
03831 //              EXITFUNC;
03832 //              return;
03833 //      }
03834 //#endif
03835         //compete rubbish!! doesn't work I need to fix this....
03836         float* d = image->get_data();
03837         for( size_t i = 0; i < image->get_size()/2; ++i, d+=2) {
03838                 //float v = *d;
03839                 if ( *d < threshold ) {
03840                         *d = 0;
03841                         *(d+1) = 0;
03842                 } 
03843         }
03844 
03845         image->ap2ri();
03846         image->set_ri(true); // So it can be used for fourier multiplaction, for example
03847         image->update();
03848         EXITFUNC;
03849 }


Member Data Documentation

const string BinarizeFourierProcessor::NAME = "threshold.binary.fourier" [static]
 

Definition at line 94 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Mon Mar 7 18:17:25 2011 for EMAN2 by  doxygen 1.3.9.1