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

Fill missing wedge with information from another image. More...

#include <processor.h>

Inheritance diagram for EMAN::WedgeFillProcessor:
Inheritance graph
Collaboration diagram for EMAN::WedgeFillProcessor:
Collaboration graph

Public Member Functions

void process_inplace (EMData *image)
 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...
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 = "mask.wedgefill"

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

Fill missing wedge with information from another image.

Definition at line 5486 of file processor.h.

Member Function Documentation

◆ get_desc()

string EMAN::WedgeFillProcessor::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 5500 of file processor.h.

5501 {
5502 return "Identifies missing wedge voxels and fills them with data extracted from another image";
5503 }

◆ get_name()

string EMAN::WedgeFillProcessor::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 5491 of file processor.h.

5492 {
5493 return NAME;
5494 }
static const string NAME
Definition: processor.h:5514

References NAME.

◆ get_param_types()

TypeDict EMAN::WedgeFillProcessor::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::Processor.

Definition at line 5505 of file processor.h.

5506 {
5507 TypeDict d;
5508 d.put("fillsource", EMObject::EMDATA, "The image from which to draw the missing values. If omitted, will fill wedge with zero.");
5509 d.put("thresh_sigma", EMObject::FLOAT, "Multiplied by the standard deviation in each Fourier shell as a threshold for identifying 'missing' data.");
5510 d.put("maxtilt", EMObject::FLOAT, "Assumes Y is exact tilt axis, with 0 tilt in X-Y. Symmetrically fills region beyond +-maxtilt in degrees. Default=disabled");
5511 return d;
5512 }
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::EMDATA, EMAN::EMObject::FLOAT, and EMAN::TypeDict::put().

◆ NEW()

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

Definition at line 5495 of file processor.h.

5496 {
5497 return new WedgeFillProcessor();
5498 }
Fill missing wedge with information from another image.
Definition: processor.h:5487

◆ process_inplace()

void WedgeFillProcessor::process_inplace ( EMData image)

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.

imageThe image to be processed.

Implements EMAN::Processor.

Definition at line 1077 of file processor.cpp.

1079 if (!image) throw InvalidParameterException("WedgeFillProcessor: no image provided");
1080 if (!image->is_complex()) throw ImageFormatException("WedgeFillProcessor: target image must be complex");
1082 EMData *source=(EMData *)params.set_default("fillsource",(EMData *)NULL);
1083// if (!source) throw InvalidParameterException("WedgeFillProcessor: fillsource required");
1085 if (source && !source->is_complex()) throw ImageFormatException("WedgeFillProcessor: fillsource must be complex");
1086 if (image->get_xsize()!=source->get_xsize()||image->get_ysize()!=source->get_ysize()||image->get_zsize()!=source->get_zsize()) throw ImageFormatException("WedgeFillProcessor: image/fill size mismatch");
1088 int nx=image->get_xsize();
1089 int ny=image->get_ysize();
1090 int nz=image->get_zsize();
1091 float thresh_sigma = (float)params.set_default("thresh_sigma", 0.5);
1092 bool dosigma = 1 ? thresh_sigma>0.0 : 0;
1094 float maxtilt = (float)params.set_default("maxtilt", 90.0);
1095 bool dotilt = 1 ? maxtilt <90.0 : 0;
1096 maxtilt*=M_PI/180.0;
1098 vector<float> sigmaimg;
1099 if (dosigma) {
1100 sigmaimg=image->calc_radial_dist(nx/2,0,1,4);
1101 for (int i=0; i<nx/2; i++) sigmaimg[i]*=sigmaimg[i]*thresh_sigma; // anything less than 1/10 sigma is considered to be missing
1102 }
1104 vector<int> realpixel(nx/2);
1105 for (int i=0; i<nx/2; i++) realpixel[i]=0;
1107 for (int z=0; z<nz; z++) {
1108 for (int y=0; y<ny; y++) {
1109 for (int x=0; x<nx; x+=2) {
1110 float r2=Util::hypot3(x/2,y<ny/2?y:ny-y,z<nz/2?z:nz-z); // origin at 0,0; periodic
1111 int r=int(r2);
1112 if (r<3) continue; // too few points at r<3 to consider any "missing"
1114 float tilt = 0.0;
1115 if (dotilt) tilt=atan2((float)(z<nz/2?z:nz-z),(float)(x/2));
1117 float v1r=image->get_value_at(x,y,z);
1118 float v1i=image->get_value_at(x+1,y,z);
1119 float v1=Util::square_sum(v1r,v1i);
1120// if (r<10) printf("%d %d %d %d\t%1.3g %1.3g\n",x,y,z,r,v1,sigmaimg[r]);
1121 if ((!dosigma || v1>sigmaimg[r]) && r<nx/2 && (!dotilt || fabs(tilt)<maxtilt)){
1122 realpixel[r]++;
1123 continue;
1124 }
1126 if (!source) {
1127 image->set_value_at_fast(x,y,z,0);
1128 image->set_value_at_fast(x+1,y,z,0);
1129 }
1130 else {
1131 image->set_value_at_fast(x,y,z,source->get_value_at(x,y,z));
1132 image->set_value_at_fast(x+1,y,z,source->get_value_at(x+1,y,z));
1133 }
1134 }
1135 }
1136 }
1138 image->set_attr("real_pixels", realpixel);
1139 image->update();
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
vector< float > calc_radial_dist(int n, float x0, float dx, int inten)
calculates radial distribution.
Definition: emdata.cpp:2781
static float hypot3(int x, int y, int z)
Euclidean distance function in 3D: f(x,y,z) = sqrt(x*x + y*y + z*z);.
Definition: util.h:827
static float square_sum(float x, float y)
Calcuate (x*x + y*y).
Definition: util.h:764
#define InvalidParameterException(desc)
Definition: exception.h:361
#define ImageFormatException(desc)
Definition: exception.h:147
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517

References EMAN::EMData::calc_radial_dist(), EMAN::Util::hypot3(), ImageFormatException, InvalidParameterException, EMAN::Processor::params, EMAN::Dict::set_default(), EMAN::Util::square_sum(), x, and y.

Member Data Documentation


const string WedgeFillProcessor::NAME = "mask.wedgefill"

Definition at line 5514 of file processor.h.

Referenced by get_name().

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