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

00160 : 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 702 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().

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

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.

00172                 {
00173                         return "varimax rotation of PCA results";
00174                 }

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.

00167                 {
00168                         return NAME;
00169                 }               

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

00184                 {
00185                         TypeDict d;
00186                         d.put("mask", EMObject::EMDATA, "mask image");
00187                         return d;
00188                 }

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

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

00687 {
00688         if(m_mask==0)
00689                 throw NullPointerException("Null mask image pointer, set_params() first");
00690 
00691     EMData* img1d = Util::compress_image_mask(image,m_mask);
00692 
00693     m_data.insert( m_data.end(), img1d->get_data(), img1d->get_data() + m_nlen );
00694 
00695     m_nfac++;
00696 
00697     Assert( (int)m_data.size() == m_nfac*m_nlen);
00698 
00699     return 0;
00700 }

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

Definition at line 176 of file analyzer_sparx.h.

References varimax().

00177                 {
00178                         return new varimax();
00179                 }

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

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


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

EMData* EMAN::varimax::m_mask [private]

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:
Generated on Tue May 25 17:18:00 2010 for EMAN2 by  doxygen 1.4.7