Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
EMAN::SetSFProcessor Class Reference

Sets the structure factor based on a 1D s/intensity curve as an XYData object. More...

#include <processor.h>

Inheritance diagram for EMAN::SetSFProcessor:
Inheritance graph
Collaboration diagram for EMAN::SetSFProcessor:
Collaboration graph

Public Member Functions

virtual string get_name () const
 Get the processor's name. More...
virtual 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::FourierAnlProcessor
void process_inplace (EMData *image)
 To process an image in-place. 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::FourierAnlProcessor
static string get_group_desc ()
- 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 = "filter.setstrucfac"

Protected Member Functions

void create_radial_func (vector< float > &radial_mask, EMData *image) const
- Protected Member Functions inherited from EMAN::FourierAnlProcessor
virtual void preprocess (EMData *)

Additional Inherited Members

- Public Types inherited from EMAN::Processor
enum  fourier_filter_types {
 Fourier filter Processor type enum. More...
- Protected Attributes inherited from EMAN::Processor
Dict params

Detailed Description

Sets the structure factor based on a 1D s/intensity curve as an XYData object.

strucfacXYData object with the curve to be imposed as intensity as a function of s
apixA/pix value. Overrides and replaces apix_x/y/z in image

Definition at line 7911 of file processor.h.

Member Function Documentation

◆ create_radial_func()

void SetSFProcessor::create_radial_func ( vector< float > &  radial_mask,
EMData image 
) const

Implements EMAN::FourierAnlProcessor.

Definition at line 8376 of file processor.cpp.

8376 {
8377 // The radial mask comes in with the existing radial image profile
8378 // The radial mask runs from 0 to the corner in Fourier space
8380 XYData *sf = 0;
8381 if (params.has_key("filename")) {
8382 sf=new XYData;
8383 sf->read_file((const char *)params["filename"]);
8384 }
8385 else sf = params["strucfac"];
8386 if(params.has_key("apix")) {
8387 image->set_attr("apix_x", (float)params["apix"]);
8388 image->set_attr("apix_y", (float)params["apix"]);
8389 image->set_attr("apix_z", (float)params["apix"]);
8390 if (image->has_attr("ctf")) {
8391 Ctf *ctf=image->get_attr("ctf");
8392 ctf->apix=(float)params["apix"];
8393 image->set_attr("ctf",ctf);
8394 delete(ctf);
8395 }
8396 }
8397 float scale=params.set_default("scale",1.0f);
8399 float apix=image->get_attr("apix_x");
8400 int ny=image->get_ysize();
8401 int n = radial_mask.size();
8402 int nmax=(int)floor(sf->get_x(sf->get_size()-1)*apix*ny); // This is the radius at which we have our last valid value from the curve
8403 if (nmax>n) nmax=n;
8405 if ((nmax)<3) throw InvalidParameterException("Insufficient structure factor data for SetSFProcessor to be meaningful");
8407 int i;
8408 radial_mask[0]=1;
8409 for (i=1; i<nmax; i++) {
8410// if (radial_mask[i]>0)
8411// {
8412// radial_mask[i]= sqrt(n*sf->get_yatx(i/(apix*2.0f*n),false)/radial_mask[i]);
8413// }
8414 if (radial_mask[i]>0) {
8415 radial_mask[i]= sqrt((ny*ny*ny)*scale*sf->get_yatx(i/(apix*ny))/radial_mask[i]);
8416 }
8417 else if (i>0) radial_mask[i]=radial_mask[i-1]; // For points where the existing power spectrum was 0
8419 }
8421 // Continue to use a fixed factor after we run out of 'sf' values
8423 while (i<n) {
8424 radial_mask[i]=radial_mask[nmax-1];
8425 i++;
8426 }
8428 if (params.has_key("filename")) delete sf;
Ctf is the base class for all CTF model.
Definition: ctf.h:60
float apix
Definition: ctf.h:88
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
bool has_key(const string &key) const
Ask the Dictionary if it as a particular key.
Definition: emobject.h:511
XYData defines a 1D (x,y) data set.
Definition: xydata.h:47
size_t get_size() const
Definition: xydata.h:127
float get_yatx(float x, bool outzero=true)
Definition: xydata.cpp:172
float get_x(size_t i) const
Definition: xydata.h:84
int read_file(const string &filename)
Definition: xydata.cpp:77
EMData * sqrt() const
return square root of current image
#define InvalidParameterException(desc)
Definition: exception.h:361

References EMAN::Ctf::apix, EMAN::XYData::get_size(), EMAN::XYData::get_x(), EMAN::XYData::get_yatx(), EMAN::Dict::has_key(), InvalidParameterException, EMAN::Processor::params, EMAN::XYData::read_file(), EMAN::Dict::set_default(), and sqrt().

◆ get_desc()

virtual string EMAN::SetSFProcessor::get_desc ( ) const

Get the descrition of this specific processor.

This function must be overwritten by a subclass.

The description of this processor.

Implements EMAN::Processor.

Definition at line 7920 of file processor.h.

7921 {
7922 return "Filters the image so its 1-D power spectrum matches a supplied S,Y curve. If the S axis does not extend to Nyquist, only a uniform scaling will be applied beyond the end of the supplied curve. ";
7923 }

◆ get_name()

virtual string EMAN::SetSFProcessor::get_name ( ) const

Get the processor's name.

Each processor is identified by a unique name.

The processor's name.

Implements EMAN::Processor.

Definition at line 7915 of file processor.h.

7916 {
7917 return NAME;
7918 }
static const string NAME
Definition: processor.h:7940

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::SetSFProcessor::get_param_types ( ) const

Get processor parameter information in a dictionary.

Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.

A dictionary containing the parameter info.

Reimplemented from EMAN::FourierAnlProcessor.

Definition at line 7930 of file processor.h.

7931 {
7932 TypeDict d;
7933 d.put("strucfac", EMObject::XYDATA, "An XYData object contaning the intensity (not amplitude) to be imposed as a function of S");
7934 d.put("filename", EMObject::STRING, "Filename of a text file containing s,y data as an alternative to passing an XYData object.");
7935 d.put("scale", EMObject::XYDATA, "A constant to multiply strucfac by to rescale the output. Setting to 1/ny^3 provides an alternative normalization. default = 1.0");
7936 d.put("apix", EMObject::FLOAT, " Override A/pix in the image header (changes x,y and z)");
7937 return d;
7938 }
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::TypeDict::put(), EMAN::EMObject::STRING, and EMAN::EMObject::XYDATA.

◆ NEW()

static Processor * EMAN::SetSFProcessor::NEW ( )

Definition at line 7925 of file processor.h.

7926 {
7927 return new SetSFProcessor();
7928 }
Sets the structure factor based on a 1D s/intensity curve as an XYData object.
Definition: processor.h:7912

Member Data Documentation


const string SetSFProcessor::NAME = "filter.setstrucfac"

Definition at line 7940 of file processor.h.

Referenced by get_name().

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