#include <processor.h>
Inheritance diagram for EMAN::TestImageAxes:


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 | |
| Processor * | NEW () |
Static Public Attributes | |
| const string | NAME = "testimage.axes" |
| radius | the radial length of the lines from the origin | |
| fill | the value to assign to pixels made non zero |
Definition at line 6013 of file processor.h.
|
|
Get the descrition of this specific processor. This function must be overwritten by a subclass.
Implements EMAN::Processor. Definition at line 6027 of file processor.h. 06028 {
06029 return "Make an image consisting of a single cross";
06030 }
|
|
|
Get the processor's name. Each processor is identified by a unique name.
Implements EMAN::Processor. Definition at line 6022 of file processor.h. 06023 {
06024 return NAME;
06025 }
|
|
|
Get processor parameter information in a dictionary. Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Processor. Definition at line 6037 of file processor.h. References EMAN::TypeDict::put(). 06038 {
06039 TypeDict d;
06040 d.put("int", EMObject::FLOAT, "radius of the lines emanating from the origin");
06041 d.put("fill", EMObject::FLOAT, "value to make non-zero pixels");
06042 return d;
06043 }
|
|
|
Definition at line 6032 of file processor.h. 06033 {
06034 return new TestImageAxes();
06035 }
|
|
|
Make an image where the axes (where x,y and z=0) are some nono zero value.
Implements EMAN::Processor. Definition at line 7092 of file processor.cpp. References min, nx, ny, EMAN::TestImageProcessor::preprocess(), EMAN::Dict::set_default(), and EMAN::EMData::update(). 07093 {
07094 preprocess(image);
07095
07096 float fill = params.set_default("fill", 1.0f);
07097 // get the central coordinates
07098 int cx = nx/2;
07099 int cy = ny/2;
07100 int cz = nz/2;
07101
07102 // Offsets are used to detect when "the extra pixel" needs to be filled in
07103 // They are implemented on the assumption that for odd dimensions
07104 // the "center pixel" is the center pixel, but for even dimensions the "center
07105 // pixel" is displaced in the positive direction by 1
07106 int xoffset = (nx % 2 == 0? 1:0);
07107 int yoffset = (ny % 2 == 0? 1:0);
07108 int zoffset = (nz % 2 == 0? 1:0);
07109
07110 // This should never occur - but if indeed it did occur, the code in this function
07111 // would break - the function would proceed into the final "else" and seg fault
07112 // It is commented out but left for clarity
07113 // if ( nx < 1 || ny < 1 || nz < 1 ) throw ImageDimensionException("Error: one of the image dimensions was less than zero");
07114
07115 if ( nx == 1 && ny == 1 && nz == 1 )
07116 {
07117 (*image)(0) = fill;
07118 }
07119 else if ( ny == 1 && nz == 1 )
07120 {
07121 int radius = params.set_default("radius", cx );
07122 if ( radius > cx ) radius = cx;
07123
07124 (*image)(cx) = fill;
07125 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i) = fill;
07126 for ( int i = 1; i <= radius; ++i ) (*image)(cx-i) = fill;
07127 }
07128 else if ( nz == 1 )
07129 {
07130 int min = ( nx < ny ? nx : ny );
07131 min /= 2;
07132
07133 int radius = params.set_default("radius", min );
07134 if ( radius > min ) radius = min;
07135
07136 (*image)(cx,cy) = fill;
07137
07138 for ( int i = 1; i <= radius-xoffset; ++i ) (*image)(cx+i,cy) = fill;
07139 for ( int i = 1; i <= radius-yoffset; ++i )(*image)(cx,cy+i) = fill;
07140
07141 for ( int i = 1; i <= radius; ++i )
07142 {
07143 (*image)(cx-i,cy) = fill;
07144 (*image)(cx,cy-i) = fill;
07145 }
07146
07147 }
07148 else
07149 {
07150 // nx > 1 && ny > 1 && nz > 1
07151 int min = ( nx < ny ? nx : ny );
07152 if (nz < min ) min = nz;
07153 min /= 2;
07154
07155 int radius = params.set_default("radius", min);
07156 if ( radius > min ) radius = min;
07157
07158
07159 (*image)(cx,cy,cz) = fill;
07160 for ( int i = 1; i <=radius-xoffset; ++i ) (*image)(cx+i,cy,cz) = fill;
07161 for ( int i = 1; i <=radius-yoffset; ++i ) (*image)(cx,cy+i,cz) = fill;
07162 for ( int i = 1; i <=radius-zoffset; ++i ) (*image)(cx,cy,cz+i) = fill;
07163 for ( int i = 1; i <= radius; ++i )
07164 {
07165 (*image)(cx-i,cy,cz) = fill;
07166 (*image)(cx,cy-i,cz) = fill;
07167 (*image)(cx,cy,cz-i) = fill;
07168 }
07169 }
07170
07171 image->update();
07172 }
|
|
|
Definition at line 197 of file processor.cpp. |
1.3.9.1