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

06144                         {
06145                                 return "Make an image consisting of a single cross";
06146                         }

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

06139                         {
06140                                 return NAME;
06141                         }

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

References EMAN::TypeDict::put().

06154                         {
06155                                 TypeDict d;
06156                                 d.put("int", EMObject::FLOAT, "radius of the lines emanating from the origin");
06157                                 d.put("fill", EMObject::FLOAT, "value to make non-zero pixels");
06158                                 return d;
06159                         }

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

Definition at line 6148 of file processor.h.

06149                         {
06150                                 return new TestImageAxes();
06151                         }

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

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

07294 {
07295         preprocess(image);
07296 
07297         float fill = params.set_default("fill", 1.0f);
07298         // get the central coordinates
07299         int cx = nx/2;
07300         int cy = ny/2;
07301         int cz = nz/2;
07302 
07303         // Offsets are used to detect when "the extra pixel" needs to be filled in
07304         // They are implemented on the assumption that for odd dimensions
07305         // the "center pixel" is the center pixel, but for even dimensions the "center
07306         // pixel" is displaced in the positive direction by 1
07307         int xoffset = (nx % 2 == 0? 1:0);
07308         int yoffset = (ny % 2 == 0? 1:0);
07309         int zoffset = (nz % 2 == 0? 1:0);
07310 
07311         // This should never occur - but if indeed it did occur, the code in this function
07312         // would break - the function would proceed into the final "else" and seg fault
07313         // It is commented out but left for clarity
07314 //      if ( nx < 1 || ny < 1 || nz < 1 ) throw ImageDimensionException("Error: one of the image dimensions was less than zero");
07315 
07316         if ( nx == 1 && ny == 1 && nz == 1 )
07317         {
07318                 (*image)(0) = fill;
07319         }
07320         else if ( ny == 1 && nz == 1 )
07321         {
07322                 int radius = params.set_default("radius", cx );
07323                 if ( radius > cx ) radius = cx;
07324 
07325                 (*image)(cx) = fill;
07326                 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i) = fill;
07327                 for ( int i = 1; i <= radius; ++i ) (*image)(cx-i) = fill;
07328         }
07329         else if ( nz == 1 )
07330         {
07331                 int min = ( nx < ny ? nx : ny );
07332                 min /= 2;
07333 
07334                 int radius = params.set_default("radius", min );
07335                 if ( radius > min ) radius = min;
07336 
07337                 (*image)(cx,cy) = fill;
07338 
07339                 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i,cy) = fill;
07340                 for ( int i = 1; i <= radius-yoffset; ++i )(*image)(cx,cy+i) = fill;
07341 
07342                 for ( int i = 1; i <= radius; ++i )
07343                 {
07344                         (*image)(cx-i,cy) = fill;
07345                         (*image)(cx,cy-i) = fill;
07346                 }
07347 
07348         }
07349         else
07350         {
07351                 // nx > 1 && ny > 1 && nz > 1
07352                 int min = ( nx < ny ? nx : ny );
07353                 if (nz < min ) min = nz;
07354                 min /= 2;
07355 
07356                 int radius = params.set_default("radius", min);
07357                 if ( radius > min ) radius = min;
07358 
07359 
07360                 (*image)(cx,cy,cz) = fill;
07361                 for ( int i = 1; i <=radius-xoffset; ++i ) (*image)(cx+i,cy,cz) = fill;
07362                 for ( int i = 1; i <=radius-yoffset; ++i ) (*image)(cx,cy+i,cz) = fill;
07363                 for ( int i = 1; i <=radius-zoffset; ++i ) (*image)(cx,cy,cz+i) = fill;
07364                 for ( int i = 1; i <= radius; ++i )
07365                 {
07366                         (*image)(cx-i,cy,cz) = fill;
07367                         (*image)(cx,cy-i,cz) = fill;
07368                         (*image)(cx,cy,cz-i) = fill;
07369                 }
07370         }
07371 
07372         image->update();
07373 }


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 Aug 10 16:38:11 2012 for EMAN2 by  doxygen 1.3.9.1