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

Try to normalize the 4 quadrants of a CCD image. More...

#include <processor.h>

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

Public Member Functions

virtual 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 = "filter.ccdnorm"
 

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

Try to normalize the 4 quadrants of a CCD image.

Author
Deepy Mann dsman.nosp@m.n@bc.nosp@m.m.tmc.nosp@m..edu
Date
9-2005
Parameters
widthnumber of pixels on either side of the seam to sample

Definition at line 8921 of file processor.h.

Member Function Documentation

◆ get_desc()

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

8937 {
8938 return "normalize the 4 quadrants of a CCD image";
8939 }

◆ get_name()

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

8927 {
8928 return NAME;
8929 }
static const string NAME
Definition: processor.h:8948

References NAME.

◆ get_param_types()

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

8942 {
8943 TypeDict d;
8944 d.put("width", EMObject::INT, "number of pixels on either side of the seam to sample");
8945 return d;
8946 }
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, and EMAN::TypeDict::put().

◆ NEW()

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

Definition at line 8931 of file processor.h.

8932 {
8933 return new CCDNormProcessor();
8934 }
Try to normalize the 4 quadrants of a CCD image.
Definition: processor.h:8922

◆ process_inplace()

void CCDNormProcessor::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 10255 of file processor.cpp.

10256{
10257 if (!image) {
10259 Log::logger()->error("Null image during call to CCDNorm\n");
10260 return;
10261 }
10262 if (image->get_zsize() > 1) {
10264 Log::logger()->error("CCDNorm does not support 3d images\n");
10265 return;
10266 }
10267
10268 int xs = image->get_xsize();
10269 int ys = image->get_ysize();
10270
10271 // width of sample area on either side of the seams
10272 int width = params["width"];
10273
10274 width%=(xs > ys ? xs/2 : ys/2); // make sure width is a valid value
10275 if (width==0) {
10276 width=1;
10277 }
10278
10279 // get the 4 "seams" of the image
10280 float *left, *right, *top, *bottom;
10281
10282 double *temp;
10283 temp= (double*)malloc((xs > ys ? xs*width : ys*width)*sizeof(double));
10284 if (temp==NULL) {
10286 Log::logger()->error("Could not allocate enough memory during call to CCDNorm\n");
10287 return;
10288 }
10289
10290 int x, y, z;
10291
10292 // the mean values of each seam and the average
10293 double mL,mR,mT,mB;
10294
10295 // how much to shift each seam
10296 double nl,nr,nt,nb;
10297
10298 // quad. shifting amount
10299 double q1,q2,q3,q4;
10300
10301 // calc. the mean for each quadrant
10302 for (z=0; z<width; z++) {
10303 left = image->get_col(xs/2 -1-z)->get_data();
10304 for (y=0; y<ys; y++)
10305 temp[z*ys+y]=left[y];
10306 }
10307 mL=gsl_stats_mean(temp,1,ys*width);
10308
10309 for (z=0; z<width; z++) {
10310 right = image->get_col(xs/2 +z)->get_data();
10311 for (y=0; y<ys; y++)
10312 temp[z*ys+y]=right[y];
10313 }
10314 mR=gsl_stats_mean(temp,1,ys*width);
10315
10316 for (z=0; z<width; z++) {
10317 top = image->get_row(ys/2 -1-z)->get_data();
10318 for (x=0; x<xs; x++)
10319 temp[z*xs+x]=top[x];
10320 }
10321 mT=gsl_stats_mean(temp,1,xs*width);
10322
10323 for (z=0; z<width; z++) {
10324 bottom = image->get_row(ys/2 +z)->get_data();
10325 for (x=0; x<xs; x++)
10326 temp[z*xs+x]=bottom[x];
10327 }
10328 mB=gsl_stats_mean(temp,1,xs*width);
10329
10330 free(temp);
10331
10332 nl=(mL+mR)/2-mL;
10333 nr=(mL+mR)/2-mR;
10334 nt=(mT+mB)/2-mT;
10335 nb=(mT+mB)/2-mB;
10336
10337 q1=nl+nt;
10338 q2=nr+nt;
10339 q3=nr+nb;
10340 q4=nl+nb;
10341
10342 // change the pixel values
10343 for (x = 0; x < xs / 2; x++)
10344 for (y = 0; y < ys / 2; y++) {
10345 image->set_value_at_fast(x, y, image->get_value_at(x, y) + static_cast<float>(q1));
10346 }
10347 for (x = xs / 2; x < xs; x++)
10348 for (y = 0; y < ys / 2; y++) {
10349 image->set_value_at_fast(x, y, image->get_value_at(x, y) + static_cast<float>(q2));
10350 }
10351 for (x = xs / 2; x < xs; x++)
10352 for (y = ys / 2; y < ys; y++) {
10353 image->set_value_at_fast(x, y, image->get_value_at(x, y) + static_cast<float>(q3));
10354 }
10355 for (x = 0; x < xs / 2; x++)
10356 for (y = ys / 2; y < ys; y++) {
10357 image->set_value_at_fast(x, y, image->get_value_at(x, y) + static_cast<float>(q4));
10358 }
10359
10360}
void set_level(int level)
Definition: log.cpp:165
void error(const char *format,...)
log an error message.
Definition: log.cpp:156
static Log * logger()
Definition: log.cpp:80
@ ERROR_LOG
Definition: log.h:73
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517

References EMAN::Log::error(), EMAN::Log::ERROR_LOG, EMAN::Log::logger(), EMAN::Processor::params, EMAN::Log::set_level(), x, and y.

Member Data Documentation

◆ NAME

const string CCDNormProcessor::NAME = "filter.ccdnorm"
static

Definition at line 8948 of file processor.h.

Referenced by get_name().


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