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:

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

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

06066                         {
06067                                 return "Make an image consisting of a single cross";
06068                         }

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

06061                         {
06062                                 return NAME;
06063                         }

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

References EMAN::TypeDict::put().

06076                         {
06077                                 TypeDict d;
06078                                 d.put("int", EMObject::FLOAT, "radius of the lines emanating from the origin");
06079                                 d.put("fill", EMObject::FLOAT, "value to make non-zero pixels");
06080                                 return d;
06081                         }

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

Definition at line 6070 of file processor.h.

06071                         {
06072                                 return new TestImageAxes();
06073                         }

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

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

07121 {
07122         preprocess(image);
07123 
07124         float fill = params.set_default("fill", 1.0f);
07125         // get the central coordinates
07126         int cx = nx/2;
07127         int cy = ny/2;
07128         int cz = nz/2;
07129 
07130         // Offsets are used to detect when "the extra pixel" needs to be filled in
07131         // They are implemented on the assumption that for odd dimensions
07132         // the "center pixel" is the center pixel, but for even dimensions the "center
07133         // pixel" is displaced in the positive direction by 1
07134         int xoffset = (nx % 2 == 0? 1:0);
07135         int yoffset = (ny % 2 == 0? 1:0);
07136         int zoffset = (nz % 2 == 0? 1:0);
07137 
07138         // This should never occur - but if indeed it did occur, the code in this function
07139         // would break - the function would proceed into the final "else" and seg fault
07140         // It is commented out but left for clarity
07141 //      if ( nx < 1 || ny < 1 || nz < 1 ) throw ImageDimensionException("Error: one of the image dimensions was less than zero");
07142 
07143         if ( nx == 1 && ny == 1 && nz == 1 )
07144         {
07145                 (*image)(0) = fill;
07146         }
07147         else if ( ny == 1 && nz == 1 )
07148         {
07149                 int radius = params.set_default("radius", cx );
07150                 if ( radius > cx ) radius = cx;
07151 
07152                 (*image)(cx) = fill;
07153                 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i) = fill;
07154                 for ( int i = 1; i <= radius; ++i ) (*image)(cx-i) = fill;
07155         }
07156         else if ( nz == 1 )
07157         {
07158                 int min = ( nx < ny ? nx : ny );
07159                 min /= 2;
07160 
07161                 int radius = params.set_default("radius", min );
07162                 if ( radius > min ) radius = min;
07163 
07164                 (*image)(cx,cy) = fill;
07165 
07166                 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i,cy) = fill;
07167                 for ( int i = 1; i <= radius-yoffset; ++i )(*image)(cx,cy+i) = fill;
07168 
07169                 for ( int i = 1; i <= radius; ++i )
07170                 {
07171                         (*image)(cx-i,cy) = fill;
07172                         (*image)(cx,cy-i) = fill;
07173                 }
07174 
07175         }
07176         else
07177         {
07178                 // nx > 1 && ny > 1 && nz > 1
07179                 int min = ( nx < ny ? nx : ny );
07180                 if (nz < min ) min = nz;
07181                 min /= 2;
07182 
07183                 int radius = params.set_default("radius", min);
07184                 if ( radius > min ) radius = min;
07185 
07186 
07187                 (*image)(cx,cy,cz) = fill;
07188                 for ( int i = 1; i <=radius-xoffset; ++i ) (*image)(cx+i,cy,cz) = fill;
07189                 for ( int i = 1; i <=radius-yoffset; ++i ) (*image)(cx,cy+i,cz) = fill;
07190                 for ( int i = 1; i <=radius-zoffset; ++i ) (*image)(cx,cy,cz+i) = fill;
07191                 for ( int i = 1; i <= radius; ++i )
07192                 {
07193                         (*image)(cx-i,cy,cz) = fill;
07194                         (*image)(cx,cy-i,cz) = fill;
07195                         (*image)(cx,cy,cz-i) = fill;
07196                 }
07197         }
07198 
07199         image->update();
07200 }


Member Data Documentation

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

Definition at line 202 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jul 12 13:51:29 2011 for EMAN2 by  doxygen 1.3.9.1