EMAN2
Public Member Functions | Static Public Member Functions | Static Public Attributes
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:
radiusthe radial length of the lines from the origin
fillthe value to assign to pixels made non zero

Definition at line 6540 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 6554 of file processor.h.

                        {
                                return "Make an image consisting of a single cross";
                        }
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 6549 of file processor.h.

References NAME.

                        {
                                return NAME;
                        }
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 6564 of file processor.h.

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

                        {
                                TypeDict d;
                                d.put("int", EMObject::FLOAT, "radius of the lines emanating from the origin");
                                d.put("fill", EMObject::FLOAT, "value to make non-zero pixels");
                                return d;
                        }
static Processor* EMAN::TestImageAxes::NEW ( ) [inline, static]

Definition at line 6559 of file processor.h.

                        {
                                return new TestImageAxes();
                        }
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:
imagethe image to operate upon

Implements EMAN::Processor.

Definition at line 7796 of file processor.cpp.

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

{
        preprocess(image);

        float fill = params.set_default("fill", 1.0f);
        // get the central coordinates
        int cx = nx/2;
        int cy = ny/2;
        int cz = nz/2;

        // Offsets are used to detect when "the extra pixel" needs to be filled in
        // They are implemented on the assumption that for odd dimensions
        // the "center pixel" is the center pixel, but for even dimensions the "center
        // pixel" is displaced in the positive direction by 1
        int xoffset = (nx % 2 == 0? 1:0);
        int yoffset = (ny % 2 == 0? 1:0);
        int zoffset = (nz % 2 == 0? 1:0);

        // This should never occur - but if indeed it did occur, the code in this function
        // would break - the function would proceed into the final "else" and seg fault
        // It is commented out but left for clarity
//      if ( nx < 1 || ny < 1 || nz < 1 ) throw ImageDimensionException("Error: one of the image dimensions was less than zero");

        if ( nx == 1 && ny == 1 && nz == 1 )
        {
                (*image)(0) = fill;
        }
        else if ( ny == 1 && nz == 1 )
        {
                int radius = params.set_default("radius", cx );
                if ( radius > cx ) radius = cx;

                (*image)(cx) = fill;
                for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i) = fill;
                for ( int i = 1; i <= radius; ++i ) (*image)(cx-i) = fill;
        }
        else if ( nz == 1 )
        {
                int min = ( nx < ny ? nx : ny );
                min /= 2;

                int radius = params.set_default("radius", min );
                if ( radius > min ) radius = min;

                (*image)(cx,cy) = fill;

                for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i,cy) = fill;
                for ( int i = 1; i <= radius-yoffset; ++i )(*image)(cx,cy+i) = fill;

                for ( int i = 1; i <= radius; ++i )
                {
                        (*image)(cx-i,cy) = fill;
                        (*image)(cx,cy-i) = fill;
                }

        }
        else
        {
                // nx > 1 && ny > 1 && nz > 1
                int min = ( nx < ny ? nx : ny );
                if (nz < min ) min = nz;
                min /= 2;

                int radius = params.set_default("radius", min);
                if ( radius > min ) radius = min;


                (*image)(cx,cy,cz) = fill;
                for ( int i = 1; i <=radius-xoffset; ++i ) (*image)(cx+i,cy,cz) = fill;
                for ( int i = 1; i <=radius-yoffset; ++i ) (*image)(cx,cy+i,cz) = fill;
                for ( int i = 1; i <=radius-zoffset; ++i ) (*image)(cx,cy,cz+i) = fill;
                for ( int i = 1; i <= radius; ++i )
                {
                        (*image)(cx-i,cy,cz) = fill;
                        (*image)(cx,cy-i,cz) = fill;
                        (*image)(cx,cy,cz-i) = fill;
                }
        }

        image->update();
}

Member Data Documentation

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

Definition at line 6572 of file processor.h.

Referenced by get_name().


The documentation for this class was generated from the following files: