EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions
EMAN::MatchSFProcessor Class Reference

Sets the structure factor To match a second provided image/volume. More...

#include <processor.h>

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

List of all members.

Public Member Functions

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

Static Public Member Functions

static ProcessorNEW ()

Static Public Attributes

static const string NAME = "filter.matchto"

Protected Member Functions

void create_radial_func (vector< float > &radial_mask, EMData *image) const

Detailed Description

Sets the structure factor To match a second provided image/volume.

Parameters:
toEMData object to match to. Make sure apix values are set properly

Definition at line 6117 of file processor.h.


Member Function Documentation

void MatchSFProcessor::create_radial_func ( vector< float > &  radial_mask,
EMData image 
) const [protected, virtual]

Implements EMAN::FourierAnlProcessor.

Definition at line 6674 of file processor.cpp.

References EMAN::EMData::calc_radial_dist(), EMAN::EMData::do_fft(), EMAN::EMData::get_attr(), EMAN::XYData::get_yatx(), EMAN::EMData::get_ysize(), EMAN::EMData::is_complex(), EMAN::Processor::params, EMAN::XYData::set_x(), EMAN::XYData::set_y(), and sqrt().

                                                                                          {
        // The radial mask comes in with the existing radial image profile
        // The radial mask runs from 0 to the 1-D Nyquist (it leaves out the corners in Fourier space)

        EMData *to = params["to"];
        XYData *sf = new XYData();
        float apixto = to->get_attr("apix_x");


        if (to->is_complex()) {
                vector<float> rd=to->calc_radial_dist(to->get_ysize()/2.0f,0,1.0f,1);
                for (size_t i=0; i<rd.size(); ++i) {
                        sf->set_x(i,i/(apixto*2.0f*rd.size()));
                        sf->set_y(i,rd[i]);
                }
        }
        else {
                EMData *tmp=to->do_fft();
                vector<float> rd=tmp->calc_radial_dist(to->get_ysize()/2,0,1.0,1);
                for (size_t i=0; i<rd.size(); ++i) {
                        sf->set_x(i,i/(apixto*2.0f*rd.size()));
                        sf->set_y(i,rd[i]);
                }
                delete tmp;
        }

        float apix=image->get_attr("apix_x");

//      sf->write_file("a.txt");
//      Util::save_data(0,sf->get_x(1),radial_mask,"b.txt");

        int n = radial_mask.size();
        for (int i=0; i<n; i++) {
                if (radial_mask[i]>0) radial_mask[i]= sqrt(sf->get_yatx(i/(apix*2.0f*n),false)/radial_mask[i]);
                else if (i>0) radial_mask[i]=radial_mask[i-1];
        }

//      Util::save_data(0,sf->get_x(1),radial_mask,"c.txt");

        delete sf;
}
virtual string EMAN::MatchSFProcessor::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 6126 of file processor.h.

                {
                        return "Filters the image so its 1-D power spectrum matches a second image";
                }
virtual string EMAN::MatchSFProcessor::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 6121 of file processor.h.

References NAME.

                {
                        return NAME;
                }
virtual TypeDict EMAN::MatchSFProcessor::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::FourierAnlProcessor.

Definition at line 6136 of file processor.h.

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

                {
                        TypeDict d;
                        d.put("to", EMObject::EMDATA, "The image to match with. Make sure apix values are correct.");
                        d.put("return_radial", EMObject::BOOL, "Return the radial filter function as an attribute (filter_curve)");
                        d.put("interpolate", EMObject::BOOL, "Whether or not to interpolate the radial scaling function. Default=false. Prb should be true.");
                        return d;
                }
static Processor* EMAN::MatchSFProcessor::NEW ( ) [inline, static]

Definition at line 6131 of file processor.h.

                {
                        return new MatchSFProcessor();
                }

Member Data Documentation

const string MatchSFProcessor::NAME = "filter.matchto" [static]

Definition at line 6145 of file processor.h.

Referenced by get_name().


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