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

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

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

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

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

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

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


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 Tue Jun 11 13:49:34 2013 for EMAN2 by  doxygen 1.3.9.1