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 ()

Private Attributes

int m_nlen
int m_nfac
EMDatam_mask
vector< float > m_data


Detailed Description

Definition at line 153 of file analyzer_sparx.h.


Constructor & Destructor Documentation

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

Definition at line 156 of file analyzer_sparx.h.

Referenced by NEW().

00156 : m_mask(NULL) {}


Member Function Documentation

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 680 of file analyzer.cpp.

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

00681 {
00682         if(m_mask==0)
00683                 throw NullPointerException("Null mask image pointer, set_params() first");
00684 
00685     EMData* img1d = Util::compress_image_mask(image,m_mask);
00686 
00687     m_data.insert( m_data.end(), img1d->get_data(), img1d->get_data() + m_nlen );
00688 
00689     m_nfac++;
00690 
00691     Assert( (int)m_data.size() == m_nfac*m_nlen);
00692 
00693     return 0;
00694 }

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 696 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().

00697 {
00698     int itmax = 10000;
00699     float eps = 1e-4f;
00700     int verbose = 1;
00701     float params[4];
00702     params[0] = 1.0;
00703     varmx( &m_data[0], m_nlen, m_nfac, IVARIMAX, params, NULL, itmax, eps, verbose);
00704 
00705     vector<EMData*> images;
00706 
00707     EMData* img1d = new EMData();
00708     img1d->set_size(m_nlen, 1, 1);
00709     for( int i=0; i < m_nfac; ++i )
00710     {
00711         float* imgdata = img1d->get_data();
00712 
00713         int offset = i * m_nlen;
00714         for( int i=0; i < m_nlen; ++i )
00715         {
00716             imgdata[i] = m_data[offset+i];
00717         }
00718 
00719         EMData* img = Util::reconstitute_image_mask(img1d,m_mask);
00720         images.push_back(img);
00721     }
00722 
00723     EMDeletePtr(img1d);
00724 
00725     return images;
00726 }

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 162 of file analyzer_sparx.h.

00163                 {
00164                         return "varimax";
00165                 }               

string EMAN::varimax::get_desc (  )  const [inline, virtual]

Get the Analyzer's description.

Returns:
The Analyzer's description.

Implements EMAN::Analyzer.

Definition at line 167 of file analyzer_sparx.h.

00168                 {
00169                         return "varimax rotation of PCA results";
00170                 }

static Analyzer* EMAN::varimax::NEW (  )  [inline, static]

Definition at line 172 of file analyzer_sparx.h.

References varimax().

Referenced by EMAN::Factory< T >::Factory().

00173                 {
00174                         return new varimax();
00175                 }

void varimax::set_params ( const Dict new_params  )  [virtual]

Set the Analyzer parameters using a key/value dictionary.

Parameters:
new_params A dictionary containing the new parameters.

Reimplemented from EMAN::Analyzer.

Definition at line 656 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().

00657 {
00658         params = new_params;
00659         m_mask = params["mask"];
00660 
00661         // count the number of pixels under the mask
00662         // (this is really ugly!!!)
00663         EMData *dummy = new EMData();
00664 
00665         int nx = m_mask->get_xsize();
00666         int ny = m_mask->get_ysize();
00667         int nz = m_mask->get_zsize();
00668 
00669         dummy->set_size(nx,ny,nz);
00670 
00671         EMData *dummy1d = Util::compress_image_mask(dummy,m_mask);
00672 
00673         m_nlen = dummy1d->get_xsize();
00674         m_nfac = 0;
00675 
00676         EMDeletePtr(dummy);
00677         EMDeletePtr(dummy1d);
00678 }

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 179 of file analyzer_sparx.h.

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

00180                 {
00181                         TypeDict d;
00182                         d.put("mask", EMObject::EMDATA, "mask image");
00183                         return d;
00184                 }


Member Data Documentation

int EMAN::varimax::m_nlen [private]

Definition at line 187 of file analyzer_sparx.h.

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

int EMAN::varimax::m_nfac [private]

Definition at line 188 of file analyzer_sparx.h.

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

Definition at line 189 of file analyzer_sparx.h.

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

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

Definition at line 190 of file analyzer_sparx.h.

Referenced by analyze(), and insert_image().


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

Generated on Sat Nov 21 02:20:45 2009 for EMAN2 by  doxygen 1.5.6