Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

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

AnalyzerNEW ()

Static Public Attributes

const string NAME = "varimax"

Private Attributes

int m_nlen
int m_nfac
EMDatam_mask
vector< float > m_data

Constructor & Destructor Documentation

EMAN::varimax::varimax  )  [inline]
 

Definition at line 160 of file analyzer_sparx.h.

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

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

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

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.

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

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

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

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

Definition at line 176 of file analyzer_sparx.h.

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 653 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, and EMAN::EMData::set_size().

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


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(), and set_params().

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

Definition at line 53 of file analyzer.cpp.


The documentation for this class was generated from the following files:
Generated on Thu Dec 9 13:48:41 2010 for EMAN2 by  doxygen 1.3.9.1