EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
EMAN::ApplyPolynomialProfileToHelix Class Reference

#include <processor.h>

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

Public Member Functions

void process_inplace (EMData *in)
 To process an image in-place. More...
 
string get_name () const
 Get the processor's name. More...
 
string get_desc () const
 Get the descrition of this specific processor. More...
 
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 
- Public Member Functions inherited from EMAN::Processor
virtual ~Processor ()
 
virtual EMDataprocess (const EMData *const image)
 To proccess an image out-of-place. More...
 
virtual void process_list_inplace (vector< EMData * > &images)
 To process multiple images using the same algorithm. More...
 
virtual Dict get_params () const
 Get the processor parameters in a key/value dictionary. More...
 
virtual void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary. More...
 

Static Public Member Functions

static ProcessorNEW ()
 
- Static Public Member Functions inherited from EMAN::Processor
static string get_group_desc ()
 Get the description of this group of processors. More...
 
static void EMFourierFilterInPlace (EMData *fimage, Dict params)
 Compute a Fourier-filter processed image in place. More...
 
static EMDataEMFourierFilter (EMData *fimage, Dict params)
 Compute a Fourier-processor processed image without altering the original image. More...
 

Static Public Attributes

static const string NAME = "math.poly_radial_profile"
 

Additional Inherited Members

- Public Types inherited from EMAN::Processor
enum  fourier_filter_types {
  TOP_HAT_LOW_PASS , TOP_HAT_HIGH_PASS , TOP_HAT_BAND_PASS , TOP_HOMOMORPHIC ,
  GAUSS_LOW_PASS , GAUSS_HIGH_PASS , GAUSS_BAND_PASS , GAUSS_INVERSE ,
  GAUSS_HOMOMORPHIC , BUTTERWORTH_LOW_PASS , BUTTERWORTH_HIGH_PASS , BUTTERWORTH_HOMOMORPHIC ,
  KAISER_I0 , KAISER_SINH , KAISER_I0_INVERSE , KAISER_SINH_INVERSE ,
  SHIFT , TANH_LOW_PASS , TANH_HIGH_PASS , TANH_HOMOMORPHIC ,
  TANH_BAND_PASS , RADIAL_TABLE , CTF_
}
 Fourier filter Processor type enum. More...
 
- Protected Member Functions inherited from EMAN::ModelHelixProcessor
float radprofile (float r, int type)
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

Detailed Description

Definition at line 9278 of file processor.h.

Member Function Documentation

◆ get_desc()

string EMAN::ApplyPolynomialProfileToHelix::get_desc ( ) const
inlinevirtual

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

Returns
The description of this processor.

Implements EMAN::Processor.

Definition at line 9293 of file processor.h.

9294 {
9295 return "Finds the CM of each z-axis slice and applies a polynomial radial profile about it.";
9296 }

◆ get_name()

string EMAN::ApplyPolynomialProfileToHelix::get_name ( ) const
inlinevirtual

Get the processor's name.

Each processor is identified by a unique name.

Returns
The processor's name.

Implements EMAN::Processor.

Definition at line 9283 of file processor.h.

9284 {
9285 return NAME;
9286 }

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::ApplyPolynomialProfileToHelix::get_param_types ( ) const
inlinevirtual

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

Reimplemented from EMAN::Processor.

Definition at line 9297 of file processor.h.

9298 {
9299 TypeDict d;
9300 d.put("length", EMObject::FLOAT, "Helix length in angstroms.");
9301 d.put("z0", EMObject::INT, "z coordinate in pixels for the midpoint of the cylinder's axis, defaults to center of map");
9302 return d;
9303 }
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair.
Definition: emobject.h:305
void put(const string &key, EMObject::ObjectType o, const string &desc="")
Definition: emobject.h:330

References EMAN::EMObject::FLOAT, EMAN::EMObject::INT, and EMAN::TypeDict::put().

◆ NEW()

static Processor * EMAN::ApplyPolynomialProfileToHelix::NEW ( )
inlinestatic

Definition at line 9288 of file processor.h.

◆ process_inplace()

void ApplyPolynomialProfileToHelix::process_inplace ( EMData image)
virtual

To process an image in-place.

For those processors which can only be processed out-of-place, override this function to just print out some error message to remind user call the out-of-place version.

Parameters
imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 13221 of file processor.cpp.

13222{
13223 EMData * cyl = in;
13224 int nx = cyl->get_xsize();
13225 int ny = cyl->get_ysize();
13226 int nz = cyl->get_zsize();
13227 float apix_x = cyl->get_attr("apix_x"); //TODO: Ask Matt if I correctly handled cases where apix_x != apix_y or apix_x != apix_z are not equal
13228 float apix_y = cyl->get_attr("apix_y");
13229 float apix_z = cyl->get_attr("apix_z");
13230 float lengthAngstroms = params["length"];
13231 int z0 = params.set_default("z0", -1); //in voxels
13232
13233 if (z0 < 0 || z0 >= nz)
13234 z0 = nz / 2;
13235
13236 int z_start = Util::round( z0 - 0.5*lengthAngstroms/apix_z );
13237 int z_stop = Util::round( z0 + 0.5*lengthAngstroms/apix_z );
13238
13239 float * dat = cyl->get_data();
13240 double rho_x_sum, rho_y_sum, rho_sum, x_cm, y_cm, radius;
13241
13242 for (int k = 0; k < nz; ++k) //taking slices along z axis
13243 {
13244 rho_x_sum = rho_y_sum = rho_sum = 0; //Set to zero for a new slice
13245
13246 if (k >= z_start && k <= z_stop)
13247 //Apply the radial profile only between z_start and z_stop on the z axis
13248 {
13249 //Calculating CM for the slice...
13250 for (int j = 0; j < ny; ++j)
13251 {
13252 for (int i = 0; i < nx; ++i, ++dat)
13253 {
13254 rho_x_sum += (*dat)*i;
13255 rho_y_sum += (*dat)*j;
13256 rho_sum += *dat;
13257 }
13258 }
13259 if (rho_sum != 0)
13260 {
13261 dat -= nx*ny;//going back to the beginning of the dat array
13262 x_cm = rho_x_sum/rho_sum;
13263 y_cm = rho_y_sum/rho_sum;
13264
13265 //Applying radial profile...
13266 for (int j=0; j<ny;++j)
13267 {
13268 for (int i=0;i<nx;++i,++dat)
13269 {
13270 radius = hypot( (i-x_cm)*apix_x, (j-y_cm)*apix_y );
13271 *dat = radprofile((float)radius, 2);//Type 2 is the polynomial radial profile.
13272 }
13273 }
13274 }
13275 }
13276 else
13277 //Clear the map, setting the density to zero everywhere else.
13278 {
13279 for (int j=0; j<ny; j++)
13280 for(int i=0; i<nx; i++)
13281 {
13282 *dat = 0;
13283 dat++;
13284 }
13285 }
13286
13287 }
13288}
type set_default(const string &key, type val)
Default setting behavior This can be achieved using a template - d.woolford Jan 2008 (before there wa...
Definition: emobject.h:569
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
float radprofile(float r, int type)
static int round(float x)
Get ceiling round of a float number x.
Definition: util.h:465

References EMAN::Processor::params, EMAN::ModelHelixProcessor::radprofile(), EMAN::Util::round(), and EMAN::Dict::set_default().

Member Data Documentation

◆ NAME

const string ApplyPolynomialProfileToHelix::NAME = "math.poly_radial_profile"
static

Definition at line 9305 of file processor.h.

Referenced by get_name().


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