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

06142                         {
06143                                 return "Make an image consisting of a single cross";
06144                         }

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

References NAME.

06137                         {
06138                                 return NAME;
06139                         }

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

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

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

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

Definition at line 6146 of file processor.h.

06147                         {
06148                                 return new TestImageAxes();
06149                         }

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

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

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


Member Data Documentation

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

Definition at line 6159 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files:
Generated on Thu May 3 10:10:51 2012 for EMAN2 by  doxygen 1.4.7