EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes
EMAN::varimax Class Reference

#include <analyzer_sparx.h>

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

List of all members.

Public Member Functions

 varimax ()
virtual int insert_image (EMData *image)
 insert a image to the list of input images
virtual vector< EMData * > analyze ()
 main function for Analyzer, analyze input images and create output images
string get_name () const
 Get the Analyzer's name.
string get_desc () const
 Get the Analyzer's description.
virtual void set_params (const Dict &new_params)
 Set the Analyzer parameters using a key/value dictionary.
TypeDict get_param_types () const
 Get Analyzer parameter information in a dictionary.

Static Public Member Functions

static AnalyzerNEW ()

Static Public Attributes

static const string NAME = "varimax"

Private Attributes

int m_nlen
int m_nfac
EMDatam_mask
vector< float > m_data

Detailed Description

Definition at line 157 of file analyzer_sparx.h.


Constructor & Destructor Documentation

EMAN::varimax::varimax ( ) [inline]

Definition at line 160 of file analyzer_sparx.h.

Referenced by NEW().

: m_mask(NULL) {}

Member Function Documentation

vector< EMData * > varimax::analyze ( ) [virtual]

main function for Analyzer, analyze input images and create output images

Returns:
vector<EMData *> result os images analysis

Implements EMAN::Analyzer.

Definition at line 786 of file analyzer.cpp.

References EMDeletePtr(), EMAN::EMData::get_data(), EMAN::Analyzer::images, imgdata, IVARIMAX, m_data, m_mask, m_nfac, m_nlen, EMAN::Analyzer::params, reconstitute_image_mask(), EMAN::EMData::set_size(), and varmx().

{
    int itmax = 10000;
    float eps = 1e-4f;
    int verbose = 1;
    float params[4];
    params[0] = 1.0;
    varmx( &m_data[0], m_nlen, m_nfac, IVARIMAX, params, NULL, itmax, eps, verbose);

    vector<EMData*> images;

    EMData* img1d = new EMData();
    img1d->set_size(m_nlen, 1, 1);
    for( int i=0; i < m_nfac; ++i )
    {
        float* imgdata = img1d->get_data();

        int offset = i * m_nlen;
        for( int i=0; i < m_nlen; ++i )
        {
            imgdata[i] = m_data[offset+i];
        }

        EMData* img = Util::reconstitute_image_mask(img1d,m_mask);
        images.push_back(img);
    }

    EMDeletePtr(img1d);

    return images;
}
string EMAN::varimax::get_desc ( ) const [inline, virtual]

Get the Analyzer's description.

Returns:
The Analyzer's description.

Implements EMAN::Analyzer.

Definition at line 171 of file analyzer_sparx.h.

                {
                        return "varimax rotation of PCA results";
                }
string EMAN::varimax::get_name ( ) const [inline, virtual]

Get the Analyzer's name.

Each Analyzer is identified by a unique name.

Returns:
The Analyzer's name.

Implements EMAN::Analyzer.

Definition at line 166 of file analyzer_sparx.h.

References NAME.

                {
                        return NAME;
                }               
TypeDict EMAN::varimax::get_param_types ( ) const [inline, virtual]

Get Analyzer 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.

Implements EMAN::Analyzer.

Definition at line 183 of file analyzer_sparx.h.

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

                {
                        TypeDict d;
                        d.put("mask", EMObject::EMDATA, "mask image");
                        return d;
                }
int varimax::insert_image ( EMData image) [virtual]

insert a image to the list of input images

Parameters:
image
Returns:
int 0 for success, <0 for fail

Implements EMAN::Analyzer.

Definition at line 770 of file analyzer.cpp.

References Assert, compress_image_mask(), EMAN::EMData::get_data(), m_data, m_mask, m_nfac, m_nlen, and NullPointerException.

{
        if(m_mask==0)
                throw NullPointerException("Null mask image pointer, set_params() first");

    EMData* img1d = Util::compress_image_mask(image,m_mask);

    m_data.insert( m_data.end(), img1d->get_data(), img1d->get_data() + m_nlen );

    m_nfac++;

    Assert( (int)m_data.size() == m_nfac*m_nlen);

    return 0;
}
static Analyzer* EMAN::varimax::NEW ( ) [inline, static]

Definition at line 176 of file analyzer_sparx.h.

References varimax().

                {
                        return new varimax();
                }
void varimax::set_params ( const Dict new_params) [virtual]

Set the Analyzer parameters using a key/value dictionary.

Parameters:
new_paramsA dictionary containing the new parameters.

Reimplemented from EMAN::Analyzer.

Definition at line 746 of file analyzer.cpp.

References compress_image_mask(), EMDeletePtr(), EMAN::EMData::get_xsize(), EMAN::EMData::get_ysize(), EMAN::EMData::get_zsize(), m_mask, m_nfac, m_nlen, nx, ny, EMAN::Analyzer::params, and EMAN::EMData::set_size().

{
        params = new_params;
        m_mask = params["mask"];

        // count the number of pixels under the mask
        // (this is really ugly!!!)
        EMData *dummy = new EMData();

        int nx = m_mask->get_xsize();
        int ny = m_mask->get_ysize();
        int nz = m_mask->get_zsize();

        dummy->set_size(nx,ny,nz);

        EMData *dummy1d = Util::compress_image_mask(dummy,m_mask);

        m_nlen = dummy1d->get_xsize();
        m_nfac = 0;

        EMDeletePtr(dummy);
        EMDeletePtr(dummy1d);
}

Member Data Documentation

vector<float> EMAN::varimax::m_data [private]

Definition at line 196 of file analyzer_sparx.h.

Referenced by analyze(), and insert_image().

Definition at line 195 of file analyzer_sparx.h.

Referenced by analyze(), insert_image(), and set_params().

int EMAN::varimax::m_nfac [private]

Definition at line 194 of file analyzer_sparx.h.

Referenced by analyze(), insert_image(), and set_params().

int EMAN::varimax::m_nlen [private]

Definition at line 193 of file analyzer_sparx.h.

Referenced by analyze(), insert_image(), and set_params().

const string EMAN::varimax::NAME = "varimax" [static]

Definition at line 190 of file analyzer_sparx.h.

Referenced by get_name().


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