Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File 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:

[legend]
Collaboration diagram for EMAN::TestImageAxes:
[legend]
List of all members.

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.
virtual string get_name () const
 Get the processor's name.
virtual string get_desc () const
 Get the descrition of this specific processor.
virtual TypeDict get_param_types () const
 Get processor parameter information in a dictionary.

Static Public Member Functions

ProcessorNEW ()

Static Public Attributes

const string NAME = "testimage.axes"

Detailed Description

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

Author:
David Woolford <woolford@bcm.edu>
Date:
October 2007
Parameters:
radius the radial length of the lines from the origin
fill the value to assign to pixels made non zero

Definition at line 6044 of file processor.h.


Member Function Documentation

virtual string EMAN::TestImageAxes::get_desc  )  const [inline, virtual]
 

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 6058 of file processor.h.

06059                         {
06060                                 return "Make an image consisting of a single cross";
06061                         }

virtual string EMAN::TestImageAxes::get_name  )  const [inline, virtual]
 

Get the processor's name.

Each processor is identified by a unique name.

Returns:
The processor's name.

Implements EMAN::Processor.

Definition at line 6053 of file processor.h.

06054                         {
06055                                 return NAME;
06056                         }

virtual TypeDict EMAN::TestImageAxes::get_param_types  )  const [inline, virtual]
 

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 6068 of file processor.h.

References EMAN::TypeDict::put().

06069                         {
06070                                 TypeDict d;
06071                                 d.put("int", EMObject::FLOAT, "radius of the lines emanating from the origin");
06072                                 d.put("fill", EMObject::FLOAT, "value to make non-zero pixels");
06073                                 return d;
06074                         }

Processor* EMAN::TestImageAxes::NEW  )  [inline, static]
 

Definition at line 6063 of file processor.h.

06064                         {
06065                                 return new TestImageAxes();
06066                         }

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:
image the image to operate upon

Implements EMAN::Processor.

Definition at line 6990 of file processor.cpp.

References min, nx, ny, EMAN::TestImageProcessor::preprocess(), EMAN::Dict::set_default(), and EMAN::EMData::update().

06991 {
06992         preprocess(image);
06993 
06994         float fill = params.set_default("fill", 1.0f);
06995         // get the central coordinates
06996         int cx = nx/2;
06997         int cy = ny/2;
06998         int cz = nz/2;
06999 
07000         // Offsets are used to detect when "the extra pixel" needs to be filled in
07001         // They are implemented on the assumption that for odd dimensions
07002         // the "center pixel" is the center pixel, but for even dimensions the "center
07003         // pixel" is displaced in the positive direction by 1
07004         int xoffset = (nx % 2 == 0? 1:0);
07005         int yoffset = (ny % 2 == 0? 1:0);
07006         int zoffset = (nz % 2 == 0? 1:0);
07007 
07008         // This should never occur - but if indeed it did occur, the code in this function
07009         // would break - the function would proceed into the final "else" and seg fault
07010         // It is commented out but left for clarity
07011 //      if ( nx < 1 || ny < 1 || nz < 1 ) throw ImageDimensionException("Error: one of the image dimensions was less than zero");
07012 
07013         if ( nx == 1 && ny == 1 && nz == 1 )
07014         {
07015                 (*image)(0) = fill;
07016         }
07017         else if ( ny == 1 && nz == 1 )
07018         {
07019                 int radius = params.set_default("radius", cx );
07020                 if ( radius > cx ) radius = cx;
07021 
07022                 (*image)(cx) = fill;
07023                 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i) = fill;
07024                 for ( int i = 1; i <= radius; ++i ) (*image)(cx-i) = fill;
07025         }
07026         else if ( nz == 1 )
07027         {
07028                 int min = ( nx < ny ? nx : ny );
07029                 min /= 2;
07030 
07031                 int radius = params.set_default("radius", min );
07032                 if ( radius > min ) radius = min;
07033 
07034                 (*image)(cx,cy) = fill;
07035 
07036                 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i,cy) = fill;
07037                 for ( int i = 1; i <= radius-yoffset; ++i )(*image)(cx,cy+i) = fill;
07038 
07039                 for ( int i = 1; i <= radius; ++i )
07040                 {
07041                         (*image)(cx-i,cy) = fill;
07042                         (*image)(cx,cy-i) = fill;
07043                 }
07044 
07045         }
07046         else
07047         {
07048                 // nx > 1 && ny > 1 && nz > 1
07049                 int min = ( nx < ny ? nx : ny );
07050                 if (nz < min ) min = nz;
07051                 min /= 2;
07052 
07053                 int radius = params.set_default("radius", min);
07054                 if ( radius > min ) radius = min;
07055 
07056 
07057                 (*image)(cx,cy,cz) = fill;
07058                 for ( int i = 1; i <=radius-xoffset; ++i ) (*image)(cx+i,cy,cz) = fill;
07059                 for ( int i = 1; i <=radius-yoffset; ++i ) (*image)(cx,cy+i,cz) = fill;
07060                 for ( int i = 1; i <=radius-zoffset; ++i ) (*image)(cx,cy,cz+i) = fill;
07061                 for ( int i = 1; i <= radius; ++i )
07062                 {
07063                         (*image)(cx-i,cy,cz) = fill;
07064                         (*image)(cx,cy-i,cz) = fill;
07065                         (*image)(cx,cy,cz-i) = fill;
07066                 }
07067         }
07068 
07069         image->update();
07070 }


Member Data Documentation

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

Definition at line 197 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Apr 30 15:39:28 2010 for EMAN2 by  doxygen 1.3.9.1