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

This processor will remove specified bad lines from CCD/DDD images, generally due to faulty lines/rows in the detector. More...

#include <processor.h>

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

Public Member Functions

void process_inplace (EMData *image)
 To process an image in-place. 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...
 
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.xybadlines"
 

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

This processor will remove specified bad lines from CCD/DDD images, generally due to faulty lines/rows in the detector.

Parameters
colsx locations of bad vertical lines
rowsy locations of bad horizontal lines

Definition at line 7396 of file processor.h.

Member Function Documentation

◆ get_desc()

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

7412 {
7413 return "This processor will correct defective pixel columns/rows by averaging adjacent pixel values";
7414 }

◆ get_name()

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

7402 {
7403 return NAME;
7404 }
static const string NAME
Definition: processor.h:7425

References NAME.

◆ get_param_types()

virtual TypeDict EMAN::BadLineXYProcessor::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 7416 of file processor.h.

7417 {
7418 TypeDict d;
7419 d.put("cols", EMObject::INTARRAY, "X coordinates of bad vertical lines");
7420 d.put("rows", EMObject::INTARRAY, "Y coordinates of bad horizontal lines.");
7421 d.put("neighbornorm", EMObject::INT, "Interpolate neighboring pixels, then divides by this factor. Default = 1.0.");
7422 return d;
7423 }
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::INT, EMAN::EMObject::INTARRAY, and EMAN::TypeDict::put().

◆ NEW()

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

Definition at line 7406 of file processor.h.

7407 {
7408 return new BadLineXYProcessor();
7409 }
This processor will remove specified bad lines from CCD/DDD images, generally due to faulty lines/row...
Definition: processor.h:7397

◆ process_inplace()

void BadLineXYProcessor::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 7820 of file processor.cpp.

7821{
7822 if (!image) {
7823 LOGWARN("NULL Image");
7824 return;
7825 }
7826
7827 if (image->get_zsize()>1) throw ImageDimensionException("Error: math.xybadlines works only on 2D images");
7828
7829 int nx=image->get_xsize();
7830 int ny=image->get_ysize();
7831
7832 vector <int> cols = params.set_default("cols",vector <int> ());
7833 vector <int> rows = params.set_default("rows",vector <int> ());
7834 float nnorm = params.set_default("neighbornorm",1.0f);//sqrt(2.0f));
7835
7836 int mincol = *min_element(cols.begin(),cols.end());
7837 int maxcol = *max_element(cols.begin(),cols.end());
7838
7839 int minrow = *min_element(rows.begin(),rows.end());
7840 int maxrow = *max_element(rows.begin(),rows.end());
7841
7842 int start;
7843 int ogl;
7844 int ngl;
7845 bool inflag;
7846 int pos;
7847
7848 ogl = 0;
7849 for (int x=mincol-1; x<=maxcol+1; x++) {
7850 inflag = false;
7851 for (int i=0; i<=cols.size(); i++) if (x==cols[i]) inflag = true;
7852 if (inflag == true) continue;
7853 else {
7854 inflag = false;
7855 for (int i=0; i<=cols.size(); i++) if ((x-1)==cols[i]) inflag = true;
7856 if (inflag == true){
7857 ngl = x;
7858 start = ogl+1;
7859 for (int c=start; c<ngl; c++) {
7860 //printf("Fixing column %d\n",c);
7861 pos = c-ogl;
7862 for (int y=0; y<ny; y++) {
7863 float val = ((image->get_value_at(ogl,y)*(ngl-ogl-pos)+image->get_value_at(ngl,y)*pos)) / (nnorm*(ngl-ogl));
7864 image->set_value_at(c,y,val);
7865 }
7866 }
7867 ogl = x;
7868 }
7869 else ogl = x;
7870 }
7871 }
7872
7873 ogl = 0;
7874 for (int y=minrow-1; y<=maxrow+1; y++) {
7875 inflag = false;
7876 for (int i=0; i<=rows.size(); i++) if (y==rows[i]) inflag = true;
7877 if (inflag == true) continue;
7878 else {
7879 inflag = false;
7880 for (int i=0; i<=rows.size(); i++) if ((y-1)==rows[i]) inflag = true;
7881 if (inflag == true){
7882 ngl = y;
7883 for (int r=ogl+1; r<ngl; r++) {
7884 //printf("Fixing row %d\n",r);
7885 pos = r-ogl;
7886 for (int x=0; x<nx; x++) {
7887 float val = ((image->get_value_at(x,ogl)*(ngl-ogl-pos)+image->get_value_at(x,ngl)*pos)) / (nnorm*(ngl-ogl));
7888 image->set_value_at(x,r,val);
7889 }
7890 }
7891 ogl = y;
7892 }
7893 else ogl = y;
7894 }
7895 }
7896}
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
#define ImageDimensionException(desc)
Definition: exception.h:166
#define LOGWARN
Definition: log.h:53
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517

References ImageDimensionException, LOGWARN, EMAN::Processor::params, EMAN::Dict::set_default(), x, and y.

Member Data Documentation

◆ NAME

const string BadLineXYProcessor::NAME = "math.xybadlines"
static

Definition at line 7425 of file processor.h.

Referenced by get_name().


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