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

Make an image consisting of a single cross, with lines going in the axial directions, intersecting at the origin. More...

#include <processor.h>

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

Public Member Functions

virtual void process_inplace (EMData *image)
 Make an image where the axes (where x,y and z=0) are some nono zero value. 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::TestImageProcessor
static string get_group_desc ()
 
- 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 = "testimage.axes"
 

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 Member Functions inherited from EMAN::TestImageProcessor
void preprocess (EMData *image)
 
- Protected Attributes inherited from EMAN::TestImageProcessor
int nx
 
int ny
 
int nz
 
- Protected Attributes inherited from EMAN::Processor
Dict params
 

Detailed Description

Make an image consisting of a single cross, with lines going in the axial directions, intersecting at the origin.

Author
David Woolford woolf.nosp@m.ord@.nosp@m.bcm.e.nosp@m.du
Date
October 2007
Parameters
radiusthe radial length of the lines from the origin
fillthe value to assign to pixels made non zero

Definition at line 8370 of file processor.h.

Member Function Documentation

◆ get_desc()

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

8385 {
8386 return "Make an image consisting of a single cross";
8387 }

◆ get_name()

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

8380 {
8381 return NAME;
8382 }
static const string NAME
Definition: processor.h:8402

References NAME.

◆ get_param_types()

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

8395 {
8396 TypeDict d;
8397 d.put("int", EMObject::FLOAT, "radius of the lines emanating from the origin");
8398 d.put("fill", EMObject::FLOAT, "value to make non-zero pixels");
8399 return d;
8400 }
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, and EMAN::TypeDict::put().

◆ NEW()

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

Definition at line 8389 of file processor.h.

8390 {
8391 return new TestImageAxes();
8392 }
Make an image consisting of a single cross, with lines going in the axial directions,...
Definition: processor.h:8371

◆ process_inplace()

void TestImageAxes::process_inplace ( EMData image)
virtual

Make an image where the axes (where x,y and z=0) are some nono zero value.

Parameters
imagethe image to operate upon

Implements EMAN::Processor.

Definition at line 9401 of file processor.cpp.

9402{
9403 preprocess(image);
9404
9405 float fill = params.set_default("fill", 1.0f);
9406 // get the central coordinates
9407 int cx = nx/2;
9408 int cy = ny/2;
9409 int cz = nz/2;
9410
9411 // Offsets are used to detect when "the extra pixel" needs to be filled in
9412 // They are implemented on the assumption that for odd dimensions
9413 // the "center pixel" is the center pixel, but for even dimensions the "center
9414 // pixel" is displaced in the positive direction by 1
9415 int xoffset = (nx % 2 == 0? 1:0);
9416 int yoffset = (ny % 2 == 0? 1:0);
9417 int zoffset = (nz % 2 == 0? 1:0);
9418
9419 // This should never occur - but if indeed it did occur, the code in this function
9420 // would break - the function would proceed into the final "else" and seg fault
9421 // It is commented out but left for clarity
9422// if ( nx < 1 || ny < 1 || nz < 1 ) throw ImageDimensionException("Error: one of the image dimensions was less than zero");
9423
9424 if ( nx == 1 && ny == 1 && nz == 1 )
9425 {
9426 (*image)(0) = fill;
9427 }
9428 else if ( ny == 1 && nz == 1 )
9429 {
9430 int radius = params.set_default("radius", cx );
9431 if ( radius > cx ) radius = cx;
9432
9433 (*image)(cx) = fill;
9434 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i) = fill;
9435 for ( int i = 1; i <= radius; ++i ) (*image)(cx-i) = fill;
9436 }
9437 else if ( nz == 1 )
9438 {
9439 int min = ( nx < ny ? nx : ny );
9440 min /= 2;
9441
9442 int radius = params.set_default("radius", min );
9443 if ( radius > min ) radius = min;
9444
9445 (*image)(cx,cy) = fill;
9446
9447 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i,cy) = fill;
9448 for ( int i = 1; i <= radius-yoffset; ++i )(*image)(cx,cy+i) = fill;
9449
9450 for ( int i = 1; i <= radius; ++i )
9451 {
9452 (*image)(cx-i,cy) = fill;
9453 (*image)(cx,cy-i) = fill;
9454 }
9455
9456 }
9457 else
9458 {
9459 // nx > 1 && ny > 1 && nz > 1
9460 int min = ( nx < ny ? nx : ny );
9461 if (nz < min ) min = nz;
9462 min /= 2;
9463
9464 int radius = params.set_default("radius", min);
9465 if ( radius > min ) radius = min;
9466
9467
9468 (*image)(cx,cy,cz) = fill;
9469 for ( int i = 1; i <=radius-xoffset; ++i ) (*image)(cx+i,cy,cz) = fill;
9470 for ( int i = 1; i <=radius-yoffset; ++i ) (*image)(cx,cy+i,cz) = fill;
9471 for ( int i = 1; i <=radius-zoffset; ++i ) (*image)(cx,cy,cz+i) = fill;
9472 for ( int i = 1; i <= radius; ++i )
9473 {
9474 (*image)(cx-i,cy,cz) = fill;
9475 (*image)(cx,cy-i,cz) = fill;
9476 (*image)(cx,cy,cz-i) = fill;
9477 }
9478 }
9479
9480 image->update();
9481}
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
void preprocess(EMData *image)
Definition: processor.cpp:8923

References EMAN::TestImageProcessor::nx, EMAN::TestImageProcessor::ny, EMAN::TestImageProcessor::nz, EMAN::Processor::params, EMAN::TestImageProcessor::preprocess(), and EMAN::Dict::set_default().

Member Data Documentation

◆ NAME

const string TestImageAxes::NAME = "testimage.axes"
static

Definition at line 8402 of file processor.h.

Referenced by get_name().


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