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

Zeroes the values on the X=0 and y=0 Fourier axes (except x=y=0) More...

#include <processor.h>

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

Public Member Functions

string get_name () const
 Get the processor's name. More...
 
void process_inplace (EMData *image)
 To process an image in-place. More...
 
void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary. More...
 
TypeDict get_param_types () const
 Get processor parameter information in a dictionary. More...
 
string get_desc () const
 Get the descrition of this specific processor. 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...
 

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 = "filter.lowpass.gaussz"
 

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 Attributes inherited from EMAN::Processor
Dict params
 

Detailed Description

Zeroes the values on the X=0 and y=0 Fourier axes (except x=y=0)

Definition at line 542 of file processor.h.

Member Function Documentation

◆ get_desc()

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

576 {
577 return "Applies a Gaussian lowpass filter (or its inverse), but only along the Z axis (or X-Y). May be useful in anisotropic filtering of tomograms.";
578 }

◆ get_name()

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

546 {
547 return NAME;
548 }
static const string NAME
Definition: processor.h:580

References NAME.

◆ get_param_types()

TypeDict EMAN::GaussZFourierProcessor::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 557 of file processor.h.

558 {
559 TypeDict d;
560 d.put("cutoff_abs", EMObject::FLOAT, "Processor radius in terms of Nyquist (0-.5)");
561 d.put("cutoff_pixels", EMObject::FLOAT, " Width in Fourier pixels (0 - size()/2)");
562 d.put("cutoff_freq", EMObject::FLOAT, "1/Resolution in 1/A (0 - 1 / 2*apix). eg - a 20 A filter is cutoff_freq=0.05");
563 d.put("hppix", EMObject::FLOAT, "If specified will also apply a high pass filter with the specified radius in pixels");
564 d.put("apix", EMObject::FLOAT, " Override A/pix in the image header (changes x,y and z)");
565 d.put("centerfreq", EMObject::FLOAT, "center of filter frequency at z");
566 d.put("xynoz", EMObject::INT, "If set, filters the X-Y plane instead of Z");
567 return d;
568 }
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::GaussZFourierProcessor::NEW ( )
inlinestatic

Definition at line 570 of file processor.h.

571 {
572 return new GaussZFourierProcessor();
573 }
Zeroes the values on the X=0 and y=0 Fourier axes (except x=y=0)
Definition: processor.h:543

◆ process_inplace()

void GaussZFourierProcessor::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 1300 of file processor.cpp.

1301{
1302 if(params.has_key("apix")) {
1303 image->set_attr("apix_x", (float)params["apix"]);
1304 image->set_attr("apix_y", (float)params["apix"]);
1305 image->set_attr("apix_z", (float)params["apix"]);
1306 }
1307
1308 int xynoz = params.set_default("xynoz",0);
1309
1310 const Dict dict = image->get_attr_dict();
1311 if( params.has_key("cutoff_freq") ) {
1312 float val = (float)params["cutoff_freq"] * (float)dict["apix_x"];
1313 params["cutoff_abs"] = val;
1314 }
1315 else if( params.has_key("cutoff_pixels") ) {
1316 float val = ((float)params["cutoff_pixels"] / (float)dict["nx"]);
1317 params["cutoff_abs"] = val;
1318 }
1319
1320 float omega = params["cutoff_abs"];
1321 float zcenter=params.set_default("centerfreq",0.0f);
1322 float hppix = params.set_default("hppix",-1.0f);
1323
1324 omega = (omega<0?-1.0:1.0)*0.5f/omega/omega;
1325
1326 EMData *fft;
1327 int f=0;
1328
1329 if (!image) {
1330 LOGWARN("NULL Image");
1331 return;
1332 }
1333
1334 if (!image->is_complex()) {
1335 fft = image->do_fft();
1336 f=1;
1337 }
1338 else {
1339 fft=image;
1340 }
1341
1342 int nx=fft->get_xsize();
1343 int ny=fft->get_ysize();
1344 int nz=fft->get_ysize();
1345 omega /=(nz*nz)/4;
1346 zcenter=zcenter*(float)dict["apix_x"]*nz;
1347
1348 if (xynoz) {
1349 for (int x=0; x<nx/2; x++) {
1350 for (int z=(x==0?0:-nz/2); z<nz/2; z++) {
1351 for (int y=(x==0&&z==0?0:-ny/2); y<ny/2; y++) {
1352 std::complex <float> v=fft->get_complex_at(x,y,z);
1353 float r=Util::hypot_fast(x,y);
1354 fft->set_complex_at(x,y,z,v*exp(-omega*(r-zcenter)*(r-zcenter))*(r>hppix?1.0f:Util::hypot3(x,y,z)/hppix));
1355 }
1356 }
1357 }
1358 }
1359 else {
1360 for (int z=-nz/2; z<nz/2; z++) {
1361 for (int y=-ny/2; y<ny/2; y++) {
1362 for (int x=0; x<nx/2; x++) {
1363 std::complex <float> v=fft->get_complex_at(x,y,z);
1364 fft->set_complex_at(x,y,z,v*exp(-omega*(abs(z)-zcenter)*(abs(z)-zcenter))*(fabs(z)>hppix?1.0f:Util::hypot3(x,y,z)/hppix));
1365 }
1366 }
1367 }
1368 }
1369
1370 if (f) {
1371 EMData *ift=fft->do_ift();
1372 memcpy(image->get_data(),ift->get_data(),(nx-2)*ny*nz*sizeof(float));
1373 delete fft;
1374 delete ift;
1375 }
1376
1377}
Dict is a dictionary to store <string, EMObject> pair.
Definition: emobject.h:385
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
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
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 hypot_fast(int x, int y)
Euclidean distance in 2D for integers computed fast using a cached lookup table.
Definition: util.cpp:742
#define LOGWARN
Definition: log.h:53
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517

References EMAN::Dict::has_key(), EMAN::Util::hypot3(), EMAN::Util::hypot_fast(), LOGWARN, EMAN::Processor::params, EMAN::Dict::set_default(), x, and y.

◆ set_params()

void EMAN::GaussZFourierProcessor::set_params ( const Dict new_params)
inlinevirtual

Set the processor parameters using a key/value dictionary.

Parameters
new_paramsA dictionary containing the new parameters.

Reimplemented from EMAN::Processor.

Definition at line 552 of file processor.h.

553 {
554 params = new_params;
555 }

References EMAN::Processor::params.

Member Data Documentation

◆ NAME

const string GaussZFourierProcessor::NAME = "filter.lowpass.gaussz"
static

Definition at line 580 of file processor.h.

Referenced by get_name().


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