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]
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

static ProcessorNEW ()

Static Public Attributes

static 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 6045 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 6059 of file processor.h.

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

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

References NAME.

06055                         {
06056                                 return NAME;
06057                         }

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

References EMAN::EMObject::FLOAT, and EMAN::TypeDict::put().

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

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

Definition at line 6064 of file processor.h.

06065                         {
06066                                 return new TestImageAxes();
06067                         }

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 7021 of file processor.cpp.

References min, EMAN::Processor::params, EMAN::TestImageProcessor::preprocess(), EMAN::Dict::set_default(), and EMAN::EMData::update().

07022 {
07023         preprocess(image);
07024 
07025         float fill = params.set_default("fill", 1.0f);
07026         // get the central coordinates
07027         int cx = nx/2;
07028         int cy = ny/2;
07029         int cz = nz/2;
07030 
07031         // Offsets are used to detect when "the extra pixel" needs to be filled in
07032         // They are implemented on the assumption that for odd dimensions
07033         // the "center pixel" is the center pixel, but for even dimensions the "center
07034         // pixel" is displaced in the positive direction by 1
07035         int xoffset = (nx % 2 == 0? 1:0);
07036         int yoffset = (ny % 2 == 0? 1:0);
07037         int zoffset = (nz % 2 == 0? 1:0);
07038 
07039         // This should never occur - but if indeed it did occur, the code in this function
07040         // would break - the function would proceed into the final "else" and seg fault
07041         // It is commented out but left for clarity
07042 //      if ( nx < 1 || ny < 1 || nz < 1 ) throw ImageDimensionException("Error: one of the image dimensions was less than zero");
07043 
07044         if ( nx == 1 && ny == 1 && nz == 1 )
07045         {
07046                 (*image)(0) = fill;
07047         }
07048         else if ( ny == 1 && nz == 1 )
07049         {
07050                 int radius = params.set_default("radius", cx );
07051                 if ( radius > cx ) radius = cx;
07052 
07053                 (*image)(cx) = fill;
07054                 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i) = fill;
07055                 for ( int i = 1; i <= radius; ++i ) (*image)(cx-i) = fill;
07056         }
07057         else if ( nz == 1 )
07058         {
07059                 int min = ( nx < ny ? nx : ny );
07060                 min /= 2;
07061 
07062                 int radius = params.set_default("radius", min );
07063                 if ( radius > min ) radius = min;
07064 
07065                 (*image)(cx,cy) = fill;
07066 
07067                 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i,cy) = fill;
07068                 for ( int i = 1; i <= radius-yoffset; ++i )(*image)(cx,cy+i) = fill;
07069 
07070                 for ( int i = 1; i <= radius; ++i )
07071                 {
07072                         (*image)(cx-i,cy) = fill;
07073                         (*image)(cx,cy-i) = fill;
07074                 }
07075 
07076         }
07077         else
07078         {
07079                 // nx > 1 && ny > 1 && nz > 1
07080                 int min = ( nx < ny ? nx : ny );
07081                 if (nz < min ) min = nz;
07082                 min /= 2;
07083 
07084                 int radius = params.set_default("radius", min);
07085                 if ( radius > min ) radius = min;
07086 
07087 
07088                 (*image)(cx,cy,cz) = fill;
07089                 for ( int i = 1; i <=radius-xoffset; ++i ) (*image)(cx+i,cy,cz) = fill;
07090                 for ( int i = 1; i <=radius-yoffset; ++i ) (*image)(cx,cy+i,cz) = fill;
07091                 for ( int i = 1; i <=radius-zoffset; ++i ) (*image)(cx,cy,cz+i) = fill;
07092                 for ( int i = 1; i <= radius; ++i )
07093                 {
07094                         (*image)(cx-i,cy,cz) = fill;
07095                         (*image)(cx,cy-i,cz) = fill;
07096                         (*image)(cx,cy,cz-i) = fill;
07097                 }
07098         }
07099 
07100         image->update();
07101 }


Member Data Documentation

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

Definition at line 6077 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Tue May 25 17:17:33 2010 for EMAN2 by  doxygen 1.4.7