EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
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)
 
Exceptions:
ImageFormatExceptionif the input image is not complex Note result is always in real-imaginary format

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

static ProcessorNEW ()

Static Public Attributes

static 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:
valueThe Fourier amplitude threshold cutoff

Definition at line 2046 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 2071 of file processor.h.

                        {
                                return "f(k) = 0 + 0i if ||f(k)|| < value; f(k) = a + bi if ||f(k)|| >= value.";
                        }
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 2049 of file processor.h.

References NAME.

                        {
                                return NAME;
                        }
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 2064 of file processor.h.

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

                        {
                                TypeDict d;
                                d.put("value", EMObject::FLOAT, "The Fourier amplitude threshold cutoff" );
                                return d;
                        }
static Processor* EMAN::BinarizeFourierProcessor::NEW ( ) [inline, static]

Definition at line 2053 of file processor.h.

                        {
                                return new BinarizeFourierProcessor();
                        }
void BinarizeFourierProcessor::process_inplace ( EMData image) [virtual]

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

Implements EMAN::Processor.

Definition at line 4182 of file processor.cpp.

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

                                                            {
        ENTERFUNC;
        if (!image->is_complex()) throw ImageFormatException("Fourier binary thresholding processor only works for complex images");

        float threshold = params.set_default("value",0.0f);
        image->ri2ap(); //  works for cuda

        float* d = image->get_data();
        for( size_t i = 0; i < image->get_size()/2; ++i, d+=2) {
                if ( *d < threshold ) {
                        *d = 0;
                        *(d+1) = 0;
                }
        }
        image->ap2ri();
        image->set_ri(true); // So it can be used for fourier multiplaction, for example
        image->update();
        EXITFUNC;
}

Member Data Documentation

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

Definition at line 2076 of file processor.h.

Referenced by get_name().


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