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

05972                         {
05973                                 return "Make an image consisting of a single cross";
05974                         }

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

05967                         {
05968                                 return NAME;
05969                         }

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

References EMAN::TypeDict::put().

05982                         {
05983                                 TypeDict d;
05984                                 d.put("int", EMObject::FLOAT, "radius of the lines emanating from the origin");
05985                                 d.put("fill", EMObject::FLOAT, "value to make non-zero pixels");
05986                                 return d;
05987                         }

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

Definition at line 5976 of file processor.h.

05977                         {
05978                                 return new TestImageAxes();
05979                         }

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

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

07091 {
07092         preprocess(image);
07093 
07094         float fill = params.set_default("fill", 1.0f);
07095         // get the central coordinates
07096         int cx = nx/2;
07097         int cy = ny/2;
07098         int cz = nz/2;
07099 
07100         // Offsets are used to detect when "the extra pixel" needs to be filled in
07101         // They are implemented on the assumption that for odd dimensions
07102         // the "center pixel" is the center pixel, but for even dimensions the "center
07103         // pixel" is displaced in the positive direction by 1
07104         int xoffset = (nx % 2 == 0? 1:0);
07105         int yoffset = (ny % 2 == 0? 1:0);
07106         int zoffset = (nz % 2 == 0? 1:0);
07107 
07108         // This should never occur - but if indeed it did occur, the code in this function
07109         // would break - the function would proceed into the final "else" and seg fault
07110         // It is commented out but left for clarity
07111 //      if ( nx < 1 || ny < 1 || nz < 1 ) throw ImageDimensionException("Error: one of the image dimensions was less than zero");
07112 
07113         if ( nx == 1 && ny == 1 && nz == 1 )
07114         {
07115                 (*image)(0) = fill;
07116         }
07117         else if ( ny == 1 && nz == 1 )
07118         {
07119                 int radius = params.set_default("radius", cx );
07120                 if ( radius > cx ) radius = cx;
07121 
07122                 (*image)(cx) = fill;
07123                 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i) = fill;
07124                 for ( int i = 1; i <= radius; ++i ) (*image)(cx-i) = fill;
07125         }
07126         else if ( nz == 1 )
07127         {
07128                 int min = ( nx < ny ? nx : ny );
07129                 min /= 2;
07130 
07131                 int radius = params.set_default("radius", min );
07132                 if ( radius > min ) radius = min;
07133 
07134                 (*image)(cx,cy) = fill;
07135 
07136                 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i,cy) = fill;
07137                 for ( int i = 1; i <= radius-yoffset; ++i )(*image)(cx,cy+i) = fill;
07138 
07139                 for ( int i = 1; i <= radius; ++i )
07140                 {
07141                         (*image)(cx-i,cy) = fill;
07142                         (*image)(cx,cy-i) = fill;
07143                 }
07144 
07145         }
07146         else
07147         {
07148                 // nx > 1 && ny > 1 && nz > 1
07149                 int min = ( nx < ny ? nx : ny );
07150                 if (nz < min ) min = nz;
07151                 min /= 2;
07152 
07153                 int radius = params.set_default("radius", min);
07154                 if ( radius > min ) radius = min;
07155 
07156 
07157                 (*image)(cx,cy,cz) = fill;
07158                 for ( int i = 1; i <=radius-xoffset; ++i ) (*image)(cx+i,cy,cz) = fill;
07159                 for ( int i = 1; i <=radius-yoffset; ++i ) (*image)(cx,cy+i,cz) = fill;
07160                 for ( int i = 1; i <=radius-zoffset; ++i ) (*image)(cx,cy,cz+i) = fill;
07161                 for ( int i = 1; i <= radius; ++i )
07162                 {
07163                         (*image)(cx-i,cy,cz) = fill;
07164                         (*image)(cx,cy-i,cz) = fill;
07165                         (*image)(cx,cy,cz-i) = fill;
07166                 }
07167         }
07168 
07169         image->update();
07170 }


Member Data Documentation

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

Definition at line 195 of file processor.cpp.


The documentation for this class was generated from the following files:
Generated on Mon Mar 7 18:21:19 2011 for EMAN2 by  doxygen 1.3.9.1