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

Undo the effects of the FourierToCenterProcessor. More...

#include <processor.h>

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

Public Member Functions

virtual void process_inplace (EMData *image)
 Fourier origin shift the image in the backwards direction Should only be called after the application of FourierToCenterProcessor. More...
 
virtual string get_name () const
 Get the processor's name. More...
 
virtual 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...
 
virtual void set_params (const Dict &new_params)
 Set the processor parameters using a key/value dictionary. More...
 
virtual TypeDict get_param_types () const
 Get processor parameter information in a 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 = "xform.fourierorigin.tocorner"
 

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

Undo the effects of the FourierToCenterProcessor.

Author
David Woolford woolf.nosp@m.ord@.nosp@m.bcm.e.nosp@m.du
Date
October 2007

Definition at line 6603 of file processor.h.

Member Function Documentation

◆ get_desc()

virtual string EMAN::FourierToCornerProcessor::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 6623 of file processor.h.

6624 {
6625 return "Undoes the xform.fourierorigin.tocenter processor";
6626 }

◆ get_name()

virtual string EMAN::FourierToCornerProcessor::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 6613 of file processor.h.

6614 {
6615 return NAME;
6616 }
static const string NAME
Definition: processor.h:6628

References NAME.

◆ NEW()

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

Definition at line 6618 of file processor.h.

6619 {
6620 return new FourierToCornerProcessor();
6621 }
Undo the effects of the FourierToCenterProcessor.
Definition: processor.h:6604

◆ process_inplace()

void FourierToCornerProcessor::process_inplace ( EMData image)
virtual

Fourier origin shift the image in the backwards direction Should only be called after the application of FourierToCenterProcessor.

Parameters
imagethe image to operate on
Exceptions
ImageFormatExceptionif the image is not complex

Implements EMAN::Processor.

Definition at line 5885 of file processor.cpp.

5886{
5887 if ( !image->is_complex() ) throw ImageFormatException("Can not Fourier origin shift an image that is not complex");
5888
5889 int nx=image->get_xsize();
5890 int ny=image->get_ysize();
5891 int nz=image->get_zsize();
5892
5893 int nxy = nx*ny;
5894
5895 if ( ny == 1 && nz == 1 ){
5896 cout << "Warning- attempted Fourier origin shift a 1D image - no action taken" << endl;
5897 return;
5898 }
5899 int yodd = (ny%2==1);
5900 int zodd = (nz%2==1);
5901
5902 float* rdata = image->get_data();
5903
5904 float tmp[2];
5905 float* p1;
5906 float* p2;
5907
5908 if (yodd){
5909 // Swap the middle slice (with respect to the y direction) with the bottom slice
5910 // shifting all slices above the middles slice upwards by one pixel, stopping
5911 // at the middle slice, not if nz = 1 we are not talking about slices, we are
5912 // talking about rows
5913 float prev[2];
5914 size_t idx;
5915 for( int s = 0; s < nz; s++ ) {
5916 for( int c =0; c < nx; c += 2 ) {
5917 idx = (size_t)s*nxy+ny/2*nx+c;
5918 prev[0] = rdata[idx];
5919 prev[1] = rdata[idx+1];
5920 for( int r = 0; r <= ny/2; ++r ) {
5921 idx = (size_t)s*nxy+r*nx+c;
5922 float* p1 = &rdata[idx];
5923 tmp[0] = p1[0];
5924 tmp[1] = p1[1];
5925
5926 p1[0] = prev[0];
5927 p1[1] = prev[1];
5928
5929 prev[0] = tmp[0];
5930 prev[1] = tmp[1];
5931 }
5932 }
5933 }
5934 }
5935
5936 // Shift slices (3D) or rows (2D) correctly in the y direction
5937 size_t idx1, idx2;
5938 for( int s = 0; s < nz; ++s ) {
5939 for( int r = 0 + yodd; r < ny/2+yodd; ++r ) {
5940 for( int c =0; c < nx; c += 2 ) {
5941 idx1 = (size_t)s*nxy+r*nx+c;
5942 idx2 = (size_t)s*nxy+(r+ny/2)*nx+c;
5943 p1 = &rdata[idx1];
5944 p2 = &rdata[idx2];
5945
5946 tmp[0] = p1[0];
5947 tmp[1] = p1[1];
5948
5949 p1[0] = p2[0];
5950 p1[1] = p2[1];
5951
5952 p2[0] = tmp[0];
5953 p2[1] = tmp[1];
5954 }
5955 }
5956 }
5957
5958 if ( nz != 1 )
5959 {
5960
5961 if (zodd){
5962 // Swap the middle slice (with respect to the z direction) and the front slice
5963 // shifting all behind the front slice towards the middle a distance of 1 voxel,
5964 // stopping at the middle slice.
5965 float prev[2];
5966 size_t idx;
5967 for( int r = 0; r < ny; ++r ) {
5968 for( int c =0; c < nx; c += 2 ) {
5969 idx = (size_t)nz/2*nxy+r*nx+c;
5970 prev[0] = rdata[idx];
5971 prev[1] = rdata[idx+1];
5972 for( int s = 0; s <= nz/2; ++s ) {
5973 idx = (size_t)s*nxy+r*nx+c;
5974 float* p1 = &rdata[idx];
5975 tmp[0] = p1[0];
5976 tmp[1] = p1[1];
5977
5978 p1[0] = prev[0];
5979 p1[1] = prev[1];
5980
5981 prev[0] = tmp[0];
5982 prev[1] = tmp[1];
5983 }
5984 }
5985 }
5986 }
5987
5988 // Shift slices correctly in the z direction
5989 size_t idx1, idx2;
5990 for( int s = 0+zodd; s < nz/2 + zodd; ++s ) {
5991 for( int r = 0; r < ny; ++r ) {
5992 for( int c =0; c < nx; c += 2 ) {
5993 idx1 = (size_t)s*nxy+r*nx+c;
5994 idx2 = (size_t)(s+nz/2)*nxy+r*nx+c;
5995 p1 = &rdata[idx1];
5996 p2 = &rdata[idx2];
5997
5998 tmp[0] = p1[0];
5999 tmp[1] = p1[1];
6000
6001 p1[0] = p2[0];
6002 p1[1] = p2[1];
6003
6004 p2[0] = tmp[0];
6005 p2[1] = tmp[1];
6006 }
6007 }
6008 }
6009 }
6010 image->set_shuffled(false);
6011}
#define rdata(i)
Definition: analyzer.cpp:592
#define ImageFormatException(desc)
Definition: exception.h:147

References ImageFormatException, and rdata.

Member Data Documentation

◆ NAME

const string FourierToCornerProcessor::NAME = "xform.fourierorigin.tocorner"
static

Definition at line 6628 of file processor.h.

Referenced by get_name().


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